public void When_is_match_And_source_path_template_null_Then_returns_false() { //Act var result = PathFounderHelper.IsMatch(null, "/all"); //Assert Assert.That(result, Is.False); }
public void When_is_match_And_source_path_template_with_one_variable_and_prefix_And_path_matches_Then_returns_true(string requestPath) { //Arrange var sourcePathTemplate = "/post/{any}"; //Act var result = PathFounderHelper.IsMatch(sourcePathTemplate, requestPath); //Assert Assert.That(result, Is.True); }
public void When_is_match_And_source_path_template_with_two_variables_and_prefix_And_path_does_not_match_Then_returns_false(string requestPath) { //Arrange var sourcePathTemplate = "/v{version}/post/{any}"; //Act var result = PathFounderHelper.IsMatch(sourcePathTemplate, requestPath); //Assert Assert.That(result, Is.False); }
private static PlainRouteConfiguration GetRouteConfiguration(List <PlainRouteConfiguration> routes, HttpRequest httpRequest) { return(routes.FirstOrDefault(a => PathFounderHelper.IsMatch(a.Source.PathTemplate, httpRequest.Path))); }