public void Create_CreatesMatchProcessor_FromRoutePattern_Constraint() { // Arrange var factory = GetMatchProcessorFactory(); var parameter = RoutePatternFactory.ParameterPart( "id", @default: null, parameterKind: RoutePatternParameterKind.Standard, constraints: new[] { RoutePatternFactory.Constraint(new IntRouteConstraint()), }); // Act var matchProcessor = factory.Create(parameter, parameter.Constraints[0]); // Assert Assert.IsType <IntRouteConstraint>(Assert.IsType <RouteConstraintMatchProcessor>(matchProcessor).Constraint); }
public void Create_CreatesParameterPolicy_FromRoutePattern_String() { // Arrange var factory = GetParameterPolicyFactory(); var parameter = RoutePatternFactory.ParameterPart( "id", @default: null, parameterKind: RoutePatternParameterKind.Standard, parameterPolicies: new[] { RoutePatternFactory.Constraint("int"), }); // Act var parameterPolicy = factory.Create(parameter, parameter.ParameterPolicies[0]); // Assert Assert.IsType <IntRouteConstraint>(parameterPolicy); }
public void Create_CreatesMatchProcessor_FromRoutePattern_String_Optional() { // Arrange var factory = GetMatchProcessorFactory(); var parameter = RoutePatternFactory.ParameterPart( "id", @default: null, parameterKind: RoutePatternParameterKind.Optional, constraints: new[] { RoutePatternFactory.Constraint("int"), }); // Act var matchProcessor = factory.Create(parameter, parameter.Constraints[0]); // Assert Assert.IsType <OptionalMatchProcessor>(matchProcessor); }
public void Create_CreatesParameterPolicy_FromRoutePattern_String_Optional() { // Arrange var factory = GetParameterPolicyFactory(); var parameter = RoutePatternFactory.ParameterPart( "id", @default: null, parameterKind: RoutePatternParameterKind.Optional, parameterPolicies: new[] { RoutePatternFactory.Constraint("int"), }); // Act var parameterPolicy = factory.Create(parameter, parameter.ParameterPolicies[0]); // Assert var optionalConstraint = Assert.IsType <OptionalRouteConstraint>(parameterPolicy); Assert.IsType <IntRouteConstraint>(optionalConstraint.InnerConstraint); }