public void HttpMethodActionConstraint_Accept_CaseInsensitive(IEnumerable <string> httpMethods, string expectedMethod) { // Arrange var constraint = new HttpMethodActionConstraint(httpMethods); var context = CreateActionConstraintContext(constraint); context.RouteContext = CreateRouteContext(expectedMethod); // Act var result = constraint.Accept(context); // Assert Assert.True(result, "Request should have been accepted."); }
public void HttpMethodActionConstraint_IgnoresPreflightRequests(IEnumerable <string> httpMethods, string accessControlMethod) { // Arrange var constraint = new HttpMethodActionConstraint(httpMethods); var context = CreateActionConstraintContext(constraint); context.RouteContext = CreateRouteContext("oPtIoNs", accessControlMethod); // Act var result = constraint.Accept(context); // Assert Assert.False(result, "Request should have been rejected."); }