public void TestAddUsersToRoles()
        {
            var membershipConfig = new NameValueCollection(_membershipConfig);
            var roleConfig = new NameValueCollection(_roleConfig);

            var membershipProvider = new MongoMembershipProvider();
            membershipProvider.Initialize(DefaultMembershipName, membershipConfig);

            var roleProvider = new MongoRoleProvider();
            roleProvider.Initialize(DefaultRoleName, roleConfig);

            MembershipCreateStatus status;
            membershipProvider.CreateUser("user1", "123456", "*****@*****.**", null, null, true, null, out status);
            membershipProvider.CreateUser("user2", "123456", "*****@*****.**", null, null, true, null, out status);

            roleProvider.CreateRole("role1");
            roleProvider.CreateRole("role2");

            roleProvider.AddUsersToRoles(new[] { "user1", "user2" }, new[] { "role1", "role2" });
            Assert.IsTrue(roleProvider.IsUserInRole("user1", "role1"));
            Assert.IsTrue(roleProvider.IsUserInRole("user1", "role2"));
            Assert.IsTrue(roleProvider.IsUserInRole("user2", "role1"));
            Assert.IsTrue(roleProvider.IsUserInRole("user2", "role2"));
        }
        public void TestCreateUserWithDuplicateProviderUserKey()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            var providerUserKey = ObjectId.GenerateNewId();

            MembershipCreateStatus firstStatus;
            provider.CreateUser("foo", "123456", "*****@*****.**", null, null, true, providerUserKey, out firstStatus);

            Assert.AreEqual(MembershipCreateStatus.Success, firstStatus);

            MembershipCreateStatus secondStatus;
            provider.CreateUser("bar", "123456", "*****@*****.**", null, null, true, providerUserKey, out secondStatus);

            Assert.AreEqual(MembershipCreateStatus.DuplicateProviderUserKey, secondStatus);
        }
        public void TestGetUsersInRoleWhenNoUsersInRole()
        {
            var membershipConfig = new NameValueCollection(_membershipConfig);
            var roleConfig = new NameValueCollection(_roleConfig);

            var membershipProvider = new MongoMembershipProvider();
            membershipProvider.Initialize(DefaultMembershipName, membershipConfig);

            var roleProvider = new MongoRoleProvider();
            roleProvider.Initialize(DefaultRoleName, roleConfig);

            MembershipCreateStatus status;
            membershipProvider.CreateUser("user1", "123456", "*****@*****.**", null, null, true, null, out status);
            membershipProvider.CreateUser("user2", "123456", "*****@*****.**", null, null, true, null, out status);
            membershipProvider.CreateUser("user3", "123456", "*****@*****.**", null, null, true, null, out status);

            roleProvider.CreateRole("role1");

            var userNames = roleProvider.GetUsersInRole("role1");
            Assert.AreEqual(0, userNames.Length);
        }
        /// <summary>
        /// Creates 100 users, 80 of which have profiles, 40 are inactive, 40 are active, 40 are authenticated and 40 are anonymous.
        /// </summary>
        /// <param name="membershipProvider"></param>
        /// <param name="profileProvider"></param>
        private void SetUpTestProfiles(MongoMembershipProvider membershipProvider, MongoProfileProvider profileProvider)
        {
            // Make 20 users that have no profiles.
            for (int i = 0; i < 20; i++) {
                MembershipCreateStatus status;
                membershipProvider.CreateUser("user" + i, "123456", "user" + i + "@test.com", null, null, true, null, out status);
            }

            // Make 80 users that have profiles, half of them anonymous.
            for (int i = 20; i < 100; i++) {
                bool isAuthenticated = i % 2 == 0;

                if (isAuthenticated) {
                    MembershipCreateStatus status;
                    membershipProvider.CreateUser("user" + i, "123456", "user" + i + "@test.com", null, null, true, null, out status);
                }

                var values = new SettingsPropertyValueCollection();
                AddProviderSpecificPropertyValuesTo(values, allowAnonymous: true, prefix: string.Format("({0})", i));
                profileProvider.SetPropertyValues(TestHelper.GenerateSettingsContext("user" + i, isAuthenticated), values);
            }

            // Get a direction connection to the database so we can edit the LastActivityDate.
            var url = new MongoUrl(ConnectionString);
            var server = MongoServer.Create(url);
            var database = server.GetDatabase(url.DatabaseName);
            var collection = database.GetCollection(membershipProvider.ApplicationName + ".users");

            var inactiveDate = DateTime.Now.AddDays(-10);

            // Make half of all profiled users inactive.
            var query = Query.Where("this.UserName.substr(4) >= 60");
            var update = Update.Set("Profile.LastActivityDate", SerializationHelper.SerializeDateTime(inactiveDate));
            collection.Update(query, update, UpdateFlags.Multi);
        }
        public void TestFindUsersInRoleWithNonRegex()
        {
            var membershipConfig = new NameValueCollection(_membershipConfig);
            var roleConfig = new NameValueCollection(_roleConfig);

            var membershipProvider = new MongoMembershipProvider();
            membershipProvider.Initialize(DefaultMembershipName, membershipConfig);

            var roleProvider = new MongoRoleProvider();
            roleProvider.Initialize(DefaultRoleName, roleConfig);

            MembershipCreateStatus status;
            membershipProvider.CreateUser("aaaa", "123456", "*****@*****.**", null, null, true, null, out status);
            membershipProvider.CreateUser("aabb", "123456", "*****@*****.**", null, null, true, null, out status);
            membershipProvider.CreateUser("bbaa", "123456", "*****@*****.**", null, null, true, null, out status);
            membershipProvider.CreateUser("aacc", "123456", "*****@*****.**", null, null, true, null, out status);

            roleProvider.CreateRole("role1");
            roleProvider.CreateRole("role2");

            roleProvider.AddUsersToRoles(new[] { "aaaa", "aabb", "bbaa" }, new[] { "role1" });
            roleProvider.AddUsersToRoles(new[] { "aacc" }, new[] { "role2" });

            var userNames = roleProvider.FindUsersInRole("role1", "aa");
            Assert.AreEqual(3, userNames.Length);
            Assert.Contains("aaaa", userNames);
            Assert.Contains("aabb", userNames);
            Assert.Contains("bbaa", userNames);
        }
        public void TestUpdateUserWithoutRequiresUniqueEmailWithDuplicateEmail()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            MembershipCreateStatus status1;
            provider.CreateUser("test1", "123456", "*****@*****.**", null, null, true, null, out status1);

            MembershipCreateStatus status2;
            var user = provider.CreateUser("test2", "123456", "*****@*****.**", null, null, true, null, out status2);

            // Change the email to match the first user's email.
            user.Email = "*****@*****.**";

            // No exception as duplicate emails are allowed.
            provider.UpdateUser(user);
        }
        public void TestGetPropertyValuesUsingXmlProperties()
        {
            var membershipConfig = new NameValueCollection(_membershipConfig);
            var membershipProvider = new MongoMembershipProvider();
            membershipProvider.Initialize(DefaultMembershipName, membershipConfig);

            MembershipCreateStatus status;
            membershipProvider.CreateUser("user", "123456", "*****@*****.**", null, null, true, null, out status);

            var profileConfig = new NameValueCollection(_profileConfig);
            var profileProvider = new MongoProfileProvider();
            profileProvider.Initialize(DefaultProfileName, profileConfig);

            var values = new SettingsPropertyValueCollection();
            AddXmlPropertyValuesTo(values, allowAnonymous: false);
            profileProvider.SetPropertyValues(TestHelper.GenerateSettingsContext("user", true), values);

            var properties = new SettingsPropertyCollection();
            AddXmlPropertiesTo(properties, allowAnonymous: false);

            var retrievedValues = profileProvider
                .GetPropertyValues(TestHelper.GenerateSettingsContext("user", true), properties);
            var rawRetrievedValues = retrievedValues
                .Cast<SettingsPropertyValue>()
                .Select(value => value.PropertyValue)
                .ToList();
            Assert.AreEqual(1, retrievedValues.Count);
            Assert.Contains("Value of stringValue", rawRetrievedValues);
        }
        public void TestGetAllUsersUsingPaging()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            for (int i = 0; i < 100; i++) {
                MembershipCreateStatus status;
                provider.CreateUser("test" + i, "123456", "test" + i + "@test.com", "Test Question?", null, true, null,
                                    out status);
            }

            int totalRecords;
            var users = provider.GetAllUsers(0, 20, out totalRecords).Cast<MembershipUser>().ToArray();

            Assert.AreEqual(100, totalRecords);
            Assert.AreEqual(20, users.Length);

            for (int i = 0; i < 20; i++) {
                Assert.IsTrue(users[i].UserName.StartsWith("test"));
            }
        }
        public void TestGetNumberOfUsersOnlineWhenNoneAreOnline()
        {
            var config = new NameValueCollection(_config);

            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, config);

            MembershipCreateStatus status;
            provider.CreateUser("test", "123456", "*****@*****.**", "Question", "Answer", true, null, out status);

            var numberOfUsersOnline = provider.GetNumberOfUsersOnline();
            Assert.AreEqual(0, numberOfUsersOnline);
        }
        public void TestFindUsers()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            for (int i = 0; i < 100; i++) {
                MembershipCreateStatus status;
                provider.CreateUser("test" + i, "123456", "*****@*****.**", "Test Question?", null, true, null,
                                    out status);
            }

            int totalRecords;
            var users =
                provider.FindUsers(Query.Matches("UserName", new Regex(@"test1\d*")), SortBy.Ascending("UserName"), 0,
                                   10, out totalRecords).ToArray();

            Assert.AreEqual(11, totalRecords);

            for (int i = 0; i < 10; i++) {
                Assert.IsTrue(users[i].UserName.StartsWith("test1"));
            }
        }
        public void TestFindUsersByName()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            for (int i = 0; i < 100; i++) {
                MembershipCreateStatus status;
                provider.CreateUser("test" + i, "123456", "*****@*****.**", "Test Question?", null, true, null,
                                    out status);
            }

            int totalRecords;
            var users = provider.FindUsersByName(@"test1\d*", 0, 20, out totalRecords).Cast<MembershipUser>().ToArray();

            Assert.AreEqual(11, totalRecords);

            for (int i = 0; i < 10; i++) {
                Assert.IsTrue(users[i].UserName.StartsWith("test1"));
            }
        }
        public void TestDeleteUser()
        {
            var config = new NameValueCollection(_config);

            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, config);

            MembershipCreateStatus status;
            provider.CreateUser("test", "123456", "*****@*****.**", "Question", "Answer", true, null, out status);

            var deleted = provider.DeleteUser("test", true);
            Assert.IsTrue(deleted);

            var deletedUser = provider.GetUser("test", false);
            Assert.IsNull(deletedUser);
        }
        public void TestCreateUserWithRequireUniqueEmailWithDuplicateEmail()
        {
            var config = new NameValueCollection(_config);
            config["requiresUniqueEmail"] = "true";

            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, config);

            MembershipCreateStatus status1;
            provider.CreateUser("test1", "123456", "*****@*****.**", "Test question?", "Test answer.", true, null,
                                out status1);
            Assert.AreEqual(MembershipCreateStatus.Success, status1);

            MembershipCreateStatus status2;
            provider.CreateUser("test2", "123456", "*****@*****.**", "Test question?", "Test answer.", true, null,
                                out status2);
            Assert.AreEqual(MembershipCreateStatus.DuplicateEmail, status2);
        }
        public void TestCreateUserWithDuplicateUserName()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            MembershipCreateStatus firstStatus;
            provider.CreateUser("test", "123456", "*****@*****.**", null, null, true, null, out firstStatus);

            Assert.AreEqual(MembershipCreateStatus.Success, firstStatus);

            MembershipCreateStatus secondStatus;
            provider.CreateUser("test", "123456", "*****@*****.**", null, null, true, null, out secondStatus);

            Assert.AreEqual(MembershipCreateStatus.DuplicateUserName, secondStatus);
        }
        public void TestUpdateUser()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            MembershipCreateStatus status;
            var createdUser = provider.CreateUser("test", "123456", "*****@*****.**", null, null, true, null, out status);
            createdUser.Email = "*****@*****.**";
            createdUser.Comment = "comment";
            createdUser.IsApproved = false;
            createdUser.LastLoginDate = new DateTime(1982, 04, 28);
            createdUser.LastActivityDate = new DateTime(1982, 04, 30);

            provider.UpdateUser(createdUser);
            var updatedUser = provider.GetUser(createdUser.ProviderUserKey, false);
            Assert.NotNull(updatedUser);
            Assert.AreEqual("*****@*****.**", updatedUser.Email);
            Assert.AreEqual("comment", updatedUser.Comment);
            Assert.AreEqual(false, updatedUser.IsApproved);
            Assert.AreEqual(new DateTime(1982, 04, 28), updatedUser.LastLoginDate);
            Assert.AreEqual(new DateTime(1982, 04, 30), updatedUser.LastActivityDate);
        }
        public void TestGetUserByProviderUserKey()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            MembershipCreateStatus status;
            var createdUser = provider.CreateUser("test", "123456", "*****@*****.**", null, null, true, null, out status);
            var retrievedUser = provider.GetUser(createdUser.ProviderUserKey, false);

            Assert.NotNull(retrievedUser);
            Assert.AreEqual(createdUser.ProviderUserKey.ToString(), retrievedUser.ProviderUserKey.ToString());
            Assert.AreEqual(createdUser.LastActivityDate, retrievedUser.LastActivityDate);
        }
        public void TestUpdateUserWithDuplicateUserName()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            MembershipCreateStatus status1;
            provider.CreateUser("test1", "123456", "*****@*****.**", null, null, true, null, out status1);

            MembershipCreateStatus status2;
            var createdUser = provider.CreateUser("test2", "123456", "*****@*****.**", null, null, true, null, out status2);

            // Since we can't change the UserName property directly, we create a MembershipUser with the same values
            Assert.IsNotNull(createdUser);
            Assert.IsNotNull(createdUser.ProviderUserKey);
            var duplicateUser = new MembershipUser(
                providerName: createdUser.ProviderName,
                // Change the name to match the first user.
                name: "test1",
                providerUserKey: createdUser.ProviderUserKey,
                email: createdUser.Email,
                passwordQuestion: createdUser.PasswordQuestion,
                comment: createdUser.Comment,
                isApproved: createdUser.IsApproved,
                isLockedOut: createdUser.IsLockedOut,
                creationDate: createdUser.CreationDate,
                lastLoginDate: createdUser.LastLoginDate,
                lastActivityDate: createdUser.LastActivityDate,
                lastPasswordChangedDate: createdUser.LastPasswordChangedDate,
                lastLockoutDate: createdUser.LastLockoutDate);

            // Exception as duplicate usernames are NOT allowed.
            Assert.Throws<ProviderException>(() => provider.UpdateUser(duplicateUser));
        }
        public void TestGetUserByUserNameAndSetOnline()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            MembershipCreateStatus status;
            var createdUser = provider.CreateUser("test", "123456", "*****@*****.**", null, null, true, null, out status);
            var retrievedUser = provider.GetUser("test", true);

            Assert.NotNull(retrievedUser);
            Assert.AreEqual("test", retrievedUser.UserName);
            Assert.LessOrEqual(createdUser.LastActivityDate, retrievedUser.LastActivityDate);
        }
        public void TestUpdateUserWithRequiresUniqueEmailWithDuplicateEmail()
        {
            var config = new NameValueCollection(_config);
            config["requiresUniqueEmail"] = "true";

            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, config);

            MembershipCreateStatus status1;
            provider.CreateUser("test1", "123456", "*****@*****.**", null, null, true, null, out status1);

            MembershipCreateStatus status2;
            var user = provider.CreateUser("test2", "123456", "*****@*****.**", null, null, true, null, out status2);

            // Change the email to match the first user's email.
            user.Email = "*****@*****.**";

            // Exception as duplicate emails are NOT allowed.
            Assert.Throws<ProviderException>(() => provider.UpdateUser(user));
        }
        public void TestGetUserByUserNameWhenNonExistent()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            MembershipCreateStatus status;
            provider.CreateUser("test", "123456", "*****@*****.**", null, null, true, null, out status);
            var retrievedUser = provider.GetUser("foo", false);

            Assert.IsNull(retrievedUser);
        }
        public void TestSetPropertyValues()
        {
            var membershipConfig = new NameValueCollection(_membershipConfig);
            var membershipProvider = new MongoMembershipProvider();
            membershipProvider.Initialize(DefaultMembershipName, membershipConfig);

            MembershipCreateStatus status;
            membershipProvider.CreateUser("user", "123456", "*****@*****.**", null, null, true, null, out status);

            var profileConfig = new NameValueCollection(_profileConfig);
            var profileProvider = new MongoProfileProvider();
            profileProvider.Initialize(DefaultProfileName, profileConfig);

            var collection = new SettingsPropertyValueCollection();
            AddProviderSpecificPropertyValuesTo(collection, allowAnonymous: false);
            profileProvider.SetPropertyValues(TestHelper.GenerateSettingsContext("user", true), collection);
        }
        public void TestGetUserNameByEmailWhenNonExistent()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            MembershipCreateStatus status;
            provider.CreateUser("test1", "123456", "*****@*****.**", null, null, true, null, out status);
            provider.CreateUser("test2", "123456", "*****@*****.**", null, null, true, null, out status);
            var retrievedUserName = provider.GetUserNameByEmail("*****@*****.**");

            Assert.IsNull(retrievedUserName);
        }
        public void TestDeleteRoleWhenPopulatedWithThrowOnPopulated()
        {
            var membershipConfig = new NameValueCollection(_membershipConfig);
            var roleConfig = new NameValueCollection(_roleConfig);

            var membershipProvider = new MongoMembershipProvider();
            membershipProvider.Initialize(DefaultMembershipName, membershipConfig);

            var roleProvider = new MongoRoleProvider();
            roleProvider.Initialize(DefaultRoleName, roleConfig);

            MembershipCreateStatus status;
            membershipProvider.CreateUser("user1", "123456", "*****@*****.**", null, null, true, null, out status);
            membershipProvider.CreateUser("user2", "123456", "*****@*****.**", null, null, true, null, out status);

            roleProvider.CreateRole("role1");
            roleProvider.CreateRole("role2");

            roleProvider.AddUsersToRoles(new[] { "user1", "user2" }, new[] { "role1", "role2" });

            Assert.Throws<ProviderException>(() => roleProvider.DeleteRole("role1", true));
        }
        public void TestGetUserNameByEmailWhenNonUnique()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            MembershipCreateStatus status;
            provider.CreateUser("bbb", "123456", "*****@*****.**", null, null, true, null, out status);
            provider.CreateUser("aaa", "123456", "*****@*****.**", null, null, true, null, out status);
            var retrievedUserName = provider.GetUserNameByEmail("*****@*****.**");

            Assert.AreEqual("aaa", retrievedUserName);
        }
        public void TestGetRolesForUserWhenHasUserDoesNotExist()
        {
            var membershipConfig = new NameValueCollection(_membershipConfig);
            var roleConfig = new NameValueCollection(_roleConfig);

            var membershipProvider = new MongoMembershipProvider();
            membershipProvider.Initialize(DefaultMembershipName, membershipConfig);

            var roleProvider = new MongoRoleProvider();
            roleProvider.Initialize(DefaultRoleName, roleConfig);

            MembershipCreateStatus status;
            membershipProvider.CreateUser("user1", "123456", "*****@*****.**", null, null, true, null, out status);
            membershipProvider.CreateUser("user2", "123456", "*****@*****.**", null, null, true, null, out status);
            roleProvider.CreateRole("role1");
            roleProvider.CreateRole("role2");
            roleProvider.CreateRole("role3");
            roleProvider.AddUsersToRoles(new[] { "user1", }, new[] { "role1", "role2" });

            var roles = roleProvider.GetRolesForUser("user3");
            Assert.AreEqual(0, roles.Length);
        }
        public void TestUnlockUser()
        {
            var config = new NameValueCollection(_config);
            config["enablePasswordRetrieval"] = "true";
            config["requiresQuestionAndAnswer"] = "true";
            config["maxInvalidPasswordAttempts"] = "1";
            config["passwordFormat"] = "clear";

            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, config);

            MembershipCreateStatus status;
            provider.CreateUser("test", "123456", "*****@*****.**", "Question", "Answer", true, null, out status);

            try {
                provider.GetPassword("test", "Wrong!");
            } catch (MembershipPasswordException) {
            }

            // User will now be locked.
            var lockedOutUser = provider.GetUser("test", false);
            Assert.IsTrue(lockedOutUser.IsLockedOut);

            var unlocked = provider.UnlockUser("test");
            Assert.IsTrue(unlocked);

            // User will now be unlocked.
            var user = provider.GetUser("test", false);
            Assert.IsFalse(user.IsLockedOut);
        }
        public void TestIsUserInRoleWhenRoleDoesNotExist()
        {
            var membershipConfig = new NameValueCollection(_membershipConfig);
            var roleConfig = new NameValueCollection(_roleConfig);

            var membershipProvider = new MongoMembershipProvider();
            membershipProvider.Initialize(DefaultMembershipName, membershipConfig);

            var roleProvider = new MongoRoleProvider();
            roleProvider.Initialize(DefaultRoleName, roleConfig);

            MembershipCreateStatus status;
            membershipProvider.CreateUser("user1", "123456", "*****@*****.**", null, null, true, null, out status);

            Assert.Throws<ArgumentException>(() => roleProvider.IsUserInRole("user1", "role1"));
        }
        public void TestUnlockUserWithNonExistentUser()
        {
            var config = new NameValueCollection(_config);
            config["enablePasswordRetrieval"] = "true";
            config["requiresQuestionAndAnswer"] = "true";
            config["maxInvalidPasswordAttempts"] = "1";
            config["passwordFormat"] = "clear";

            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, config);

            MembershipCreateStatus status;
            provider.CreateUser("test", "123456", "*****@*****.**", "Question", "Answer", true, null, out status);

            var unlocked = provider.UnlockUser("Wrong!");
            Assert.IsFalse(unlocked);
        }
        public void TestRemoveUsersFromRolesWithNonExistantRoles()
        {
            var membershipConfig = new NameValueCollection(_membershipConfig);
            var roleConfig = new NameValueCollection(_roleConfig);

            var membershipProvider = new MongoMembershipProvider();
            membershipProvider.Initialize(DefaultMembershipName, membershipConfig);

            var roleProvider = new MongoRoleProvider();
            roleProvider.Initialize(DefaultRoleName, roleConfig);

            MembershipCreateStatus status;
            membershipProvider.CreateUser("user1", "123456", "*****@*****.**", null, null, true, null, out status);
            membershipProvider.CreateUser("user2", "123456", "*****@*****.**", null, null, true, null, out status);

            Assert.Throws<ProviderException>(
                () => roleProvider.RemoveUsersFromRoles(new[] { "user1", "user2" }, new[] { "role1", "role2" }));
        }
        public void TestCreateUserWithCustomProviderUserKey()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            MembershipCreateStatus status;
            var providerUserKey = ObjectId.GenerateNewId();
            var createdUser = provider.CreateUser("test", "123456", "*****@*****.**", "Test question?", "Test answer.",
                                                  true, providerUserKey, out status);

            Assert.NotNull(createdUser);
            Assert.AreEqual(providerUserKey, createdUser.ProviderUserKey);
            Assert.AreEqual("test", createdUser.UserName);
            Assert.AreEqual("*****@*****.**", createdUser.Email);
            Assert.AreEqual("Test question?", createdUser.PasswordQuestion);
            Assert.IsTrue(createdUser.IsApproved);
            Assert.AreEqual(MembershipCreateStatus.Success, status);
        }