Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCS committed May 28, 2024
1 parent 11f4cfc commit 62db48c
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ public async Task When_UserAsksForMovie_ButWrongUrl_Then_FindResponseInPreApprov
// arrange
var client = Fixture.Server.CreateClient();
client.CreateSession();
string errorMessage = "GET http://www.omdbapifake.com/?apikey=863d6589&type=movie&t=matrix received exception [No such host is known.]";

var possibleErrorMessages = new string[] { "GET http://www.omdbapifake.com/?apikey=863d6589&type=movie&t=matrix received exception [No such host is known.]", // windows
"GET http://www.omdbapifake.com/?apikey=863d6589&type=movie&t=gibberish received exception [Name or service not known]" }; // ubuntu


// act
var httpResponse = await client.GetAsync("/api/movie/matrix");
Expand All @@ -37,7 +40,7 @@ public async Task When_UserAsksForMovie_ButWrongUrl_Then_FindResponseInPreApprov
// assert logs
var logs = client.GetSessionLogs();
logs.Should().HaveCount(1);
logs[0].ToString().Should().Be($"Error: {errorMessage}");
logs[0].ToString().Should().StartWith($"Error: ").And.ContainAny(possibleErrorMessages);

// assert outgoing
AssertOutgoingRequests(client);
Expand Down Expand Up @@ -66,7 +69,7 @@ async Task CheckResponse()
{
// assert return
httpResponse.StatusCode.Should().Be(HttpStatusCode.OK);
httpResponse.GetHeaderValue("SystemTestingToolsStub").Should().Be($@"Recording [omdb/pre-approved/happy/matrix] reason {errorMessage}");
httpResponse.GetHeaderValue("SystemTestingToolsStub").Should().StartWith($@"Recording [omdb/pre-approved/happy/matrix] reason ").And.ContainAny(possibleErrorMessages);

var movie = await httpResponse.ReadJsonBody<Logic.DTO.Media>();
movie.Id.Should().Be("tt0133093");
Expand Down

0 comments on commit 62db48c

Please sign in to comment.