public void HttpMethodConstraint_Accept_CaseInsensitive(IEnumerable <string> httpMethods, string expectedMethod)
        {
            // Arrange
            var constraint = new HttpMethodConstraint(httpMethods);
            var context    = CreateActionConstraintContext(constraint);

            context.RouteContext = CreateRouteContext(expectedMethod);

            // Act
            var result = constraint.Accept(context);

            // Assert
            Assert.True(result, "Request should have been accepted.");
        }
        private static ActionConstraintContext CreateActionConstraintContext(HttpMethodConstraint constraint)
        {
            var context = new ActionConstraintContext();

            var actionSelectorCandidate = new ActionSelectorCandidate(new ActionDescriptor(), new List <IActionConstraint> {
                constraint
            });

            context.Candidates = new List <ActionSelectorCandidate> {
                actionSelectorCandidate
            };
            context.CurrentCandidate = context.Candidates[0];

            return(context);
        }