public static void ClassSetup() { //Set up a test configuration to use. var cfg = ConfigurationManager.OpenExeConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath); MembershipSection ms = (MembershipSection)cfg.GetSection("system.web/membership"); ProviderSettings psDefault = (ProviderSettings)ms.Providers[ms.DefaultProvider]; _testConfig = psDefault.Parameters; ProviderSettings psComplex = (ProviderSettings)ms.Providers["RethinkDbMemberShipProviderComplex"]; _testConfigComplex = psComplex.Parameters; Create_Database(_testConfig["clusterName"], _testConfig["dbName"], _testConfig["tableName"]); var RdPSetup = new RethinkDbMemberShipProvider(); RdPSetup.Initialize("RethinkDbMemberShipProvider", _testConfig); _testUsers = TestUtils.GetTestUsers(5, "Default"); foreach (var u in _testUsers) { MembershipCreateStatus status; RdPSetup.CreateUser(u.username, u.password, u.email, u.passwordQuestion, u.passwordAnswer, u.isApproved, u.providerUserKey, out status); } var RdPSetupComplex = new RethinkDbMemberShipProvider(); RdPSetupComplex.Initialize("RethinkDbMemberShipProviderComplex", _testConfigComplex); _testUsers = TestUtils.GetTestUsers(5, "Default"); foreach (var u in _testUsers) { MembershipCreateStatus status; RdPSetupComplex.CreateUser(u.username, u.password, u.email, u.passwordQuestion, u.passwordAnswer, u.isApproved, u.providerUserKey, out status); } }
public void InitializeTest() { _rdProv = new EncryptionProvider(); _rdProv.UserRepo = Utilities.GetMockRepository(); var config = new NameValueCollection(); config.Add("passwordFormat", "Hashed"); config.Add("requiresQuestionAndAnswer", "true"); _rdProv.Initialize("", config); }
public static void ClassCleanup() { //We will remove our sample users var NHPCleanup = new RethinkDbMemberShipProvider(); NHPCleanup.Initialize("RethinkDbMemberShipProvider", _testConfig); foreach (var user in _testUsers) { NHPCleanup.DeleteUser(user.username, true); } }
public static void ClassCleanup() { //We will remove our sample users var RdPCleanup = new RethinkDbMemberShipProvider(); RdPCleanup.Initialize("RethinkDbMemberShipProvider", _testConfig); foreach (var user in _testUsers) { RdPCleanup.DeleteUser(user.username, true); } //Drop_Database_If_Exists(_testConfig["clusterName"], _testConfig["dbName"], _testConfig["tableName"]); }
public static void ClassSetup(TestContext testContext) { //Set up a test configuration to use. _testConfig = new NameValueCollection(); _testConfig.Add("applicationName", "RPTestApp"); _testConfig.Add("passwordFormat", "Hashed"); //We will create three test users to work with while //exercising our tests. These will be used for various //read and find operations. var NHPSetup = new RethinkDbMemberShipProvider(); NHPSetup.Initialize("RethinkDbMemberShipProvider", _testConfig); _testUsers = TestUtils.GetTestUsers(5, "Hashed"); foreach (var u in _testUsers) { MembershipCreateStatus status; NHPSetup.CreateUser(u.username, u.password, u.email, u.passwordQuestion, u.passwordAnswer, u.isApproved, u.providerUserKey, out status); } }
public void TestSetup() { _rhp = new RethinkDbMemberShipProvider(); _rhp.Initialize("RethinkDbMemberShipProvider", _testConfig); }
public void TestCleanup() { _rhp = null; }
public void CleanupTest() { _rdProv = null; }
public void Initialize_NullRepository_CreatesDefaultRepository() { //Arrange _rdProv = new RethinkDbMemberShipProvider(); _rdProv.UserRepo = Utilities.GetMockRepository(); _rdProv.UserRepo = null; //Act _rdProv.Initialize("", new NameValueCollection()); //Assert Assert.IsNotNull(_rdProv.UserRepo); }
public void Initialize_NullName_SetsDefaultName() { //Arrange _rdProv = new RethinkDbMemberShipProvider(); _rdProv.UserRepo = Utilities.GetMockRepository(); var expected = "RethinkDbMemberShipProvider"; //Act _rdProv.Initialize("", new NameValueCollection()); var actual = _rdProv.Name; //Assert Assert.AreEqual(expected, actual); }
public void Initialize_NullConfig_ThrowsArgumentNullException() { //Arrange _rdProv = new RethinkDbMemberShipProvider(); _rdProv.UserRepo = Utilities.GetMockRepository(); //Act _rdProv.Initialize("", null); //Assert }
public void Initialize_EmptyConfig_ThrowsException() { //Arrange var nhpTemp = new RethinkDbMemberShipProvider(); //Act nhpTemp.Initialize("RethinkDbMemberShipProvider", null); }
public void GetPassword_BadAnswer_ThrowsException() { UserParameters u = _testUsers[0]; var nhTemp = new RethinkDbMemberShipProvider(); nhTemp.Initialize("RethinkDbMemberShipProviderComplex", _testConfigComplex); string answer = "KittyCatsLikeTuna"; nhTemp.GetPassword(u.username, answer); }
public void ResetPassword_NullAnswer_ThrowsException() { UserParameters u = _testUsers[0]; string newPass = ""; var nhTemp = new RethinkDbMemberShipProvider(); nhTemp.Initialize("RethinkDbMemberShipProvider", TestUtils.GetComplexConfig()); newPass = nhTemp.ResetPassword(u.username, null); }
public void Properties_ExerciseAllGetsAndSets() { var nhTemp = new RethinkDbMemberShipProvider(); nhTemp.Initialize("RethinkDbMemberShipProvider", TestUtils.GetComplexConfig()); nhTemp.ApplicationName = "TempApp"; Assert.AreEqual(nhTemp.ApplicationName, "TempApp"); Assert.AreEqual(nhTemp.MaxInvalidPasswordAttempts, 3); Assert.AreEqual(nhTemp.MinRequiredNonAlphanumericCharacters, 1); Assert.AreEqual(nhTemp.MinRequiredPasswordLength, 7); Assert.AreEqual(nhTemp.PasswordAttemptWindow, 10); Assert.AreEqual(nhTemp.PasswordStrengthRegularExpression, "^.*(?=.{6,})(?=.*[a-z])(?=.*[A-Z]).*$"); }
public void Initialize_ValidParms_DoesNotThrowException() { //Arrange var nhpTemp = new RethinkDbMemberShipProvider(); //Act nhpTemp.Initialize("RethinkDbMemberShipProvider", _testConfig); //Assert Assert.IsNotNull(nhpTemp.UserRepo); }
public void Initialize_NullName_SetsDefault() { //Arrange var nhpTemp = new RethinkDbMemberShipProvider(); //Act nhpTemp.Initialize(null, _testConfig); //Assert Assert.IsNotNull(nhpTemp.UserRepo); }
public void InitializeTest() { _rdProv = new RethinkDbMemberShipProvider(); _rdProv.UserRepo = Utilities.GetMockRepository(); var config = new NameValueCollection(); _rdProv.Initialize("", config); }
public void GetPassword_NoRetrieval_ThrowsException() { UserParameters u = _testUsers[0]; var nhTemp = new RethinkDbMemberShipProvider(); nhTemp.Initialize("RethinkDbMemberShipProvider", TestUtils.GetNoPasswordConfig()); string answer = "KittyCatsLikeTuna"; nhTemp.GetPassword(u.username, answer); }