public void Test_IsValid_NoHeader()
        {
            var constraintAttribute = new ProducesConstraintAttribute("application/json");
            var actionDescriptor    = new ActionDescriptor
            {
                ActionConstraints = new List <IActionConstraintMetadata>
                {
                    constraintAttribute
                }
            };
            var isValid = constraintAttribute.IsValidForRequest(new RouteContext(new DefaultHttpContext()), actionDescriptor);

            Assert.IsFalse(isValid);
        }
        public void Test_IsValid_DifferentAccept()
        {
            var constraintAttribute = new ProducesConstraintAttribute("application/json");
            var actionDescriptor    = new ActionDescriptor
            {
                ActionConstraints = new List <IActionConstraintMetadata>
                {
                    constraintAttribute
                }
            };
            var defaultHttpContext = new DefaultHttpContext();

            defaultHttpContext.Request.Headers["Accept"] = "text/html";
            var isValid = constraintAttribute.IsValidForRequest(new RouteContext(defaultHttpContext), actionDescriptor);

            Assert.IsFalse(isValid);
        }