public void FindUsersInRoleTest()
        {
            roleProvider = new RoleProvider();
            NameValueCollection config = new NameValueCollection();

            config.Add("connectionStringName", _connStrName);
            config.Add("applicationName", _applicationName);
            roleProvider.Initialize(null, config);

            AddUser("eve", "eveeve!");
            AddUser("evelyn", "eveeve!");
            AddUser("emily", "eveeve!");
            AddUser("robert", "eveeve!");
            AddUser("carly", "eveeve!");
            roleProvider.CreateRole("User");

            roleProvider.AddUsersToRoles(new string[] { "eve", "evelyn", "emily", "robert", "carly" },
                                         new string[] { "User" });

            // no % (startsWith)
            var users = roleProvider.FindUsersInRole("User", "eve");

            Assert.AreEqual(2, users.Length);
            Assert.IsTrue(users.Contains("eve"));
            Assert.IsTrue(users.Contains("evelyn"));

            users = roleProvider.FindUsersInRole("User", "bob");
            Assert.AreEqual(0, users.Length);

            users = roleProvider.FindUsersInRole("User", "obert");
            Assert.AreEqual(0, users.Length);

            // StartsWith
            users = roleProvider.FindUsersInRole("User", "eve%");
            Assert.AreEqual(2, users.Length);
            Assert.IsTrue(users.Contains("eve"));
            Assert.IsTrue(users.Contains("evelyn"));

            users = roleProvider.FindUsersInRole("User", "bob%");
            Assert.AreEqual(0, users.Length);

            // EndsWith
            users = roleProvider.FindUsersInRole("User", "%ly");
            Assert.AreEqual(2, users.Length);
            Assert.IsTrue(users.Contains("emily"));
            Assert.IsTrue(users.Contains("carly"));

            users = roleProvider.FindUsersInRole("User", "%ark");
            Assert.AreEqual(0, users.Length);

            // Contains
            users = roleProvider.FindUsersInRole("User", "%ly%");
            Assert.AreEqual(3, users.Length);
            Assert.IsTrue(users.Contains("evelyn"));
            Assert.IsTrue(users.Contains("emily"));
            Assert.IsTrue(users.Contains("carly"));

            users = roleProvider.FindUsersInRole("User", "%bob%");
            Assert.AreEqual(0, users.Length);
        }
        public void FindUsersInRoleTest()
        {
            roleProvider = new RoleProvider();
            NameValueCollection config = new NameValueCollection();
            config.Add("connectionStringName", _connStrName);
            config.Add("applicationName", _applicationName);
            roleProvider.Initialize(null, config);

            AddUser("eve", "eveeve!");
            AddUser("evelyn", "eveeve!");
            AddUser("emily", "eveeve!");
            AddUser("robert", "eveeve!");
            AddUser("carly", "eveeve!");
            roleProvider.CreateRole("User");

            roleProvider.AddUsersToRoles(new string[] { "eve", "evelyn", "emily", "robert", "carly" },
                new string[] { "User" });

            // no % (startsWith)
            var users = roleProvider.FindUsersInRole("User", "eve");
            Assert.AreEqual(2, users.Length);
            Assert.IsTrue(users.Contains("eve"));
            Assert.IsTrue(users.Contains("evelyn"));

            users = roleProvider.FindUsersInRole("User", "bob");
            Assert.AreEqual(0, users.Length);

            users = roleProvider.FindUsersInRole("User", "obert");
            Assert.AreEqual(0, users.Length);

            // StartsWith
            users = roleProvider.FindUsersInRole("User", "eve%");
            Assert.AreEqual(2, users.Length);
            Assert.IsTrue(users.Contains("eve"));
            Assert.IsTrue(users.Contains("evelyn"));

            users = roleProvider.FindUsersInRole("User", "bob%");
            Assert.AreEqual(0, users.Length);

            // EndsWith
            users = roleProvider.FindUsersInRole("User", "%ly");
            Assert.AreEqual(2, users.Length);
            Assert.IsTrue(users.Contains("emily"));
            Assert.IsTrue(users.Contains("carly"));

            users = roleProvider.FindUsersInRole("User", "%ark");
            Assert.AreEqual(0, users.Length);

            // Contains
            users = roleProvider.FindUsersInRole("User", "%ly%");
            Assert.AreEqual(3, users.Length);
            Assert.IsTrue(users.Contains("evelyn"));
            Assert.IsTrue(users.Contains("emily"));
            Assert.IsTrue(users.Contains("carly"));

            users = roleProvider.FindUsersInRole("User", "%bob%");
            Assert.AreEqual(0, users.Length);
        }