private static void RunTest( string template, string path, RouteValueDictionary defaults, IDictionary <string, object> expected) { // Arrange var matcher = new RoutePatternMatcher( RoutePatternParser.Parse(template), defaults ?? new RouteValueDictionary()); var values = new RouteValueDictionary(); // Act var match = matcher.TryMatch(new PathString(path), values); // Assert if (expected == null) { Assert.False(match); } else { Assert.True(match); Assert.Equal(expected.Count, values.Count); foreach (string key in values.Keys) { Assert.Equal(expected[key], values[key]); } } }
public bool TryMatch(PathString path, RouteValueDictionary values) { if (values == null) { throw new ArgumentNullException(nameof(values)); } return(_routePatternMatcher.TryMatch(path, values)); }