Exemple #1
0
        private static bool TestConstraint(IDispatcherValueConstraint constraint, DispatcherValueCollection values, string routeKey)
        {
            var httpContext       = new DefaultHttpContext();
            var constraintPurpose = ConstraintPurpose.IncomingRequest;

            var dispatcherValueConstraintContext = new DispatcherValueConstraintContext(httpContext, values, constraintPurpose)
            {
                Key = routeKey
            };

            return(constraint.Match(dispatcherValueConstraintContext));
        }
        private static bool TestConstraint(IDispatcherValueConstraint constraint, object value, Action <IMatcher> routeConfig = null)
        {
            var httpContext = new DefaultHttpContext();
            var values      = new DispatcherValueCollection()
            {
                { "fake", value }
            };
            var constraintPurpose = ConstraintPurpose.IncomingRequest;

            var dispatcherValueConstraintContext = new DispatcherValueConstraintContext(httpContext, values, constraintPurpose);

            return(constraint.Match(dispatcherValueConstraintContext));
        }