Exemple #1
0
        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"));
        }
Exemple #2
0
        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");
        }
Exemple #3
0
        public void MatchesQueryVariables()
        {
            UriTemplate template = new UriTemplate("/search?q={query}");

            Assert.IsTrue(template.Matches("/search?q=foo"));
        }