public void TestFindUsersWithInvalidTake()
        {
            var provider = new MongoMembershipProvider();
            provider.Initialize(DefaultName, _config);

            Assert.Throws<ArgumentException>(() => {
                int totalRecords;
                provider.FindUsers(Query.EQ("UserName", "test"), SortBy.Ascending("UserName"), 0, -1, out totalRecords);
            });
        }
        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"));
            }
        }