public void ConstraintsTreatedAsConstraints() { var segment = new CatchAllParameterSegment("controller", "Home", new RegexConstraint("^[0-9]+$")); Assert.IsFalse(segment.MatchPath(null, new PathIterator("/foo")).Success); Assert.IsTrue(segment.MatchPath(null, new PathIterator("/1")).Success); Assert.AreEqual("1", segment.MatchPath(null, new PathIterator("/1")).Values["controller"]); }
public void EvaluateValue() { var segment = new CatchAllParameterSegment("controller", "Home", null); Assert.IsTrue(segment.MatchPath(null, new PathIterator("/foo")).Success); Assert.IsTrue(segment.MatchPath(null, new PathIterator("/foo/bar/baz")).Success); Assert.AreEqual("foo", segment.MatchPath(null, new PathIterator("/foo")).Values["controller"]); Assert.AreEqual("foo/bar/baz", segment.MatchPath(null, new PathIterator("/foo/bar/baz")).Values["controller"]); }