public void RequiresAuthentication_NullUser_ReturnsUnauthenticated() { var attr = new RequiresAuthenticationAttribute(); var httpCtx = new Fakes.FakeHttpContext(); var shouldContinue = attr.ShouldContinue(httpCtx); Assert.False(shouldContinue.ShouldContinue); Assert.Equal(ApiFilterRunResult.Unauthenticated.SetResponseCode, shouldContinue.SetResponseCode); }
public void RequiresAuthentication_AuthenticatedUser_ReturnsContinue() { var attr = new RequiresAuthenticationAttribute(); var httpCtx = new Fakes.FakeHttpContext(); httpCtx.User = UserSetup.GetUser(); var shouldContinue = attr.ShouldContinue(httpCtx); Assert.True(shouldContinue.ShouldContinue); }