private void AddUser(string username, string password) { MembershipCreateStatus status; membershipProvider.CreateUser(username, password, username + "@bar.com", null, null, true, null, out status); if (status != MembershipCreateStatus.Success) { Assert.Fail("User creation failed"); } }
public void IsUserInRoleCrossDomain() { var provider = new MongoProviders.MembershipProvider(); NameValueCollection config1 = new NameValueCollection(); config1.Add("connectionStringName", _connStrName); config1.Add("applicationName", _applicationName); config1.Add("passwordStrengthRegularExpression", "bar.*"); config1.Add("passwordFormat", "Clear"); provider.Initialize(null, config1); MembershipCreateStatus status; provider.CreateUser("foo", "bar!bar", "*****@*****.**", null, null, true, null, out status); var provider2 = new MongoProviders.MembershipProvider(); NameValueCollection config2 = new NameValueCollection(); config2.Add("connectionStringName", _connStrName); config2.Add("applicationName", _appName2); config2.Add("passwordStrengthRegularExpression", ".*"); config2.Add("passwordFormat", "Clear"); provider2.Initialize(null, config2); roleProvider = new RoleProvider(); NameValueCollection config = new NameValueCollection(); config.Add("connectionStringName", _connStrName); config.Add("applicationName", _applicationName); roleProvider.Initialize(null, config); MongoProviders.RoleProvider r2 = new MongoProviders.RoleProvider(); NameValueCollection configr2 = new NameValueCollection(); configr2.Add("connectionStringName", _connStrName); configr2.Add("applicationName", _appName2); r2.Initialize(null, configr2); roleProvider.CreateRole("Administrator"); roleProvider.AddUsersToRoles(new string[] { "foo" }, new string[] { "Administrator" }); Assert.IsFalse(r2.IsUserInRole("foo", "Administrator")); }
public void IsUserInRoleCrossDomain() { var provider = new MongoProviders.MembershipProvider(); NameValueCollection config1 = new NameValueCollection(); config1.Add("connectionStringName", _connStrName); config1.Add("applicationName", _applicationName); config1.Add("passwordStrengthRegularExpression", "bar.*"); config1.Add("passwordFormat", "Clear"); provider.Initialize(null, config1); MembershipCreateStatus status; provider.CreateUser("foo", "bar!bar", "*****@*****.**", null, null, true, null, out status); var provider2 = new MongoProviders.MembershipProvider(); NameValueCollection config2 = new NameValueCollection(); config2.Add("connectionStringName", _connStrName); config2.Add("applicationName", _appName2); config2.Add("passwordStrengthRegularExpression", ".*"); config2.Add("passwordFormat", "Clear"); provider2.Initialize(null, config2); roleProvider = new RoleProvider(); NameValueCollection config = new NameValueCollection(); config.Add("connectionStringName", _connStrName); config.Add("applicationName", _applicationName); roleProvider.Initialize(null, config); MongoProviders.RoleProvider r2 = new MongoProviders.RoleProvider(); NameValueCollection configr2 = new NameValueCollection(); configr2.Add("connectionStringName", _connStrName); configr2.Add("applicationName", _appName2); r2.Initialize(null, configr2); roleProvider.CreateRole("Administrator"); roleProvider.AddUsersToRoles(new string[] { "foo" }, new string[] { "Administrator" }); Assert.IsFalse(r2.IsUserInRole("foo", "Administrator")); }