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

@@ -21,8 +21,8 @@ public class DirectoryMappingTests
private readonly DirectoryFixture _directoryFixture = new();
[Theory]
[InlineData(true)] // hidden directory
[InlineData(false)] // visible directory
[InlineData(true)] // Hidden directory.
[InlineData(false)] // Visible directory.
public void ToFileSystemTreeNodeResponse_WhenMappingDirectory_ShouldMapCorrectly(bool isHidden)
{
// Arrange
@@ -86,8 +86,8 @@ public class DirectoryMappingTests
}
[Theory]
[InlineData(true)] // hidden directory
[InlineData(false)] // visible directory
[InlineData(true)] // Hidden directory.
[InlineData(false)] // Visible directory.
public void ToResponse_WhenMappingDirectory_ShouldMapCorrectly(bool isHidden)
{
// Arrange
@@ -30,8 +30,8 @@ public class FileSystemItemMappingTests
private readonly UnixRootItemFixture _unixRootItemFixture = new();
[Theory]
[InlineData(true)] // hidden file system item
[InlineData(false)] // visible file system item
[InlineData(true)] // Hidden file system item.
[InlineData(false)] // Visible file system item.
public void ToFileSystemItemModel_WhenMappingFileSystemItem_ShouldMapCorrectly(bool isHidden)
{
// Arrange
@@ -54,8 +54,8 @@ public class FileSystemItemMappingTests
}
[Theory]
[InlineData(true)] // hidden directory
[InlineData(false)] // visible directory
[InlineData(true)] // Hidden directory.
[InlineData(false)] // Visible directory.
public void ToTreeNodeResponse_WhenMappingDirectory_ShouldMapCorrectly(bool isHidden)
{
// Arrange
@@ -73,8 +73,8 @@ public class FileSystemItemMappingTests
}
[Theory]
[InlineData(true)] // hidden file
[InlineData(false)] // visible file
[InlineData(true)] // Hidden file.
[InlineData(false)] // Visible file.
public void ToTreeNodeResponse_WhenMappingFile_ShouldMapCorrectly(bool isHidden)
{
// Arrange
@@ -132,8 +132,8 @@ public class FileSystemItemMappingTests
}
[Theory]
[InlineData("TestFile.txt", FileSystemItemType.File, true)] // hidden file
[InlineData("TestFolder", FileSystemItemType.Directory, false)] // visible directory
[InlineData("TestFile.txt", FileSystemItemType.File, true)] // Hidden file.
[InlineData("TestFolder", FileSystemItemType.Directory, false)] // Visible directory.
public void ToFileSystemItemModel_WhenMappingDifferentFileSystemItems_ShouldMapCorrectly(string name, FileSystemItemType type, bool isHidden)
{
// Arrange
@@ -21,8 +21,8 @@ public class FileMappingTests
private readonly FileFixture _fileFixture = new();
[Theory]
[InlineData(true)] // hidden file
[InlineData(false)] // visible file
[InlineData(true)] // Hidden file.
[InlineData(false)] // Visible file.
public void ToFileSystemTreeNodeResponse_WhenMappingFile_ShouldMapCorrectly(bool isHidden)
{
// Arrange
@@ -73,8 +73,8 @@ public class FileMappingTests
}
[Theory]
[InlineData(true)] // hidden file
[InlineData(false)] // visible file
[InlineData(true)] // Hidden file.
[InlineData(false)] // Visible file.
public void ToResponse_WhenMappingFile_ShouldMapCorrectly(bool isHidden)
{
// Arrange
@@ -140,10 +140,10 @@ public class GetMostConsumedRequestMappingTests
}
[Theory]
[InlineData(0, 0, 1, 1)] // both at the lower boundary
[InlineData(0, -5, 1, 1)] // zero current page with a negative page size
[InlineData(-3, 10, 1, 10)] // negative current page with a valid page size
[InlineData(-2, -7, 1, 1)] // both negative
[InlineData(0, 0, 1, 1)] // Both at the lower boundary.
[InlineData(0, -5, 1, 1)] // Zero current page with a negative page size.
[InlineData(-3, 10, 1, 10)] // Negative current page with a valid page size.
[InlineData(-2, -7, 1, 1)] // Both negative.
public void ToQuery_WhenCurrentPageOrPerPageIsNotPositive_ShouldClampOnlyTheInvalidValue(
int currentPage,
int perPage,
@@ -140,10 +140,10 @@ public class GetRecentlyConsumedRequestMappingTests
}
[Theory]
[InlineData(0, 0, 1, 1)] // both at the lower boundary
[InlineData(0, -5, 1, 1)] // zero current page with a negative page size
[InlineData(-3, 10, 1, 10)] // negative current page with a valid page size
[InlineData(-2, -7, 1, 1)] // both negative
[InlineData(0, 0, 1, 1)] // Both at the lower boundary.
[InlineData(0, -5, 1, 1)] // Zero current page with a negative page size.
[InlineData(-3, 10, 1, 10)] // Negative current page with a valid page size.
[InlineData(-2, -7, 1, 1)] // Both negative.
public void ToQuery_WhenCurrentPageOrPerPageIsNotPositive_ShouldClampOnlyTheInvalidValue(
int currentPage,
int perPage,
@@ -351,8 +351,8 @@ public class MediaConsumptionRecordEntityMappingTests
}
[Theory]
[InlineData("")] // an empty location is not a usable position
[InlineData(" ")] // a whitespace only location is not a usable position
[InlineData("")] // An empty location is not a usable position.
[InlineData(" ")] // A whitespace only location is not a usable position.
public void ToDomainEntity_WhenLocationPositionHasABlankLocation_ShouldReturnInvalidMediaPosition(string location)
{
// Arrange
@@ -43,8 +43,8 @@ public class MediaKindConsumptionStatisticsDtoMappingTests
}
[Theory]
[InlineData(1_500, 1.5)] // half a second survives the conversion
[InlineData(2_000, 2)] // a whole number of seconds stays whole
[InlineData(1_500, 1.5)] // Half a second survives the conversion.
[InlineData(2_000, 2)] // A whole number of seconds stays whole.
public void ToResponse_WhenDurationIsInMilliseconds_ShouldConvertToSeconds(long consumedDurationMilliseconds, double expectedSeconds)
{
// Arrange
@@ -276,8 +276,8 @@ public class MediaResumePointEntityMappingTests
}
[Theory]
[InlineData("")] // an empty location is not a usable position
[InlineData(" ")] // a whitespace only location is not a usable position
[InlineData("")] // An empty location is not a usable position.
[InlineData(" ")] // A whitespace only location is not a usable position.
public void ToDomainEntity_WhenLocationPositionHasABlankLocation_ShouldReturnInvalidMediaPosition(string location)
{
// Arrange
@@ -329,8 +329,8 @@ public class MediaResumePointEntityMappingTests
}
[Theory]
[InlineData(MediaKind.MusicTrack, MediaPositionKind.Location, "chapter-1")] // music tracks are resumed from a time offset
[InlineData(MediaKind.Book, MediaPositionKind.TimeOffset, null)] // books are resumed from a location
[InlineData(MediaKind.MusicTrack, MediaPositionKind.Location, "chapter-1")] // Music tracks are resumed from a time offset.
[InlineData(MediaKind.Book, MediaPositionKind.TimeOffset, null)] // Books are resumed from a location.
public void ToDomainEntity_WhenPositionKindDoesNotMatchTheMediaKindRule_ShouldReturnInvalidMediaPosition(MediaKind mediaKind, MediaPositionKind positionKind, string? location)
{
// Arrange
@@ -68,7 +68,7 @@ public class UpdateArtistCommandMappingTests
Album updatedAlbum = result.Value.Albums.First(album => album.Id.Value == albumId);
Assert.Equal(albumCommand.Metadata!.Title, updatedAlbum.Metadata.Title);
Track updatedTrack = updatedAlbum.Tracks.First(track => track.Id.Value == trackId);
// the file system path of an existing track is never changed by the update, it is set only when the track is created
// The file system path of an existing track is never changed by the update, it is set only when the track is created.
Assert.Equal(originalPath, updatedTrack.Path);
Assert.NotEqual(attemptedPath, updatedTrack.Path);
Assert.Equal(7, updatedTrack.TrackNumber);
@@ -35,8 +35,8 @@ public class ArtistAliasEntityMappingTests
}
[Theory]
[InlineData("")] // empty name
[InlineData(" ")] // whitespace name
[InlineData("")] // Empty name.
[InlineData(" ")] // Whitespace name.
public void ToDomainValueObject_WhenNameIsEmpty_ShouldReturnError(string name)
{
// Arrange
@@ -50,9 +50,9 @@ public class IsrcDtoMappingTests
}
[Theory]
[InlineData(null)] // missing value
[InlineData("")] // empty value
[InlineData(" ")] // whitespace value
[InlineData(null)] // Missing value.
[InlineData("")] // Empty value.
[InlineData(" ")] // Whitespace value.
public void ToDomainValueObject_WhenValueIsNullOrWhitespace_ShouldReturnError(string? value)
{
// Arrange
@@ -67,11 +67,11 @@ public class IsrcDtoMappingTests
}
[Theory]
[InlineData("invalid")] // not an ISRC at all
[InlineData("GBUM7102960")] // too short
[InlineData("GBUM71029604X")] // too long
[InlineData("1BUM71029604")] // country code is not two letters
[InlineData("GBUM7102960A")] // designation code is not all digits
[InlineData("invalid")] // Not an ISRC at all.
[InlineData("GBUM7102960")] // Too short.
[InlineData("GBUM71029604X")] // Too long.
[InlineData("1BUM71029604")] // Country code is not two letters.
[InlineData("GBUM7102960A")] // Designation code is not all digits.
public void ToDomainValueObject_WhenValueIsMalformed_ShouldReturnError(string value)
{
// Arrange
@@ -66,8 +66,8 @@ public class IsrcEntityMappingTests
}
[Theory]
[InlineData("")] // empty value
[InlineData(" ")] // whitespace value
[InlineData("")] // Empty value.
[InlineData(" ")] // Whitespace value.
public void ToDomainValueObject_WhenValueIsWhitespace_ShouldReturnError(string value)
{
// Arrange
@@ -36,9 +36,9 @@ public class MoodDtoMappingTests
}
[Theory]
[InlineData(null)] // missing name
[InlineData("")] // empty name
[InlineData(" ")] // whitespace name
[InlineData(null)] // Missing name.
[InlineData("")] // Empty name.
[InlineData(" ")] // Whitespace name.
public void ToDomainValueObject_WhenNameIsNullOrWhitespace_ShouldReturnError(string? name)
{
// Arrange
@@ -66,8 +66,8 @@ public class MoodEntityMappingTests
}
[Theory]
[InlineData("")] // empty name
[InlineData(" ")] // whitespace name
[InlineData("")] // Empty name.
[InlineData(" ")] // Whitespace name.
public void ToDomainValueObject_WhenNameIsWhitespace_ShouldReturnError(string name)
{
// Arrange
@@ -65,9 +65,9 @@ public class MusicAreaDtoMappingTests
}
[Theory]
[InlineData(null)] // missing name
[InlineData("")] // empty name
[InlineData(" ")] // whitespace name
[InlineData(null)] // Missing name.
[InlineData("")] // Empty name.
[InlineData(" ")] // Whitespace name.
public void ToDomainValueObject_WhenNameIsNullOrWhitespace_ShouldReturnError(string? name)
{
// Arrange
@@ -36,8 +36,8 @@ public class MusicAreaEntityMappingTests
}
[Theory]
[InlineData("")] // empty name
[InlineData(" ")] // whitespace name
[InlineData("")] // Empty name.
[InlineData(" ")] // Whitespace name.
public void ToDomainValueObject_WhenNameIsEmpty_ShouldReturnError(string name)
{
// Arrange
@@ -35,9 +35,9 @@ public class MusicArtistAliasDtoMappingTests
}
[Theory]
[InlineData(null)] // missing name
[InlineData("")] // empty name
[InlineData(" ")] // whitespace name
[InlineData(null)] // Missing name.
[InlineData("")] // Empty name.
[InlineData(" ")] // Whitespace name.
public void ToDomainValueObject_WhenNameIsNullOrWhitespace_ShouldReturnError(string? name)
{
// Arrange
@@ -92,8 +92,8 @@ public class MusicWorkDtoMappingTests
}
[Theory]
[InlineData("")] // empty work title
[InlineData(" ")] // whitespace work title
[InlineData("")] // Empty work title.
[InlineData(" ")] // Whitespace work title.
public void ToDomainEntity_WhenTitleIsEmptyOrWhitespace_ShouldReturnError(string title)
{
// Arrange
@@ -88,9 +88,9 @@ public class ShuffleTracksRequestMappingTests
}
[Theory]
[InlineData("not-a-guid")] // a value that cannot be parsed
[InlineData("' OR '1'='1")] // an injection payload
[InlineData("'; DROP TABLE Tracks; --")] // a destructive injection payload
[InlineData("not-a-guid")] // A value that cannot be parsed.
[InlineData("' OR '1'='1")] // An injection payload.
[InlineData("'; DROP TABLE Tracks; --")] // A destructive injection payload.
public void ToQuery_WhenLibraryIdArgumentIsNotParseable_ShouldPassItVerbatim(string libraryId)
{
// Arrange
@@ -93,7 +93,7 @@ public class UpdateTrackCommandMappingTests
// Assert
Assert.False(result.IsFailure);
Track updatedTrack = result.Value.Albums.First(album => album.Id.Value == albumId).Tracks.First(track => track.Id.Value == trackId);
// the file system path is never changed by the update, it is set only when the track is created
// The file system path is never changed by the update, it is set only when the track is created.
Assert.Equal(originalPath, updatedTrack.Path);
Assert.Equal(command.TrackNumber, updatedTrack.TrackNumber);
Assert.False(updatedTrack.DiscNumber.HasValue);
@@ -30,9 +30,9 @@ public class GetLibraryPathTemplatePartsRequestMappingTests
}
[Theory]
[InlineData("Book")] // a written content library type
[InlineData("Movie")] // a video library type
[InlineData("Music")] // an audio library type
[InlineData("Book")] // A written content library type.
[InlineData("Movie")] // A video library type.
[InlineData("Music")] // An audio library type.
public void ToQuery_WhenMappingDifferentLibraryTypes_ShouldMapLibraryType(string libraryType)
{
// Arrange
@@ -133,7 +133,7 @@ public class BookMappingTests
entity.ApplyMetadataToEntity(book);
// Assert
// the identity and the collection columns are not part of the metadata application
// The identity and the collection columns are not part of the metadata application.
Assert.Equal(entityId, entity.Id);
Assert.Equal(libraryId, entity.LibraryId);
Assert.Equal(path, entity.Path);
@@ -73,9 +73,9 @@ public class BookMetadataDtoMappingTests
}
[Theory]
[InlineData(null)] // missing title
[InlineData("")] // empty title
[InlineData(" ")] // whitespace title
[InlineData(null)] // Missing title.
[InlineData("")] // Empty title.
[InlineData(" ")] // Whitespace title.
public void ApplyMetadata_WhenTitleIsNullOrWhitespace_ShouldReturnTitleCannotBeEmptyError(string? title)
{
// Arrange
@@ -104,13 +104,13 @@ public class BookRatingDtoMappingTests
foreach (Result<BookRating> result in resultList)
Assert.False(result.IsFailure);
// complete rating
// Complete rating.
Assert.Equal(dtos[0].Value!.Value, resultList[0].Value.Value);
Assert.Equal(dtos[0].MaxValue!.Value, resultList[0].Value.MaxValue);
Assert.Equal(dtos[0].Source!.Value, resultList[0].Value.Source.Value);
Assert.Equal(dtos[0].VoteCount!.Value, resultList[0].Value.VoteCount.Value);
// minimal rating
// Minimal rating.
Assert.Equal(dtos[1].Value!.Value, resultList[1].Value.Value);
Assert.Equal(dtos[1].MaxValue!.Value, resultList[1].Value.MaxValue);
Assert.False(resultList[1].Value.Source.HasValue);
@@ -92,19 +92,19 @@ public class BookRatingMappingTests
List<BookRatingEntity> resultList = [.. results];
// complete rating
// Complete rating.
Assert.Equal(bookRatings[0].Value, resultList[0].Value);
Assert.Equal(bookRatings[0].MaxValue, resultList[0].MaxValue);
Assert.Equal(bookRatings[0].Source.Value, resultList[0].Source);
Assert.Equal(bookRatings[0].VoteCount.Value, resultList[0].VoteCount);
// rating without source
// Rating without source.
Assert.Equal(bookRatings[1].Value, resultList[1].Value);
Assert.Equal(bookRatings[1].MaxValue, resultList[1].MaxValue);
Assert.Null(resultList[1].Source);
Assert.Equal(bookRatings[1].VoteCount.Value, resultList[1].VoteCount);
// rating without vote count
// Rating without vote count.
Assert.Equal(bookRatings[2].Value, resultList[2].Value);
Assert.Equal(bookRatings[2].MaxValue, resultList[2].MaxValue);
Assert.Equal(bookRatings[2].Source.Value, resultList[2].Source);
@@ -66,7 +66,7 @@ public class IsbnDtoMappingTests
Assert.False(result.IsFailure);
Assert.NotNull(result.Value);
Assert.Equal(dto.Value, result.Value.Value);
Assert.Equal(IsbnFormat.Isbn13, result.Value.Format); // default format
Assert.Equal(IsbnFormat.Isbn13, result.Value.Format); // Default format.
}
[Fact]
@@ -110,7 +110,7 @@ public class IsbnDtoMappingTests
Assert.Equal(dtos[1].Format!.Value, resultList[1].Value.Format);
Assert.Equal(dtos[2].Value, resultList[2].Value.Value);
Assert.Equal(IsbnFormat.Isbn13, resultList[2].Value.Format); // default format
Assert.Equal(IsbnFormat.Isbn13, resultList[2].Value.Format); // Default format.
}
[Fact]
@@ -38,10 +38,10 @@ public class UserMappingTests
// Assert
Assert.NotNull(result);
Assert.Same(repositoryEntity, result); // should modify the same instance
Assert.Equal(domainEntity.Username, result.Username); // only username should be updated
Assert.Same(repositoryEntity, result); // Should modify the same instance.
Assert.Equal(domainEntity.Username, result.Username); // Only username should be updated.
// verify other properties remain unchanged
// Verify other properties remain unchanged.
Assert.Equal(repositoryEntity.Id, result.Id);
Assert.Equal(repositoryEntity.Password, result.Password);
Assert.Equal(repositoryEntity.TotpSecret, result.TotpSecret);
@@ -47,8 +47,8 @@ public class UpdatePlaybackStateRequestMappingTests
}
[Theory]
[InlineData(0.0, false)] // the minimum volume, not muted
[InlineData(1.0, true)] // the maximum volume, muted
[InlineData(0.0, false)] // The minimum volume, not muted.
[InlineData(1.0, true)] // The maximum volume, muted.
public void ToCommand_WhenMappingBoundaryValues_ShouldMapThemExactly(double volume, bool isMuted)
{
// Arrange