public void HandleNonHttpsRequestExtensibility() { // Arrange var requestContext = new DefaultHttpContext(); requestContext.RequestServices = CreateServices(); requestContext.Request.Scheme = "http"; var authContext = CreateAuthorizationContext(requestContext); var attr = new CustomRequireHttpsAttribute(); // Act attr.OnAuthorization(authContext); // Assert var result = Assert.IsType<StatusCodeResult>(authContext.Result); Assert.Equal(StatusCodes.Status404NotFound, result.StatusCode); }
public void HandleNonHttpsRequestExtensibility() { // Arrange var requestContext = new DefaultHttpContext(); requestContext.Request.Scheme = "http"; var authContext = CreateAuthorizationContext(requestContext); var attr = new CustomRequireHttpsAttribute(); // Act attr.OnAuthorization(authContext); // Assert var result = Assert.IsType <HttpStatusCodeResult>(authContext.Result); Assert.Equal(404, result.StatusCode); }