예제 #1
0
        //        [TestMethod]
        public void Can_get_if_user_not_in_role()
        {
            var role = "Admin";
            var email = "*****@*****.**";
            var members = new Member[] { new Member { Email = email, Roles = new string[] { role } } };
            var repo = new Mock<IEntityRepository<Member>>();
            repo.SetupGet(x => x.Query).Returns(members.AsQueryable());

            var result = new MemberRoleProvider(repo.Object).IsUserInRole(email, "NotRole");

            //Assert.IsFalse(result);
        }
예제 #2
0
        //        [TestMethod]
        public void Can_get_users_by_role()
        {
            var role = "Admin";
            var email = "*****@*****.**";
            var members = new Member[] { new Member { Email = email, Roles = new string[] { role } }, new Member() };
            var repo = new Mock<IEntityRepository<Member>>();
            repo.SetupGet(x => x.Query).Returns(members.AsQueryable());

            var result = new MemberRoleProvider(repo.Object).GetUsersInRole(role);

            //assert.areequal(1, result.length);
            //assert.areequal(email, result[0]);
        }