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

@@ -90,7 +90,7 @@ public class AddLibraryCommandValidatorTests
{
// Arrange
AddLibraryCommand command = _addLibraryCommandFixture.Create();
command = command with { LibraryType = "0" }; // Book
command = command with { LibraryType = "0" }; // Book.
// Act
List<Error> result = _validator.TestValidate(command);
@@ -58,7 +58,7 @@ public class ScanLibrariesCommandHandlerTests
_mockDomainEventsQueue = Substitute.For<IDomainEventsQueue>();
_userId = Guid.NewGuid();
// default stubs: the current user is authenticated and is an admin
// Default stubs: the current user is authenticated and is an admin.
_mockCurrentUserService.UserId.Returns(_userId);
_mockAuthorizationService.IsInRoleAsync(_userId, "Admin", Arg.Any<CancellationToken>()).Returns(true);
_mockLibraryScanRepository.GetPastMonthScansByLibraryIdAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>())
@@ -63,7 +63,7 @@ public class ScanLibraryCommandHandlerTests
_mockValidator = Substitute.For<IValidator<ScanLibraryCommand>>();
_userId = Guid.NewGuid();
// default stubs: the current user is authenticated and the ownership policy allows the scan
// Default stubs: the current user is authenticated and the ownership policy allows the scan.
_mockCurrentUserService.UserId.Returns(_userId);
_mockAuthorizationService.EvaluatePolicyAsync<ILibraryOwnershipPolicy>(_userId, Arg.Any<LibraryOwnershipPolicyContext>(), Arg.Any<CancellationToken>())
.Returns(true);
@@ -117,7 +117,7 @@ public class UpdateLibraryCommandValidatorTests
{
// Arrange
UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
command = command with { LibraryType = "0" }; // Book
command = command with { LibraryType = "0" }; // Book.
// Act
List<Error> result = _validator.TestValidate(command);
@@ -125,7 +125,7 @@ public class BooksMediaLibraryItemDeletionStrategyTests
Result<Success> result = await _sut.DeleteItemAsync(libraryId.Value, book.Path, CancellationToken.None);
// Assert
// a failing artwork deletion must not prevent the book from being removed, so the deletion is only logged
// A failing artwork deletion must not prevent the book from being removed, so the deletion is only logged.
Assert.True(result.IsSuccess);
await _mockBookRepository.Received(1).DeleteByIdAsync(book.Id, Arg.Any<CancellationToken>());
await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any<CancellationToken>());
@@ -76,7 +76,7 @@ public class LibraryDeletedDomainEventHandlerTests
IOptions<MediaSettingsDto> mediaSettingsOptions = Substitute.For<IOptions<MediaSettingsDto>>();
mediaSettingsOptions.Value.Returns(mediaSettings);
// default stubs: all path combinations succeed, segments are sanitized to their input, the library directories exist and they are deleted successfully
// Default stubs: all path combinations succeed, segments are sanitized to their input, the library directories exist and they are deleted successfully.
_mockPathService.CombinePath(Arg.Any<string>(), Arg.Any<string>())
.Returns(callInfo => Result.From(string.Concat(callInfo.ArgAt<string>(0), callInfo.ArgAt<string>(1))));
_mockPathService.SanitizeCompositeSegment(Arg.Any<string>(), Arg.Any<string>())
@@ -74,7 +74,7 @@ public class LibrarySavedDomainEventHandlerTests
IOptions<MediaSettingsDto> mediaSettingsOptions = Substitute.For<IOptions<MediaSettingsDto>>();
mediaSettingsOptions.Value.Returns(mediaSettings);
// default stubs: the cover source file exists and is a valid image, the library directory does not exist yet, and all path combinations succeed
// Default stubs: the cover source file exists and is a valid image, the library directory does not exist yet, and all path combinations succeed.
_mockPathService.PathSeparator.Returns('/');
_mockPathService.CombinePath(Arg.Any<string>(), Arg.Any<string>())
.Returns(callInfo => Result.From(string.Concat(callInfo.ArgAt<string>(0), callInfo.ArgAt<string>(1))));
@@ -166,8 +166,8 @@ public class LibrarySavedDomainEventHandlerTests
Guid libraryId = Guid.NewGuid();
Library library = _libraryFixture.Create(id: libraryId, coverImage: "/Media/Libraries/guid/cover.png");
LibrarySavedDomainEvent domainEvent = _librarySavedDomainEventFixture.Create(library: library);
// mirror the real CombinePath behavior, which treats the combined name as a directory segment and appends a trailing
// separator; the internal cover path resolution must still yield the file path without that trailing separator
// Mirror the real CombinePath behavior, which treats the combined name as a directory segment and appends a trailing
// separator; the internal cover path resolution must still yield the file path without that trailing separator.
_mockPathService.CombinePath(Arg.Any<string>(), Arg.Any<string>())
.Returns(callInfo => Result.From(string.Concat(callInfo.ArgAt<string>(0), callInfo.ArgAt<string>(1)) + '/'));
string internalImagePath = $"{AppContext.BaseDirectory.TrimEnd('/')}/Media/Libraries/guid/cover.png";
@@ -59,7 +59,7 @@ public class LibraryScanFailedDomainEventHandlerTests
_mockMediaLibrariesScanCancellationTracker = Substitute.For<IMediaLibrariesScanCancellationTracker>();
_mockDebouncedLibraryScanProgressNotifier = Substitute.For<IMediaLibraryScanProgressNotifier>();
// default stubs: the library scan update, the snapshot rollback and the staging results clearing succeed
// Default stubs: the library scan update, the snapshot rollback and the staging results clearing succeed.
_mockLibraryScanRepository.UpdateAsync(Arg.Any<LibraryScanEntity>(), Arg.Any<CancellationToken>())
.Returns(Result.Updated);
_mockLibraryScanSnapshotRepository.RollbackSnapshotForScanAsync(Arg.Any<Guid>(), Arg.Any<Guid>(), Arg.Any<CancellationToken>())
@@ -53,7 +53,7 @@ public class LibraryScanFinishedDomainEventHandlerTests
_mockMediaLibrariesScanCancellationTracker = Substitute.For<IMediaLibrariesScanCancellationTracker>();
_mockDebouncedLibraryScanProgressNotifier = Substitute.For<IMediaLibraryScanProgressNotifier>();
// default stubs: the library scan update succeeds
// Default stubs: the library scan update succeeds.
_mockLibraryScanRepository.UpdateAsync(Arg.Any<LibraryScanEntity>(), Arg.Any<CancellationToken>())
.Returns(Result.Updated);
@@ -48,7 +48,7 @@ public class GetEnabledLibrariesQueryHandlerTests
_mockCurrentUserService = Substitute.For<ICurrentUserService>();
_userId = Guid.NewGuid();
// default stubs: the current user is authenticated and is an admin
// Default stubs: the current user is authenticated and is an admin.
_mockCurrentUserService.UserId.Returns(_userId);
_mockAuthorizationService.IsInRoleAsync(_userId, "Admin", Arg.Any<CancellationToken>()).Returns(true);
@@ -52,7 +52,7 @@ public class GetLibrariesQueryHandlerTests
_mockCurrentUserService = Substitute.For<ICurrentUserService>();
_userId = Guid.NewGuid();
// default stubs: the current user is authenticated and is an admin
// Default stubs: the current user is authenticated and is an admin.
_mockCurrentUserService.UserId.Returns(_userId);
_mockAuthorizationService.IsInRoleAsync(_userId, "Admin", Arg.Any<CancellationToken>()).Returns(true);
@@ -54,7 +54,7 @@ public class GetLibraryQueryHandlerTests
_mockValidator = Substitute.For<IValidator<GetLibraryQuery>>();
_userId = Guid.NewGuid();
// default stubs: the current user is authenticated and the library ownership policy allows access
// Default stubs: the current user is authenticated and the library ownership policy allows access.
_mockCurrentUserService.UserId.Returns(_userId);
_mockAuthorizationService.EvaluatePolicyAsync<ILibraryOwnershipPolicy>(_userId, Arg.Any<LibraryOwnershipPolicyContext>(), Arg.Any<CancellationToken>())
.Returns(true);
@@ -62,7 +62,7 @@ public class GetLibraryScanProgressQueryHandlerTests
_mockValidator = Substitute.For<IValidator<GetLibraryScanProgressQuery>>();
_userId = Guid.NewGuid();
// default stubs: the current user is authenticated, the ownership policy allows access, and the scan has progress
// Default stubs: the current user is authenticated, the ownership policy allows access, and the scan has progress.
_mockCurrentUserService.UserId.Returns(_userId);
_mockAuthorizationService.EvaluatePolicyAsync<ILibraryOwnershipPolicy>(_userId, Arg.Any<LibraryOwnershipPolicyContext>(), Arg.Any<CancellationToken>())
.Returns(true);