Пример #1
0
        public void HttpMethodActionConstraint_Accept_Preflight_CaseInsensitive(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.True(result, "Request should have been accepted.");
        }
Пример #2
0
    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.");
    }
Пример #3
0
    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.");
    }