public void PathParserCanWalk() { var pathParser = new PathRouteData(new Uri("http://localhost/foo"), 0); pathParser.MoveToNext(); Assert.Equal("foo", pathParser.CurrentSegment); Assert.True(pathParser.EndOfPath()); }
public void UseRouteDataToResolveUriTemplate() { var routeData = new PathRouteData(new Uri("http://foo"), 0); routeData.Values.Add("foo", "1"); routeData.Values.Add("bar", "2"); routeData.Values.Add("baz", 3); var link = new Link() { Target = new Uri("http://localhost/{?foo,bar,baz}") }; foreach (var value in routeData.Values) { link.SetParameter(value.Key, value.Value); } var request = link.CreateRequest(); Assert.Equal("http://localhost/?foo=1&bar=2&baz=3", request.RequestUri.AbsoluteUri); }
public void PathParserShouldInitializeWithRootAsFirstSegment() { var pathParser = new PathRouteData(new Uri("http://localhost/Desktop"), 0); Assert.Equal("", pathParser.CurrentSegment); }
public void PathParserWithEmptyUri() { var pathParser = new PathRouteData(new Uri("http://localhost"), 0); Assert.True(pathParser.EndOfPath()); }