Skip to content

Commit

Permalink
Update RoutingTests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlyHKafoury committed Jan 8, 2024
1 parent bb79587 commit ed3f88e
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion test/Ocelot.AcceptanceTests/RoutingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,42 @@ public void should_return_response_200_with_placeholder_for_final_url_path()
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
.And(x => _steps.ThenTheResponseBodyShouldBe("Some Product"))
.BDDfy();
}
}

[Fact]
public void should_return_correct_downstream_when_omitting_ending_placeholder()
{
var port = PortFinder.GetRandomPort();

var configuration = new FileConfiguration
{
Routes = new List<FileRoute>
{
new()
{
DownstreamPathTemplate = "/downstream/test/{testId}",
DownstreamScheme = "http",
DownstreamHostAndPorts = new List<FileHostAndPort>
{
new()
{
Host = "localhost",
Port = port,
},
},
UpstreamPathTemplate = "/upstream/test/{testId}",
UpstreamHttpMethod = new List<string> { "Get" },
},
},
};

this.Given(x => GivenThereIsAServiceRunningOn($"http://localhost:{port}", "/", 200, "Test Body"))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/upstream/test/"))
.Then(x => ThenTheDownstreamUrlPathShouldBe("/downstream/test/"))
.BDDfy();
}

[Fact]
public void should_return_response_201_with_simple_url_and_multiple_upstream_http_method()
Expand Down

0 comments on commit ed3f88e

Please sign in to comment.