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 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); } }