Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/06/10 16:01:19 (14 years ago)
Author:
bfarka
Message:

made struture changes in persistence classes and provider

Location:
branches/HeuristicLab.Services.Authentication Prototype/UnitTests
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabMembershipProviderTest.cs

    r3992 r4002  
    6767    [TestMethod()]
    6868    public void RequiresUniqueEmailTest() {
    69       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     69      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    7070      bool actual;
    7171      actual = target.RequiresUniqueEmail;
     
    7878    [TestMethod()]
    7979    public void RequiresQuestionAndAnswerTest() {
    80       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     80      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    8181      bool actual;
    8282      actual = target.RequiresQuestionAndAnswer;
     
    8989    [TestMethod()]
    9090    public void PasswordStrengthRegularExpressionTest() {
    91       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     91      MembershipProvider target = Membership.Provider; 
    9292      string actual;
    9393      actual = target.PasswordStrengthRegularExpression;
     
    100100    [TestMethod()]
    101101    public void PasswordFormatTest() {
    102       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     102      MembershipProvider target = Membership.Provider; 
    103103      MembershipPasswordFormat actual;
    104104      actual = target.PasswordFormat;
     
    111111    [TestMethod()]
    112112    public void PasswordAttemptWindowTest() {
    113       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     113      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    114114      int actual;
    115115      actual = target.PasswordAttemptWindow;
     
    122122    [TestMethod()]
    123123    public void MinRequiredPasswordLengthTest() {
    124       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     124      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    125125      int actual;
    126126      actual = target.MinRequiredPasswordLength;
     
    133133    [TestMethod()]
    134134    public void MinRequiredNonAlphanumericCharactersTest() {
    135       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     135      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    136136      int actual;
    137137      actual = target.MinRequiredNonAlphanumericCharacters;
     
    144144    [TestMethod()]
    145145    public void MaxInvalidPasswordAttemptsTest() {
    146       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     146      MembershipProvider target = Membership.Provider; 
    147147      int actual;
    148148      actual = target.MaxInvalidPasswordAttempts;
     
    155155    [TestMethod()]
    156156    public void EnablePasswordRetrievalTest() {
    157       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     157      MembershipProvider target = Membership.Provider; 
    158158      bool actual;
    159159      actual = target.EnablePasswordRetrieval;
     
    166166    [TestMethod()]
    167167    public void EnablePasswordResetTest() {
    168       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     168      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    169169      bool actual;
    170170      actual = target.EnablePasswordReset;
     
    177177    [TestMethod()]
    178178    public void ApplicationNameTest() {
    179       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     179      MembershipProvider target = Membership.Provider; 
    180180      string expected = string.Empty; // TODO: Initialize to an appropriate value
    181181      string actual;
     
    191191    [TestMethod()]
    192192    public void ValidateUserTest() {
    193       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
     193      MembershipProvider target = Membership.Provider; 
    194194      MembershipCreateStatus status;
    195195      target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status);
     
    202202    [TestMethod()]
    203203    public void ValidateUserTestEncrypted() {
    204       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
     204      MembershipProvider target = Membership.Provider; 
    205205      NameValueCollection config = new NameValueCollection();
    206206      config.Add("passwordFormat", "Encrypted");
    207       target.Initialize("", config);
    208207      MembershipCreateStatus status;
    209208      target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status);
     
    216215    [TestMethod()]
    217216    public void ValidateUserTestHashed() {
    218       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
    219       NameValueCollection config = new NameValueCollection();
    220       config.Add("passwordFormat", "Hashed");
    221       target.Initialize("", config);
     217      MembershipProvider target = Membership.Provider;
    222218      MembershipCreateStatus status;
    223219      target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status);
     
    230226    [TestMethod()]
    231227    public void UpdateUserTest() {
    232       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     228      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    233229      MembershipUser user = null; // TODO: Initialize to an appropriate value
    234230      target.UpdateUser(user);
     
    242238    public void LockUserTest()
    243239    {
    244         HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
     240        MembershipProvider target = Membership.Provider;
    245241        MembershipCreateStatus status;
    246         HeuristicLabUser user = (HeuristicLabUser)target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status);
     242        Persistence.HeuristicLabMembershipUser user = (Persistence.HeuristicLabMembershipUser)target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status);
    247243        user.UnlockUser();
    248         Assert.IsFalse(user.Locked);
    249         user.LockUser();
    250         Assert.IsTrue(user.Locked);
    251         Assert.Inconclusive("Verify the correctness of this test method.");
    252     }
    253 
    254     /// <summary>
    255     ///A test for UnlockUser
    256     ///</summary>
    257     [TestMethod()]
    258     public void UnlockUserTest()
    259     {
    260         HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
    261         MembershipCreateStatus status;
    262         HeuristicLabUser user = (HeuristicLabUser)target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status);
    263         user.LockUser();
    264         Assert.IsTrue(user.Locked);
    265         user.UnlockUser();
    266         Assert.IsFalse(user.Locked);
    267         Assert.Inconclusive("Verify the correctness of this test method.");
    268     }
     244        HeuristicLabUser dbUser = db.HeuristicLabUsers.Single(u => u.UserName == "testname");
     245        Assert.IsFalse(dbUser.Locked);
     246        Assert.IsTrue(dbUser.Locked);
     247       
     248    }
     249
     250 
    269251
    270252    /// <summary>
     
    273255    [TestMethod()]
    274256    public void ResetPasswordTest() {
    275       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     257      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    276258      string username = string.Empty; // TODO: Initialize to an appropriate value
    277259      string answer = string.Empty; // TODO: Initialize to an appropriate value
     
    288270    [TestMethod()]
    289271    public void GetUserNameByEmailTest() {
    290       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     272      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    291273      string email = string.Empty; // TODO: Initialize to an appropriate value
    292274      string expected = string.Empty; // TODO: Initialize to an appropriate value
     
    302284    [TestMethod()]
    303285    public void GetUserTest1() {
    304       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     286      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    305287      object providerUserKey = null; // TODO: Initialize to an appropriate value
    306288      bool userIsOnline = false; // TODO: Initialize to an appropriate value
     
    317299    [TestMethod()]
    318300    public void GetUserTest() {
    319       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     301      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    320302      string username = string.Empty; // TODO: Initialize to an appropriate value
    321303      bool userIsOnline = false; // TODO: Initialize to an appropriate value
     
    332314    [TestMethod()]
    333315    public void GetPasswordTest() {
    334       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     316      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    335317      string username = string.Empty; // TODO: Initialize to an appropriate value
    336318      string answer = string.Empty; // TODO: Initialize to an appropriate value
     
    347329    [TestMethod()]
    348330    public void GetNumberOfUsersOnlineTest() {
    349       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     331      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    350332      int expected = 0; // TODO: Initialize to an appropriate value
    351333      int actual;
     
    362344    [TestMethod()]
    363345    public void GetAllUsersTest() {
    364       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
     346      MembershipProvider target = Membership.Provider;
    365347      MembershipCreateStatus status;
    366348      int totalRecords;
     
    375357
    376358      int j = 0;
    377       foreach (HeuristicLabUser user in users) {
     359      foreach (HeuristicLabMembershipUser user in users) {
    378360        Assert.Equals("User " + j, user.UserName);
    379361        j++;
     
    388370    [TestMethod()]
    389371    public void FindUsersByNameTest() {
    390       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     372      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    391373      string usernameToMatch = string.Empty; // TODO: Initialize to an appropriate value
    392374      int pageIndex = 0; // TODO: Initialize to an appropriate value
     
    407389    [TestMethod()]
    408390    public void FindUsersByEmailTest() {
    409       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
     391      MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value
    410392      string emailToMatch = string.Empty; // TODO: Initialize to an appropriate value
    411393      int pageIndex = 0; // TODO: Initialize to an appropriate value
     
    427409    public void DeleteUserTest() {
    428410      // insert new user
    429       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
     411      MembershipProvider target = Membership.Provider;
    430412      MembershipCreateStatus status;
    431413      target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status);
     
    443425    public void CreateUserTest() {
    444426      // create user
    445       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
     427      MembershipProvider target = Membership.Provider;
    446428      MembershipCreateStatus status;
    447429      target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status);
     
    480462
    481463      // change data and check again
    482       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
     464      MembershipProvider target = Membership.Provider;
    483465      // gibt zwar true zurück, was schon mal gut ist
    484466      Assert.IsTrue(target.ChangePasswordQuestionAndAnswer("testname", "INIT", "newquestion", "newanswer"));
     
    504486
    505487      // change data and check again
    506       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
     488      MembershipProvider target = Membership.Provider;
    507489      Assert.IsTrue(target.ChangePassword("testname", "INIT", "newPassword"));
    508490      // hat nix gemacht!! :(
     
    511493    }
    512494
    513     /// <summary>
    514     ///A test for HeuristicLabMembershipProvider Constructor
    515     ///</summary>
    516     [TestMethod()]
    517     public void HeuristicLabMembershipProviderConstructorTest() {
    518       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
    519       Assert.Inconclusive("TODO: Implement code to verify target");
    520     }
    521 
     495   
    522496    [TestMethod()]
    523497    public void NoDuplicateUserNameTest() {
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs

    r4000 r4002  
    383383    }
    384384  }
    385 } //HeuristicLabRoleProviderTest
     385}
     386
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/UnitTests.csproj

    r3976 r4002  
    6161    <Compile Include="HeuristicLabMembershipProviderTest.cs" />
    6262    <Compile Include="HeuristicLabRoleProviderTest.cs" />
    63     <Compile Include="HeuristicLabUserTest.cs" />
    6463    <Compile Include="Properties\AssemblyInfo.cs" />
    6564    <Compile Include="Service References\ServiceManagementRemote\Reference.cs">
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/app.config

    r3976 r4002  
    3737     
    3838    </system.serviceModel>
    39   <system.web>
    40     <compilation debug="true" />
    41   </system.web>
     39    <system.web>
     40      <compilation debug="true" />
     41      <membership defaultProvider="HeuristiclabMemberShipProvider" userIsOnlineTimeWindow="15">
     42        <providers>
     43          <clear/>
     44          <add
     45            name="HeuristiclabMemberShipProvider"
     46            type="Service.Provider.HeuristicLabMembershipProvider, Service"
     47            passwordFormat= "Hashed"/>
     48        </providers>
     49      </membership>
     50    </system.web>
     51 
    4252  <system.serviceModel>
    4353    <behaviors>
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/service/HeuristicLabManagementServiceTest.cs

    r3976 r4002  
    2727      }
    2828    }
    29 
    30     [TestMethod()]
    3129    public void TestCreateRoleTest() {
    3230      new ServiceManagementRemote.AuthorizationManagementServiceClient().CreateRole("myRole", true);
Note: See TracChangeset for help on using the changeset viewer.