public void MatchesFragments() { UriTemplate template = new UriTemplate("/search#{fragment}"); Assert.IsTrue(template.Matches("/search#foo")); template = new UriTemplate("/search?query={query}#{fragment}"); Assert.IsTrue(template.Matches("/search?query=foo#bar")); }
public void MatchesQueryVariables() { UriTemplate template = new UriTemplate("/search?q={query}"); Assert.IsTrue(template.Matches("/search?q=foo")); }
public void Matches() { UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}/"); Assert.IsTrue(template.Matches("http://example.com/hotels/1/bookings/42/"), "UriTemplate does not match"); Assert.IsFalse(template.Matches("hhhhttp://example.com/hotels/1/bookings/42/"), "UriTemplate matches"); Assert.IsFalse(template.Matches("http://example.com/hotels/1/bookings/42/blabla"), "UriTemplate matches"); Assert.IsFalse(template.Matches("http://example.com/hotels/bookings/"), "UriTemplate matches"); Assert.IsFalse(template.Matches(""), "UriTemplate matches"); Assert.IsFalse(template.Matches(null), "UriTemplate matches"); }