Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3961


Ignore:
Timestamp:
06/26/10 11:52:44 (14 years ago)
Author:
jhaider
Message:

added ValidateUserTestEncrypted edited ValidateUserTest (#1046)

Location:
branches/HeuristicLab.Services.Authentication Prototype
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabMembershipProvider.cs

    r3958 r3961  
    2121    private int pPasswordAttemptWindow;
    2222    private int pMinRequiredPasswordLength;
    23     private MembershipPasswordFormat pPasswordFormat;
     23    private MembershipPasswordFormat pPasswordFormat = MembershipPasswordFormat.Clear;
    2424    private MachineKeySection machineKey;
    2525
     
    3333        throw new ArgumentNullException("config");
    3434
    35       if (name == null || name.Length == 0)
     35      if (string.IsNullOrEmpty(name) || name.Length == 0)
    3636        name = "HeuristicLabMembershipProvider";
    3737
     
    5555      string tempFormat = config["passwordFormat"];
    5656      if (tempFormat == null) {
    57         tempFormat = "Hashed";
     57        tempFormat = "Clear";
    5858      }
    5959
     
    257257
    258258    public override MembershipPasswordFormat PasswordFormat {
    259       get { throw new NotImplementedException(); }
     259      get { return pPasswordFormat; }
    260260    }
    261261
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabMembershipProviderTest.cs

    r3956 r3961  
    11using System;
     2using System.Collections.Specialized;
    23using Service.Provider;
    34using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    189190    [TestMethod()]
    190191    public void ValidateUserTest() {
    191       HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value
    192       string username = string.Empty; // TODO: Initialize to an appropriate value
    193       string password = string.Empty; // TODO: Initialize to an appropriate value
    194       bool expected = false; // TODO: Initialize to an appropriate value
    195       bool actual;
    196       actual = target.ValidateUser(username, password);
    197       Assert.AreEqual(expected, actual);
    198       Assert.Inconclusive("Verify the correctness of this test method.");
     192      HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
     193      MembershipCreateStatus status;
     194      target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status);
     195      Assert.IsTrue(target.ValidateUser("testname", "newPassword"));
     196    }
     197
     198    /// <summary>
     199    ///A test for ValidateUser
     200    ///</summary>
     201    [TestMethod()]
     202    public void ValidateUserTestEncrypted() {
     203      HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();
     204      NameValueCollection  config = new NameValueCollection();
     205      config.Add("passwordFormat", "Encrypted");
     206      target.Initialize("",config);
     207      MembershipCreateStatus status;
     208      target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status);
     209      Assert.IsTrue(target.ValidateUser("testname", "newPassword"));
    199210    }
    200211
Note: See TracChangeset for help on using the changeset viewer.