Added more unit tests for the route matcher. Published 1.0.9 nuget package.
This commit is contained in:
@ -55,7 +55,18 @@ namespace MontoyaTech.Rest.Net.Tests
|
||||
[Fact]
|
||||
public void SyntaxWithArgumentShouldMatch()
|
||||
{
|
||||
RouteMatcher.Matches("http://localhost/test1", "/{a}", out _).Should().BeTrue();
|
||||
RouteMatcher.Matches("http://localhost/test1", "/{a}", out string[] arguments).Should().BeTrue();
|
||||
arguments.Length.Should().Be(1);
|
||||
arguments[0].Should().Be("test1");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SyntaxWithArgumentsShouldMatch()
|
||||
{
|
||||
RouteMatcher.Matches("http://localhost/a/1/2/d", "/a/{b}/{c}/d", out string[] arguments).Should().BeTrue();
|
||||
arguments.Length.Should().Be(2);
|
||||
arguments[0].Should().Be("1");
|
||||
arguments[1].Should().Be("2");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -64,6 +75,18 @@ namespace MontoyaTech.Rest.Net.Tests
|
||||
RouteMatcher.Matches("http://localhost/1/2/3", "/1/*/3", out _).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SyntaxWithWildcardShouldNotMatch()
|
||||
{
|
||||
RouteMatcher.Matches("http://localhost/1/2/3", "/1/*", out _).Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SyntaxWithCatchallShouldMatch()
|
||||
{
|
||||
RouteMatcher.Matches("http://localhost/1/2/3", "/1/**", out _).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SyntaxWithOrShouldMatch()
|
||||
{
|
||||
|
Reference in New Issue
Block a user