public void NoUsereReturnsFalse() { var admin = new TestableAdmin(); 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 TestableAdmin(); var contextMock = new Mock <HttpContextBase>(); var principalMock = new Mock <IPrincipal>(); principalMock.Setup(p => p.IsInRole(PermanentRoles.Admin)).Returns(false); contextMock.Setup(c => c.User).Returns(principalMock.Object); Assert.IsFalse(admin.GetAuthorizeCoreResult(contextMock.Object)); }