Formats code comments as sentences in the tests.

Capitalizes the first word and adds the terminal period in the unit, integration and security tests. The AAA markers stay bare, the TODO bodies stay lowercase, and no assertion, payload, expected status code or test signature changes.
This commit is contained in:
BinaryAlley committed 2026-11-16 18:17:29 +02:00
1 parent 727aa33318
commit 057f557791
540 files changed
+3888 -3888

No files matched your search

@@ -166,7 +166,7 @@ public class AddArtistEndpointTests : IClassFixture<AuthenticatedLuminaApiFactor
public async Task AddArtist_WhenLibraryDoesNotExist_ShouldReturnNotFound()
{
// Arrange
// only an admin reaches the library lookup of a library that does not exist, because a regular user is rejected by the ownership policy before it
// Only an admin reaches the library lookup of a library that does not exist, because a regular user is rejected by the ownership policy before it.
HttpClient adminClient = await _apiFactory.CreateAuthenticatedAdminClientAsync();
Guid missingLibraryId = Guid.NewGuid();
AddAlbumRequest album = _addAlbumRequestFixture.Create(contributors: [], ratings: [], tracks: []);
@@ -1068,7 +1068,7 @@ public class AddTrackEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
public async Task AddTrack_WhenTheLibraryDoesNotExist_ShouldReturnNotFound()
{
// Arrange
// only an admin reaches the library lookup of a library that does not exist, because a regular user is rejected by the ownership policy before it
// Only an admin reaches the library lookup of a library that does not exist, because a regular user is rejected by the ownership policy before it.
HttpClient adminClient = await _apiFactory.CreateAuthenticatedAdminClientAsync();
Guid missingLibraryId = Guid.NewGuid();
Guid artistId = Guid.NewGuid();
@@ -93,8 +93,8 @@ public class GetTrackSegmentEndpointTests : IClassFixture<AuthenticatedLuminaApi
}
[Theory]
[InlineData("uppercase")] // the handle format only accepts lowercase hexadecimal characters
[InlineData("dashed")] // the handle format is the N format of a GUID, without dashes
[InlineData("uppercase")] // The handle format only accepts lowercase hexadecimal characters.
[InlineData("dashed")] // The handle format is the N format of a GUID, without dashes.
public async Task GetTrackSegment_WhenDeliveryIdFormatIsInvalid_ShouldReturnValidationProblem(string malformedHandleKind)
{
// Arrange
@@ -144,9 +144,9 @@ public class GetTrackSegmentEndpointTests : IClassFixture<AuthenticatedLuminaApi
}
[Theory]
[InlineData("library")] // the handle was issued for the library of another delivery
[InlineData("artist")] // the handle was issued for the artist of another delivery
[InlineData("album")] // the handle was issued for the album of another delivery
[InlineData("library")] // The handle was issued for the library of another delivery.
[InlineData("artist")] // The handle was issued for the artist of another delivery.
[InlineData("album")] // The handle was issued for the album of another delivery.
public async Task GetTrackSegment_WhenDeliveryWasIssuedForAnotherScope_ShouldReturnPlaybackDeliveryNotFound(string mismatchedScope)
{
// Arrange
@@ -236,9 +236,9 @@ public class ShuffleTracksEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
}
[Theory]
[InlineData(0, "ShuffleTrackCountMustBeGreaterThanZero")] // no track is requested
[InlineData(-1, "ShuffleTrackCountMustBeGreaterThanZero")] // a negative selection size
[InlineData(501, "ShuffleTrackCountMustBeAtMost500")] // one more than the documented maximum
[InlineData(0, "ShuffleTrackCountMustBeGreaterThanZero")] // No track is requested.
[InlineData(-1, "ShuffleTrackCountMustBeGreaterThanZero")] // A negative selection size.
[InlineData(501, "ShuffleTrackCountMustBeAtMost500")] // One more than the documented maximum.
public async Task ShuffleTracks_WhenCountIsInvalid_ShouldReturnUnprocessableEntityWithTheValidationError(int count, string expectedError)
{
// Arrange
@@ -142,7 +142,7 @@ public class UpdateTrackEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
Assert.NotNull(trackResponse);
Assert.Equal(trackId, trackResponse!.Id);
Assert.Equal(libraryId, trackResponse.LibraryId);
// the file system path is preserved by the update, it is set only when the track is created
// The file system path is preserved by the update, it is set only when the track is created.
Assert.Equal(originalPath, trackResponse.Path);
Assert.Equal("Somebody to Love", trackResponse.Metadata!.Title);
@@ -191,7 +191,7 @@ public class UpdateTrackEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
string content = await response.Content.ReadAsStringAsync();
TrackResponse? trackResponse = JsonSerializer.Deserialize<TrackResponse>(content, _jsonOptions);
Assert.NotNull(trackResponse);
// the posted file system path is ignored, because a track path is set only when the track is created by the scanner
// The posted file system path is ignored, because a track path is set only when the track is created by the scanner.
Assert.Equal(originalPath, trackResponse!.Path);
Assert.NotEqual(attemptedPath, trackResponse.Path);
Assert.Equal("Somebody to Love", trackResponse.Metadata!.Title);
@@ -272,9 +272,9 @@ public class GetAllUsersConsumptionStatisticsEndpointTests : IClassFixture<Authe
}
[Theory]
[InlineData("999")] // a number that is not a member name
[InlineData("1")] // a number that is a defined enumeration value, which must still be rejected
[InlineData("not-a-media-kind")] // a name that is not a member of the enumeration
[InlineData("999")] // A number that is not a member name.
[InlineData("1")] // A number that is a defined enumeration value, which must still be rejected.
[InlineData("not-a-media-kind")] // A name that is not a member of the enumeration.
public async Task GetAllUsersConsumptionStatistics_WhenMediaKindIsNotAMemberName_ShouldReturnValidationProblem(string mediaKind)
{
// Arrange
@@ -303,9 +303,9 @@ public class GetConsumptionStatisticsEndpointTests : IClassFixture<Authenticated
}
[Theory]
[InlineData("999")] // a number that is not a member name
[InlineData("1")] // a number that is a defined enumeration value, which must still be rejected
[InlineData("not-a-media-kind")] // a name that is not a member of the enumeration
[InlineData("999")] // A number that is not a member name.
[InlineData("1")] // A number that is a defined enumeration value, which must still be rejected.
[InlineData("not-a-media-kind")] // A name that is not a member of the enumeration.
public async Task GetConsumptionStatistics_WhenMediaKindIsNotAMemberName_ShouldReturnValidationProblem(string mediaKind)
{
// Arrange
@@ -337,8 +337,8 @@ public class GetConsumptionStatisticsEndpointTests : IClassFixture<Authenticated
}
[Theory]
[InlineData("not-a-date")] // a textual value that is not a date
[InlineData("2026-13-45T99:99:99")] // a value with out of range components
[InlineData("not-a-date")] // A textual value that is not a date.
[InlineData("2026-13-45T99:99:99")] // A value with out of range components.
public async Task GetConsumptionStatistics_WhenADateBoundIsNotAValidDate_ShouldReturnValidationProblem(string invalidDate)
{
// Arrange
@@ -262,8 +262,8 @@ public class GetGenreConsumptionEndpointTests : IClassFixture<AuthenticatedLumin
}
[Theory]
[InlineData("999")] // a number that is not a member name
[InlineData("not-a-media-kind")] // a name that is not a member of the enumeration
[InlineData("999")] // A number that is not a member name.
[InlineData("not-a-media-kind")] // A name that is not a member of the enumeration.
public async Task GetGenreConsumption_WhenMediaKindIsNotAMemberName_ShouldReturnValidationProblem(string mediaKind)
{
// Arrange
@@ -283,9 +283,9 @@ public class GetMostConsumedEndpointTests : IClassFixture<AuthenticatedLuminaApi
}
[Theory]
[InlineData("999")] // a number that is not a member name
[InlineData("1")] // a number that is a defined enumeration value, which must still be rejected
[InlineData("not-a-media-kind")] // a name that is not a member of the enumeration
[InlineData("999")] // A number that is not a member name.
[InlineData("1")] // A number that is a defined enumeration value, which must still be rejected.
[InlineData("not-a-media-kind")] // A name that is not a member of the enumeration.
public async Task GetMostConsumed_WhenMediaKindIsNotAMemberName_ShouldReturnValidationProblem(string mediaKind)
{
// Arrange
@@ -349,9 +349,9 @@ public class GetRecentlyConsumedEndpointTests : IClassFixture<AuthenticatedLumin
}
[Theory]
[InlineData("999")] // a number that is not a member name
[InlineData("1")] // a number that is a defined enumeration value, which must still be rejected
[InlineData("not-a-media-kind")] // a name that is not a member of the enumeration
[InlineData("999")] // A number that is not a member name.
[InlineData("1")] // A number that is a defined enumeration value, which must still be rejected.
[InlineData("not-a-media-kind")] // A name that is not a member of the enumeration.
public async Task GetRecentlyConsumed_WhenMediaKindIsNotAMemberName_ShouldReturnValidationProblem(string mediaKind)
{
// Arrange
@@ -250,9 +250,9 @@ public class GetTagConsumptionEndpointTests : IClassFixture<AuthenticatedLuminaA
}
[Theory]
[InlineData("999")] // a number that is not a member name
[InlineData("1")] // a number that is a defined enumeration value, which must still be rejected
[InlineData("not-a-media-kind")] // a name that is not a member of the enumeration
[InlineData("999")] // A number that is not a member name.
[InlineData("1")] // A number that is a defined enumeration value, which must still be rejected.
[InlineData("not-a-media-kind")] // A name that is not a member of the enumeration.
public async Task GetTagConsumption_WhenMediaKindIsNotAMemberName_ShouldReturnValidationProblem(string mediaKind)
{
// Arrange
@@ -107,7 +107,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
Assert.NotNull(bookResponse);
// metadata checks
// Metadata checks.
Assert.Equal(bookRequest.Metadata!.Title, bookResponse!.Metadata.Title);
Assert.Equal(bookRequest.Metadata.OriginalTitle, bookResponse.Metadata.OriginalTitle);
Assert.Equal(bookRequest.Metadata.Description, bookResponse.Metadata.Description);
@@ -121,29 +121,29 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
Assert.Equal(bookRequest.Metadata.ReleaseInfo.ReleaseCountry, bookResponse.Metadata.ReleaseInfo.ReleaseCountry);
Assert.Equal(bookRequest.Metadata.ReleaseInfo.ReleaseVersion, bookResponse.Metadata.ReleaseInfo.ReleaseVersion);
// language checks
// Language checks.
Assert.Equal(bookRequest.Metadata.Language!.LanguageCode, bookResponse.Metadata.Language!.LanguageCode);
Assert.Equal(bookRequest.Metadata.Language.LanguageName, bookResponse.Metadata.Language.LanguageName);
Assert.Equal(bookRequest.Metadata.Language.NativeName, bookResponse.Metadata.Language.NativeName);
// original language checks
// Original language checks.
Assert.Equal(bookRequest.Metadata.OriginalLanguage!.LanguageCode, bookResponse.Metadata.OriginalLanguage!.LanguageCode);
Assert.Equal(bookRequest.Metadata.OriginalLanguage.LanguageName, bookResponse.Metadata.OriginalLanguage.LanguageName);
Assert.Equal(bookRequest.Metadata.OriginalLanguage.NativeName, bookResponse.Metadata.OriginalLanguage.NativeName);
// genres checks
// Genres checks.
Assert.Equal(bookRequest.Metadata.Genres!.Count, bookResponse.Metadata.Genres!.Count);
Assert.Equal(
bookRequest.Metadata.Genres.Select(genre => genre.Name!.ToLowerInvariant()).OrderBy(name => name),
bookResponse.Metadata.Genres.Select(genre => genre.Name).OrderBy(name => name));
// tags checks
// Tags checks.
Assert.Equal(bookRequest.Metadata.Tags!.Count, bookResponse.Metadata.Tags!.Count);
Assert.Equal(
bookRequest.Metadata.Tags.Select(tag => tag.Name!.ToLowerInvariant()).OrderBy(name => name),
bookResponse.Metadata.Tags.Select(tag => tag.Name).OrderBy(name => name));
// book specific properties
// Book specific properties.
Assert.Equal(bookRequest.Format, bookResponse.Format);
Assert.Equal(bookRequest.Edition, bookResponse.Edition);
Assert.Equal(bookRequest.VolumeNumber, bookResponse.VolumeNumber);
@@ -157,7 +157,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
Assert.Equal(bookRequest.BarnesAndNobleId, bookResponse.BarnesAndNobleId);
Assert.Equal(bookRequest.AppleBooksId, bookResponse.AppleBooksId);
// ISBNs checks
// ISBNs checks.
Assert.Equal(bookRequest.ISBNs!.Count, bookResponse.ISBNs!.Count);
var requestIsbnData = bookRequest.ISBNs.Select(isbn => new { isbn.Value, isbn.Format }).OrderBy(x => x.Value).ToList();
var responseIsbnData = bookResponse.ISBNs.Select(isbn => new { isbn.Value, isbn.Format }).OrderBy(x => x.Value).ToList();
@@ -168,7 +168,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
Assert.Equal(requestIsbnData[i].Format, responseIsbnData[i].Format);
}
// ratings checks
// Ratings checks.
Assert.Equal(bookRequest.Ratings!.Count, bookResponse.Ratings!.Count);
var requestRatingData = bookRequest.Ratings.Select(r => new { r.Source, r.Value, r.MaxValue, r.VoteCount }).OrderBy(x => x.Source).ToList();
var responseRatingData = bookResponse.Ratings.Select(r => new { r.Source, r.Value, r.MaxValue, r.VoteCount }).OrderBy(x => x.Source).ToList();
@@ -181,18 +181,18 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
Assert.Equal(requestRatingData[i].VoteCount, responseRatingData[i].VoteCount);
}
// series checks
// Series checks.
if (bookRequest.Series is not null)
Assert.Equal(bookRequest.Series.Title, bookResponse.Series!.Title);
else
Assert.Null(bookResponse.Series);
// check Location header
// Check Location header.
Assert.NotNull(response.Headers.Location);
string locationUri = response.Headers.Location!.ToString();
Assert.EndsWith($"/api/v1/libraries/{_libraryId}/books/{bookResponse.Id}", locationUri);
// extract ID from Location header and compare
// Extract ID from Location header and compare.
string idFromHeader = locationUri.Split('/').Last();
Assert.Equal(idFromHeader, bookResponse.Id.ToString());
}
@@ -1320,7 +1320,7 @@ public class AddBookEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
public async Task AddBook_WhenTheLibraryDoesNotExist_ShouldReturnNotFound()
{
// Arrange
// only an admin reaches the library lookup of a library that does not exist, because a regular user is rejected by the ownership policy before it
// Only an admin reaches the library lookup of a library that does not exist, because a regular user is rejected by the ownership policy before it.
HttpClient adminClient = await _apiFactory.CreateAuthenticatedAdminClientAsync();
Guid missingLibraryId = Guid.NewGuid();
AddBookRequest bookRequest = _addBookRequestFixture.Create(contributors: []);