public void NoUsereReturnsFalse()
		{
			var admin = new TestableModerator();
			var contextMock = new Mock<HttpContextBase>();
			contextMock.Setup(c => c.User).Returns((IPrincipal)null);
			Assert.IsFalse(admin.GetAuthorizeCoreResult(contextMock.Object));
		}
Exemple #2
0
        public void NoUsereReturnsFalse()
        {
            var admin       = new TestableModerator();
            var contextMock = new Mock <HttpContextBase>();

            contextMock.Setup(c => c.User).Returns((IPrincipal)null);
            Assert.IsFalse(admin.GetAuthorizeCoreResult(contextMock.Object));
        }
		public void NonAdminRoleReturnsFalse()
		{
			var admin = new TestableModerator();
			var contextMock = new Mock<HttpContextBase>();
			var principalMock = new Mock<IPrincipal>();
			principalMock.Setup(p => p.IsInRole(PermanentRoles.Moderator)).Returns(false);
			contextMock.Setup(c => c.User).Returns(principalMock.Object);
			Assert.IsFalse(admin.GetAuthorizeCoreResult(contextMock.Object));
		}
Exemple #4
0
        public void NonAdminRoleReturnsFalse()
        {
            var admin         = new TestableModerator();
            var contextMock   = new Mock <HttpContextBase>();
            var principalMock = new Mock <IPrincipal>();

            principalMock.Setup(p => p.IsInRole(PermanentRoles.Moderator)).Returns(false);
            contextMock.Setup(c => c.User).Returns(principalMock.Object);
            Assert.IsFalse(admin.GetAuthorizeCoreResult(contextMock.Object));
        }