Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
linwenda committed Oct 31, 2023
1 parent 22689f4 commit 7ca39e9
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions tests/Wax.E2ETests/GlobalExceptionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Newtonsoft.Json;
using Shouldly;
using Wax.Api;
using Wax.Core.Domain.Customers.Exceptions;
using Wax.Messages.Commands.Customers;
using Xunit;

Expand Down Expand Up @@ -37,23 +38,6 @@ public async Task ShouldReturn400StatusCodeWhenInvalidCommand()
problemDetails.Errors.Count.ShouldBeGreaterThanOrEqualTo(1);
}

[Fact]
public async Task ShouldReturn404StatusCodeWhenEntityNotFound()
{
var client = _factory.CreateClient();

var response = await client.GetAsync($"/customers/{Guid.NewGuid()}");

response.StatusCode.ShouldBe(HttpStatusCode.NotFound);

var content = await response.Content.ReadAsStringAsync();

var problemDetails = JsonConvert.DeserializeObject<ProblemDetails>(content);

problemDetails.Title.ShouldBe("The specified resource was not found.");
problemDetails.Detail.ShouldStartWith("Entity not found");
}

[Fact]
public async Task ShouldReturn409StatusCodeWhenBusinessError()
{
Expand All @@ -76,6 +60,7 @@ public async Task ShouldReturn409StatusCodeWhenBusinessError()

var problemDetails = JsonConvert.DeserializeObject<ProblemDetails>(content);

problemDetails.Type.ShouldBe(nameof(CustomerNameAlreadyExistsException));
problemDetails.Title.ShouldBe("A business error occur.");
problemDetails.Detail.ShouldBe("Customer with this name already exists.");
}
Expand Down

0 comments on commit 7ca39e9

Please sign in to comment.