public void ResolveConstraint_CustomConstraintThatDoesNotImplementIHttpRouteConstraint_Throws() { var resolver = new DefaultInlineConstraintResolver(); resolver.ConstraintMap.Add("custom", typeof(string)); Assert.Throws <InvalidOperationException>( () => resolver.ResolveConstraint("custom"), "The constraint type 'String' which is mapped to constraint key 'custom' must implement the IHttpRouteConstraint interface."); }
public void ResolveConstraint_SupportsCustomConstraints() { var resolver = new DefaultInlineConstraintResolver(); resolver.ConstraintMap.Add("custom", typeof(IntHttpRouteConstraint)); IHttpRouteConstraint constraint = resolver.ResolveConstraint("custom"); Assert.IsType <IntHttpRouteConstraint>(constraint); }
public void ResolveConstraint_CustomConstraintThatDoesNotImplementIHttpRouteConstraint_Throws() { var resolver = new DefaultInlineConstraintResolver(); resolver.ConstraintMap.Add("custom", typeof(string)); Assert.Throws<InvalidOperationException>( () => resolver.ResolveConstraint("custom"), "The constraint type 'String' which is mapped to constraint key 'custom' must implement the IHttpRouteConstraint interface."); }
public void ResolveConstraint_SupportsCustomConstraints() { var resolver = new DefaultInlineConstraintResolver(); resolver.ConstraintMap.Add("custom", typeof(IntHttpRouteConstraint)); IHttpRouteConstraint constraint = resolver.ResolveConstraint("custom"); Assert.IsType<IntHttpRouteConstraint>(constraint); }