public void MatchingUrls() { ViewUrl url1 = new ViewUrl(@"^product/(?<category>\w+)/(\d+)/$", View1, "url1"); ViewUrl url2 = new ViewUrl(@"^product/(?<category>(?:[\w\s]+))/(\d+)/$", View1, "url2"); ViewUrl url3 = new ViewUrl(@"^product/(?<category>\w+)/\((\d+)\)/$", View1, "url2"); Assert.True(url1.IsMatch("product/new/945/")); Assert.False(url1.IsMatch("product/categrory 1/15/")); Assert.False(url1.IsMatch("product/categrory%201/15/")); Assert.True(url2.IsMatch("product/new and old/125/")); Assert.True(url2.IsMatch("product/new%20and old/125/")); Assert.True(url2.IsMatch("product/new%20and+old/125/")); Assert.False(url2.IsMatch("product/new% 20and old/125/")); Assert.True(url3.IsMatch("product/old/(47)/")); Assert.False(url3.IsMatch("product/1/")); }