diff --git a/CHANGELOG.md b/CHANGELOG.md index 339d14b..fbbf409 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,8 @@ This project uses famous football stadiums (A-Z) that hosted FIFA World Cup matc - Rename `ValidateAsync_SquadNumber_BelongsToPlayerBeingUpdated_ReturnsNoErrors` to `ValidateAsync_SquadNumberBelongsToPlayerBeingUpdated_ReturnsNoErrors` to align with the 3-segment naming convention for service/validator tests (#427) - Make CSharpier step in `/pre-commit` conditional (skip with a note if not installed), consistent with the Docker and CodeRabbit steps (#427) - Add "Verify tag commit is reachable from master" step to CD workflow using `git merge-base --is-ancestor` before any build or publish steps (#439) +- Rename five controller test methods to normalize data-state vocabulary: `NonExisting` → `Nonexistent` for the POST 201 scenario, `NonExisting` → `Unknown` for the four 404-by-lookup scenarios (#452) +- Add XML doc `` block to `PlayerFakes` documenting the three-term data-state vocabulary (`existing`, `nonexistent`, `unknown`) (#452) ### Fixed diff --git a/test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerControllerTests.cs b/test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerControllerTests.cs index e4e6396..29b9ca6 100644 --- a/test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerControllerTests.cs +++ b/test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerControllerTests.cs @@ -109,7 +109,7 @@ public async Task Post_Players_Existing_Returns409Conflict() [Fact] [Trait("Category", "Unit")] - public async Task Post_Players_NonExisting_Returns201Created() + public async Task Post_Players_Nonexistent_Returns201Created() { // Arrange var request = PlayerFakes.MakeRequestModelForCreate(); @@ -203,7 +203,7 @@ public async Task Get_Players_Empty_Returns200OkWithEmptyList() [Fact] [Trait("Category", "Unit")] - public async Task Get_PlayerById_NonExisting_Returns404NotFound() + public async Task Get_PlayerById_Unknown_Returns404NotFound() { // Arrange var id = Guid.NewGuid(); @@ -248,7 +248,7 @@ public async Task Get_PlayerById_Existing_Returns200OK() [Fact] [Trait("Category", "Unit")] - public async Task Get_PlayerBySquadNumber_NonExisting_Returns404NotFound() + public async Task Get_PlayerBySquadNumber_Unknown_Returns404NotFound() { // Arrange var squadNumber = 999; @@ -345,7 +345,7 @@ public async Task Put_PlayerBySquadNumber_ValidationError_Returns400BadRequest() [Fact] [Trait("Category", "Unit")] - public async Task Put_PlayerBySquadNumber_NonExisting_Returns404NotFound() + public async Task Put_PlayerBySquadNumber_Unknown_Returns404NotFound() { // Arrange var squadNumber = 999; @@ -461,7 +461,7 @@ public async Task Put_PlayerBySquadNumber_Existing_Returns204NoContent() [Fact] [Trait("Category", "Unit")] - public async Task Delete_PlayerBySquadNumber_NonExisting_Returns404NotFound() + public async Task Delete_PlayerBySquadNumber_Unknown_Returns404NotFound() { // Arrange var squadNumber = 999; diff --git a/test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/PlayerFakes.cs b/test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/PlayerFakes.cs index 3d628af..2c80a3a 100644 --- a/test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/PlayerFakes.cs +++ b/test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/PlayerFakes.cs @@ -12,6 +12,14 @@ namespace Dotnet.Samples.AspNetCore.WebApi.Tests.Utilities; /// useful when you need behavior that's closer to reality but still want /// to avoid external dependencies. /// +/// +/// Data-state vocabulary used across controller tests: +/// +/// existingPlayer is present in the database. +/// nonexistentPlayer is absent, valid shape for creation (POST scenarios). +/// unknownValid ID format, absent from database (404-by-lookup scenarios). +/// +/// public static class PlayerFakes { private static string? FormatBirth(DateTime? dateOfBirth) =>