Skip to content

Commit

Permalink
Assert the title of the problem details.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTedder committed Oct 28, 2024
1 parent 18b527c commit e77bbd5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion LeaderboardBackend.Test/Leaderboards.cs
Original file line number Diff line number Diff line change
Expand Up @@ -618,10 +618,17 @@ public async Task DeleteLeaderboard_AlreadyDeleted()
context.Leaderboards.Add(lb);
await context.SaveChangesAsync();

await FluentActions.Awaiting(() => _apiClient.Delete(
ExceptionAssertions<RequestFailureException> ex = await FluentActions.Awaiting(() => _apiClient.Delete(
$"/leaderboard/{lb.Id}",
new() { Jwt = _jwt }
)).Should().ThrowAsync<RequestFailureException>().Where(e => e.Response.StatusCode == HttpStatusCode.NotFound);

ProblemDetails? problemDetails = await ex.Which.Response.Content.ReadFromJsonAsync<ProblemDetails>(
TestInitCommonFields.JsonSerializerOptions
);

problemDetails.Should().NotBeNull();
problemDetails!.Title.Should().Be("Already Deleted");
}

[Test]
Expand Down

0 comments on commit e77bbd5

Please sign in to comment.