diff --git a/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryFixture.cs index 96461251..4ffc7141 100644 --- a/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryFixture.cs +++ b/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryFixture.cs @@ -40,7 +40,7 @@ public class LoginUserQueryFixture .RuleFor(x => x.Password, resolvedPassword); if (shouldIncludeTotpCode) - faker.RuleFor(x => x.TotpCode, f => totpCode ?? f.Random.Replace("######")); // generates 6 random digits when no code is pinned + faker.RuleFor(x => x.TotpCode, f => totpCode ?? f.Random.Replace("######")); // Generates 6 random digits when no code is pinned. return faker.Generate(); } diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaContributors/MediaContributorDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaContributors/MediaContributorDtoFixture.cs index 000dec79..fd9cdfa5 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaContributors/MediaContributorDtoFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaContributors/MediaContributorDtoFixture.cs @@ -43,7 +43,7 @@ public class MediaContributorDtoFixture displayName: displayName, legalName: legalName, includeDisplayName: includeDisplayName, - // this fixture historically left the legal name null unless one was explicitly supplied, so the name fixture is only asked for one when a value is passed + // This fixture historically left the legal name null unless one was explicitly supplied, so the name fixture is only asked for one when a value is passed. includeLegalName: includeLegalName && legalName is not null) : null, Role: includeRole ? role ?? _faker.PickRandom() : null); } diff --git a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/ThumbnailFixture.cs b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/ThumbnailFixture.cs index a2fcbb2b..b7b09a3c 100644 --- a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/ThumbnailFixture.cs +++ b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/ValueObjects/ThumbnailFixture.cs @@ -26,7 +26,7 @@ public class ThumbnailFixture public Thumbnail Create(ImageType? type = null, byte[]? bytes = null) { type ??= _faker.PickRandom(); - bytes ??= _faker.Random.Bytes(1024); // Generate 1KB of random bytes + bytes ??= _faker.Random.Bytes(1024); // Generate 1KB of random bytes. return new Thumbnail(type.Value, bytes); } diff --git a/tests/Common/Lumina.Infrastructure.Fixtures/Core/Authentication/QRCodeGeneratorFixture.cs b/tests/Common/Lumina.Infrastructure.Fixtures/Core/Authentication/QRCodeGeneratorFixture.cs index 073da4ba..16a87b4a 100644 --- a/tests/Common/Lumina.Infrastructure.Fixtures/Core/Authentication/QRCodeGeneratorFixture.cs +++ b/tests/Common/Lumina.Infrastructure.Fixtures/Core/Authentication/QRCodeGeneratorFixture.cs @@ -19,7 +19,7 @@ public class QRCodeGeneratorFixture public static (string Username, byte[] Secret) CreateQrCodeTestData() { string username = new Faker().Person.UserName; - byte[] secret = new byte[20]; // Standard TOTP secret length + byte[] secret = new byte[20]; // Standard TOTP secret length. Random.Shared.NextBytes(secret); return (username, secret); } diff --git a/tests/Common/Lumina.Infrastructure.Fixtures/Core/Security/CryptographyServiceFixture.cs b/tests/Common/Lumina.Infrastructure.Fixtures/Core/Security/CryptographyServiceFixture.cs index 0e3a4783..afacc5a1 100644 --- a/tests/Common/Lumina.Infrastructure.Fixtures/Core/Security/CryptographyServiceFixture.cs +++ b/tests/Common/Lumina.Infrastructure.Fixtures/Core/Security/CryptographyServiceFixture.cs @@ -25,7 +25,7 @@ public class CryptographyServiceFixture /// The configured options. public IOptions CreateEncryptionSettings() { - // Generate a valid 256-bit (32 byte) key for AES-256 + // Generate a valid 256-bit (32 byte) key for AES-256. byte[] key = new byte[32]; RandomNumberGenerator.Fill(key); string base64Key = Convert.ToBase64String(key); diff --git a/tests/Common/Lumina.Presentation.Api.Fixtures/Core/Endpoints/FileSystemManagement/FileSystemStructureFixture.cs b/tests/Common/Lumina.Presentation.Api.Fixtures/Core/Endpoints/FileSystemManagement/FileSystemStructureFixture.cs index 5ed716d9..4dbac369 100644 --- a/tests/Common/Lumina.Presentation.Api.Fixtures/Core/Endpoints/FileSystemManagement/FileSystemStructureFixture.cs +++ b/tests/Common/Lumina.Presentation.Api.Fixtures/Core/Endpoints/FileSystemManagement/FileSystemStructureFixture.cs @@ -38,25 +38,25 @@ public class FileSystemStructureFixture /// The path to the root directory of the created file system structure. public string CreateFileSystemStructure() { - // create the root directory + // Create the root directory. Directory.CreateDirectory(_rootPath); string currentPath = _rootPath; for (int i = 1; i <= 3; i++) { - // create a nested subdirectory + // Create a nested subdirectory. currentPath = Path.Combine(currentPath, $"NestedDirectory_{i}"); Directory.CreateDirectory(currentPath); - // create two text files in the current directory + // Create two text files in the current directory. for (int j = 1; j <= 2; j++) { string filePath = Path.Combine(currentPath, $"TestFile_{j}.txt"); File.WriteAllText(filePath, _faker.Lorem.Paragraph()); - // make the first file in each directory hidden + // Make the first file in each directory hidden. if (j == 1) SetHidden(filePath); } - // make the second nested directory hidden + // Make the second nested directory hidden. if (i == 2) currentPath = SetHidden(currentPath); } @@ -69,10 +69,10 @@ public class FileSystemStructureFixture /// when hidden elements can be created, otherwise . private static bool DetectHiddenAttributeSupport() { - // on Unix-like systems the fixture hides elements with the dot-prefix convention, which the file system always supports + // On Unix-like systems the fixture hides elements with the dot-prefix convention, which the file system always supports. if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS()) return true; - // on Windows the fixture relies on the hidden file attribute, which some file systems (for example network drives) do not persist + // On Windows the fixture relies on the hidden file attribute, which some file systems (for example network drives) do not persist. string probePath = Path.Combine(AppContext.BaseDirectory, "lumina_hidden_attribute_probe_" + Guid.NewGuid()); try { @@ -111,7 +111,7 @@ public class FileSystemStructureFixture File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS()) { - // On Unix-like systems, rename the file/directory to start with a dot + // On Unix-like systems, rename the file/directory to start with a dot. string directory = Path.GetDirectoryName(path)!; string name = Path.GetFileName(path); string newPath = Path.Combine(directory, "." + name); diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/TestHelpers/TestHttpContextFactory.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/TestHelpers/TestHttpContextFactory.cs index 5727e891..28f67387 100644 --- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/TestHelpers/TestHttpContextFactory.cs +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/TestHelpers/TestHttpContextFactory.cs @@ -29,9 +29,9 @@ public static class TestHttpContextFactory public static DefaultHttpContext Create(string? culture = "en-US", ClaimsPrincipal? user = null, ISession? session = null) { DefaultHttpContext httpContext = new(); - // provide a writable response body, so that executed IResult instances can be inspected by the tests + // Provide a writable response body, so that executed IResult instances can be inspected by the tests. httpContext.Features.Set(new StreamResponseBodyFeature(new MemoryStream())); - // provide the minimal services needed by the result execution machinery (logging, options, JSON options) + // Provide the minimal services needed by the result execution machinery (logging, options, JSON options). httpContext.RequestServices = CreateServiceProvider(); httpContext.Request.RouteValues["culture"] = culture; if (user is not null) @@ -91,7 +91,7 @@ public static class TestHttpContextFactory public static ISession CreateSession() { ISession session = Substitute.For(); -#pragma warning disable CS8601 // possible null reference assignment in the NSubstitute out-argument stub +#pragma warning disable CS8601 // Possible null reference assignment in the NSubstitute out-argument stub. session.TryGetValue(Arg.Any(), out Arg.Any()).Returns(callInfo => { callInfo[1] = null; diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/TestHelpers/WebTestHelpers.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/TestHelpers/WebTestHelpers.cs index 33101fa7..83f997a3 100644 --- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/TestHelpers/WebTestHelpers.cs +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/TestHelpers/WebTestHelpers.cs @@ -32,7 +32,7 @@ public static partial class WebTestHelpers private const string LOGIN_PAGE_PATH = "/en-us/auth/login"; private const string LOGIN_ENDPOINT_PATH = "/en-us/auth/api-login"; - // the change password page renders an antiforgery token for the authenticated user without calling the remote API + // The change password page renders an antiforgery token for the authenticated user without calling the remote API. private const string AUTHENTICATED_TOKEN_PAGE_PATH = "/en-us/auth/change-password"; [GeneratedRegex("name=\"__RequestVerificationToken\"[^>]*value=\"([^\"]*)\"")] @@ -57,7 +57,7 @@ public static partial class WebTestHelpers /// An HTTP client authenticated with the application's authentication cookie, together with an antiforgery token. public static async Task CreateAuthenticatedClientAsync(WebApplicationFactory factory, string? username = "testuser", string? password = "TestPass123!") { - // the application marks its cookies as secure, so the test client must communicate over HTTPS for the cookies to be sent back + // The application marks its cookies as secure, so the test client must communicate over HTTPS for the cookies to be sent back. HttpClient client = factory.CreateClient(new WebApplicationFactoryClientOptions { BaseAddress = new Uri("https://localhost"), @@ -65,9 +65,9 @@ public static partial class WebTestHelpers }); string antiforgeryToken = await GetAntiforgeryTokenAsync(client); await LoginAsync(client, username!, password!, antiforgeryToken); - // the antiforgery token is bound to the authenticated user, because the antiforgery middleware runs after + // The antiforgery token is bound to the authenticated user, because the antiforgery middleware runs after // authentication; the token captured from the anonymous login page is rejected with a 400 for authenticated - // mutating requests, so a fresh token must be captured after the login + // mutating requests, so a fresh token must be captured after the login. string authenticatedAntiforgeryToken = await GetAntiforgeryTokenAsync(client, AUTHENTICATED_TOKEN_PAGE_PATH); return new AuthenticatedWebClient(client, authenticatedAntiforgeryToken); } diff --git a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/Favorites/FavoriteRepositoryTests.cs b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/Favorites/FavoriteRepositoryTests.cs index a7facc05..e237fc62 100644 --- a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/Favorites/FavoriteRepositoryTests.cs +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/Favorites/FavoriteRepositoryTests.cs @@ -316,10 +316,10 @@ public class FavoriteRepositoryTests } [Theory] - [InlineData(FavoriteMediaKind.MusicArtist)] // the artist catalogue serves the library Id of an artist - [InlineData(FavoriteMediaKind.MusicAlbum)] // the album catalogue serves the library Id of an album - [InlineData(FavoriteMediaKind.MusicTrack)] // the track catalogue serves the library Id of a track - [InlineData(FavoriteMediaKind.Book)] // the book catalogue serves the library Id of a book + [InlineData(FavoriteMediaKind.MusicArtist)] // The artist catalogue serves the library Id of an artist. + [InlineData(FavoriteMediaKind.MusicAlbum)] // The album catalogue serves the library Id of an album. + [InlineData(FavoriteMediaKind.MusicTrack)] // The track catalogue serves the library Id of a track. + [InlineData(FavoriteMediaKind.Book)] // The book catalogue serves the library Id of a book. public async Task GetMediaItemLibraryIdAsync_WhenTheMediaItemExists_ShouldReturnTheLibraryIdOfItsCatalogue(FavoriteMediaKind mediaKind) { // Arrange @@ -390,9 +390,9 @@ public class FavoriteRepositoryTests } [Theory] - [InlineData(FavoriteMediaKind.Video)] // planned kind, no video catalogue exists - [InlineData(FavoriteMediaKind.Photo)] // planned kind, no photo catalogue exists - [InlineData((FavoriteMediaKind)999)] // an undefined value that is neither catalogued nor planned + [InlineData(FavoriteMediaKind.Video)] // Planned kind, no video catalogue exists. + [InlineData(FavoriteMediaKind.Photo)] // Planned kind, no photo catalogue exists. + [InlineData((FavoriteMediaKind)999)] // An undefined value that is neither catalogued nor planned. public async Task GetMediaItemLibraryIdAsync_WhenTheKindHasNoCatalogue_ShouldReturnSuccessWithNullWithoutReadingTheCatalogue(FavoriteMediaKind mediaKind) { // Arrange @@ -911,8 +911,8 @@ public class FavoriteRepositoryTests } [Theory] - [InlineData(FavoriteMediaKind.Video)] // planned kind, so no display data can be resolved yet - [InlineData(FavoriteMediaKind.Photo)] // planned kind, so no display data can be resolved yet + [InlineData(FavoriteMediaKind.Video)] // Planned kind, so no display data can be resolved yet. + [InlineData(FavoriteMediaKind.Photo)] // Planned kind, so no display data can be resolved yet. public async Task GetAllForUserAsync_WhenTheFavoriteIsOfAPlannedKind_ShouldReturnItWithoutDisplayData(FavoriteMediaKind mediaKind) { // Arrange @@ -1121,11 +1121,11 @@ public class FavoriteRepositoryTests } [Theory] - [InlineData(FavoriteMediaKind.MusicArtist, false)] // the artist itself is soft deleted - [InlineData(FavoriteMediaKind.MusicAlbum, false)] // the album itself is soft deleted - [InlineData(FavoriteMediaKind.MusicAlbum, true)] // the album's artist is soft deleted - [InlineData(FavoriteMediaKind.MusicTrack, false)] // the track itself is soft deleted - [InlineData(FavoriteMediaKind.MusicTrack, true)] // the track's album is soft deleted + [InlineData(FavoriteMediaKind.MusicArtist, false)] // The artist itself is soft deleted. + [InlineData(FavoriteMediaKind.MusicAlbum, false)] // The album itself is soft deleted. + [InlineData(FavoriteMediaKind.MusicAlbum, true)] // The album's artist is soft deleted. + [InlineData(FavoriteMediaKind.MusicTrack, false)] // The track itself is soft deleted. + [InlineData(FavoriteMediaKind.MusicTrack, true)] // The track's album is soft deleted. public async Task GetMediaItemLibraryIdAsync_WhenTheMusicItemIsSoftDeleted_ShouldReturnSuccessWithNull(FavoriteMediaKind mediaKind, bool isAncestorDeleted) { // Arrange @@ -1144,11 +1144,11 @@ public class FavoriteRepositoryTests } [Theory] - [InlineData(FavoriteMediaKind.MusicArtist, false)] // the artist itself is soft deleted - [InlineData(FavoriteMediaKind.MusicAlbum, false)] // the album itself is soft deleted - [InlineData(FavoriteMediaKind.MusicAlbum, true)] // the album's artist is soft deleted - [InlineData(FavoriteMediaKind.MusicTrack, false)] // the track itself is soft deleted - [InlineData(FavoriteMediaKind.MusicTrack, true)] // the track's album is soft deleted + [InlineData(FavoriteMediaKind.MusicArtist, false)] // The artist itself is soft deleted. + [InlineData(FavoriteMediaKind.MusicAlbum, false)] // The album itself is soft deleted. + [InlineData(FavoriteMediaKind.MusicAlbum, true)] // The album's artist is soft deleted. + [InlineData(FavoriteMediaKind.MusicTrack, false)] // The track itself is soft deleted. + [InlineData(FavoriteMediaKind.MusicTrack, true)] // The track's album is soft deleted. public async Task GetAllForUserAsync_WhenTheFavoritedMusicItemIsSoftDeleted_ShouldKeepTheFavoriteWithoutDisplayData(FavoriteMediaKind mediaKind, bool isAncestorDeleted) { // Arrange diff --git a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecificationTests.cs b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecificationTests.cs index 52eaaf2d..5c5491c0 100644 --- a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecificationTests.cs +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecificationTests.cs @@ -193,9 +193,9 @@ public class ArtistAlphaFilterSpecificationTests : IDisposable } [Theory] - [InlineData("a", "Alpha")] // the first letter of the alphabet - [InlineData("b", "Bravo")] // a letter in the middle of the alphabet - [InlineData("c", "Charlie")] // another letter in the middle of the alphabet + [InlineData("a", "Alpha")] // The first letter of the alphabet. + [InlineData("b", "Bravo")] // A letter in the middle of the alphabet. + [InlineData("c", "Charlie")] // Another letter in the middle of the alphabet. public void ToExpression_WhenAlphaKeyIsALetter_ShouldMatchOnlyTheNamesStartingWithIt(string alphaKey, string matchingName) { // Arrange diff --git a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/UoW/UnitOfWorkTests.cs b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/UoW/UnitOfWorkTests.cs index 842b146f..f5b6184b 100644 --- a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/UoW/UnitOfWorkTests.cs +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/UoW/UnitOfWorkTests.cs @@ -212,7 +212,7 @@ public class UnitOfWorkTests Result firstSaveResult = await sut.SaveChangesAsync(CancellationToken.None); Assert.False(firstSaveResult.IsFailure); - // stage a second book with the same library and path directly, bypassing the application level pre-check, so that the unique index of the storage medium is the one that rejects it + // Stage a second book with the same library and path directly, bypassing the application level pre-check, so that the unique index of the storage medium is the one that rejects it. BookEntity secondBook = _bookEntityFixture.Create(); secondBook.LibraryId = libraryId; secondBook.Path = "/books/duplicate.epub"; @@ -275,7 +275,7 @@ public class UnitOfWorkTests Result firstSaveResult = await sut.SaveChangesAsync(CancellationToken.None); Assert.False(firstSaveResult.IsFailure); - // stage a duplicate directly through the repository, bypassing the application level existence check, so that the unique index of the storage medium is the one that rejects it + // Stage a duplicate directly through the repository, bypassing the application level existence check, so that the unique index of the storage medium is the one that rejects it. FavoriteEntity duplicateFavorite = _favoriteEntityFixture.Create( userId: userId, mediaKind: FavoriteMediaKind.MusicArtist, diff --git a/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Common/Caching/TranscodingCachePathsTests.cs b/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Common/Caching/TranscodingCachePathsTests.cs index d76ac1c3..e57ff73b 100644 --- a/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Common/Caching/TranscodingCachePathsTests.cs +++ b/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Common/Caching/TranscodingCachePathsTests.cs @@ -27,9 +27,9 @@ public class TranscodingCachePathsTests : IDisposable } [Theory] - [InlineData(null)] // no cache directory is configured - [InlineData("")] // an empty cache directory is configured - [InlineData(" ")] // a white space cache directory is configured + [InlineData(null)] // No cache directory is configured. + [InlineData("")] // An empty cache directory is configured. + [InlineData(" ")] // A white space cache directory is configured. public void GetRootDirectory_WhenNoDirectoryIsConfigured_ShouldReturnTheDefaultDirectoryUnderTheTemporaryDirectory(string? configuredDirectory) { // Act @@ -128,13 +128,13 @@ public class TranscodingCachePathsTests : IDisposable } [Theory] - [InlineData(null)] // no identifier - [InlineData("")] // an empty identifier - [InlineData("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde")] // 63 characters - [InlineData("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0")] // 65 characters - [InlineData("0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF")] // uppercase hexadecimal characters - [InlineData("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdeg")] // a character that is not hexadecimal - [InlineData("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde/")] // a directory separator + [InlineData(null)] // No identifier. + [InlineData("")] // An empty identifier. + [InlineData("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde")] // 63 characters. + [InlineData("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0")] // 65 characters. + [InlineData("0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF")] // Uppercase hexadecimal characters. + [InlineData("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdeg")] // A character that is not hexadecimal. + [InlineData("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde/")] // A directory separator. public void IsValidCacheId_WhenTheValueIsNotAWellFormedIdentifier_ShouldReturnFalse(string? cacheId) { // Act @@ -158,10 +158,10 @@ public class TranscodingCachePathsTests : IDisposable } [Theory] - [InlineData(null)] // no name - [InlineData("")] // an empty name - [InlineData("segment.m4s")] // an ordinary file name - [InlineData("not-a-cache-entry")] // an ordinary directory name + [InlineData(null)] // No name. + [InlineData("")] // An empty name. + [InlineData("segment.m4s")] // An ordinary file name. + [InlineData("not-a-cache-entry")] // An ordinary directory name. public void IsCacheEntryName_WhenTheNameIsNotInTheCacheNamespace_ShouldReturnFalse(string? entryName) { // Act @@ -172,9 +172,9 @@ public class TranscodingCachePathsTests : IDisposable } [Theory] - [InlineData("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")] // a cache identifier - [InlineData("tmp-0123456789abcdef")] // a temporary directory - [InlineData("del-0123456789abcdef")] // a deletion tombstone + [InlineData("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")] // A cache identifier. + [InlineData("tmp-0123456789abcdef")] // A temporary directory. + [InlineData("del-0123456789abcdef")] // A deletion tombstone. public void IsCacheEntryName_WhenTheNameIsInTheCacheNamespace_ShouldReturnTrue(string entryName) { // Act diff --git a/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs b/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs index f87903df..2839b0ed 100644 --- a/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs +++ b/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs @@ -119,13 +119,13 @@ public class MusicArtworkServiceTests } [Theory] - [InlineData(ArtworkType.Cover, 0, "cover.jpg")] // the front cover uses the bare type name - [InlineData(ArtworkType.Back, 0, "back.jpg")] // the back cover uses the bare type name - [InlineData(ArtworkType.Medium, 0, "medium.jpg")] // a single medium uses the bare type name - [InlineData(ArtworkType.Booklet, 0, "booklet.jpg")] // the first booklet page uses the bare type name - [InlineData(ArtworkType.Booklet, 2, "booklet-2.jpg")] // a further booklet page is suffixed with its ordinal - [InlineData(ArtworkType.Liner, 1, "liner-1.jpg")] // a liner note page is suffixed with its ordinal - [InlineData(ArtworkType.Other, 0, "other.jpg")] // any other type falls back to the generic name + [InlineData(ArtworkType.Cover, 0, "cover.jpg")] // The front cover uses the bare type name. + [InlineData(ArtworkType.Back, 0, "back.jpg")] // The back cover uses the bare type name. + [InlineData(ArtworkType.Medium, 0, "medium.jpg")] // A single medium uses the bare type name. + [InlineData(ArtworkType.Booklet, 0, "booklet.jpg")] // The first booklet page uses the bare type name. + [InlineData(ArtworkType.Booklet, 2, "booklet-2.jpg")] // A further booklet page is suffixed with its ordinal. + [InlineData(ArtworkType.Liner, 1, "liner-1.jpg")] // A liner note page is suffixed with its ordinal. + [InlineData(ArtworkType.Other, 0, "other.jpg")] // Any other type falls back to the generic name. public async Task SaveAlbumArtworkAsync_WhenTheArtworkHasAType_ShouldNameTheFileAfterTheTypeAndOrdinal(ArtworkType artworkType, int ordinal, string expectedFileName) { // Arrange @@ -833,9 +833,9 @@ public class MusicArtworkServiceTests } [Theory] - [InlineData(null)] // a null path is a no-op - [InlineData("")] // an empty path is a no-op - [InlineData(" ")] // a whitespace path is a no-op + [InlineData(null)] // A null path is a no-op. + [InlineData("")] // An empty path is a no-op. + [InlineData(" ")] // A whitespace path is a no-op. public void DeleteStoredArtwork_WhenThePathIsMissing_ShouldReturnDeletedWithoutTouchingTheFileSystem(string? artworkRelativePath) { // Act diff --git a/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TranscodingCacheCoordinatorTests.cs b/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TranscodingCacheCoordinatorTests.cs index d8626467..fb17888c 100644 --- a/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TranscodingCacheCoordinatorTests.cs +++ b/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TranscodingCacheCoordinatorTests.cs @@ -111,8 +111,8 @@ public class TranscodingCacheCoordinatorTests : IDisposable } [Theory] - [InlineData(0)] // a zero sized output - [InlineData(-1)] // a negative sized output + [InlineData(0)] // A zero sized output. + [InlineData(-1)] // A negative sized output. public void TryReserve_WhenTheRequestedSizeIsNotPositive_ShouldReturnFalse(int requestedBytes) { // Act @@ -124,8 +124,8 @@ public class TranscodingCacheCoordinatorTests : IDisposable } [Theory] - [InlineData(0)] // a zero maximum cache size - [InlineData(-1)] // a negative maximum cache size + [InlineData(0)] // A zero maximum cache size. + [InlineData(-1)] // A negative maximum cache size. public void TryReserve_WhenTheMaximumCacheSizeIsNotPositive_ShouldReturnFalse(int maxCacheBytes) { // Act diff --git a/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/Themes/ThemeServiceTests.cs b/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/Themes/ThemeServiceTests.cs index f8607f53..93265892 100644 --- a/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/Themes/ThemeServiceTests.cs +++ b/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/Themes/ThemeServiceTests.cs @@ -107,7 +107,7 @@ public class ThemeServiceTests : IDisposable public void HasThemePack_WhenThemeIsNotInstalled_ShouldReturnFalse() { // Arrange - // nothing is installed + // Nothing is installed. // Act bool result = _sut.HasThemePack("test-theme"); @@ -878,9 +878,9 @@ public class ThemeServiceTests : IDisposable } [Theory] - [InlineData("../secret")] // parent scope traversal attempt - [InlineData("/etc/passwd")] // rooted path attempt - [InlineData("templates//nested")] // empty segment attempt + [InlineData("../secret")] // Parent scope traversal attempt. + [InlineData("/etc/passwd")] // Rooted path attempt. + [InlineData("templates//nested")] // Empty segment attempt. public async Task GetTemplateAsync_WhenPageKeyAttemptsToEscapeTheThemePack_ShouldReturnThemeTemplateNotFound(string pageKey) { // Arrange diff --git a/tests/IntegrationTests/Lumina.Plugins.Calibre.IntegrationTests/Core/CalibreArtworkProviderTests.cs b/tests/IntegrationTests/Lumina.Plugins.Calibre.IntegrationTests/Core/CalibreArtworkProviderTests.cs index d4e78cbe..ebf85f9e 100644 --- a/tests/IntegrationTests/Lumina.Plugins.Calibre.IntegrationTests/Core/CalibreArtworkProviderTests.cs +++ b/tests/IntegrationTests/Lumina.Plugins.Calibre.IntegrationTests/Core/CalibreArtworkProviderTests.cs @@ -72,9 +72,9 @@ public class CalibreArtworkProviderTests } [Theory] - [InlineData("../cover.jpg")] // parent directory escape - [InlineData("sub/cover.jpg")] // path with a separator - [InlineData("sub\\cover.jpg")] // path with a backslash separator + [InlineData("../cover.jpg")] // Parent directory escape. + [InlineData("sub/cover.jpg")] // Path with a separator. + [InlineData("sub\\cover.jpg")] // Path with a backslash separator. public async Task GetArtworkAsync_WhenCoverHrefContainsPathTraversalOrSeparators_ShouldReturnNull(string coverHref) { // Arrange diff --git a/tests/IntegrationTests/Lumina.Plugins.ID3.IntegrationTests/Core/Tags/Id3TagReaderTests.cs b/tests/IntegrationTests/Lumina.Plugins.ID3.IntegrationTests/Core/Tags/Id3TagReaderTests.cs index c2510756..4f99ec5e 100644 --- a/tests/IntegrationTests/Lumina.Plugins.ID3.IntegrationTests/Core/Tags/Id3TagReaderTests.cs +++ b/tests/IntegrationTests/Lumina.Plugins.ID3.IntegrationTests/Core/Tags/Id3TagReaderTests.cs @@ -255,9 +255,9 @@ public class Id3TagReaderTests : IDisposable } [Theory] - [InlineData("2011-03-14", 2011)] // a full date yields its year - [InlineData("2011", 2011)] // a bare year is matched by the year pattern - [InlineData("released in 1999 remastered", 1999)] // a year embedded in free form text is still matched + [InlineData("2011-03-14", 2011)] // A full date yields its year. + [InlineData("2011", 2011)] // A bare year is matched by the year pattern. + [InlineData("released in 1999 remastered", 1999)] // A year embedded in free form text is still matched. public void Read_WhenTheReleaseDateIsPresent_ShouldParseTheYear(string releaseDate, int expectedYear) { // Arrange diff --git a/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicAlbumArtworkProviderTests.cs b/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicAlbumArtworkProviderTests.cs index b30fbf7d..c192b243 100644 --- a/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicAlbumArtworkProviderTests.cs +++ b/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicAlbumArtworkProviderTests.cs @@ -217,10 +217,10 @@ public class LocalMusicAlbumArtworkProviderTests : IDisposable } [Theory] - [InlineData(null)] // a null path contributes no artwork - [InlineData("")] // an empty path contributes no artwork - [InlineData(" ")] // a white space path contributes no artwork - [InlineData("track.flac")] // a path without a directory part contributes no artwork + [InlineData(null)] // A null path contributes no artwork. + [InlineData("")] // An empty path contributes no artwork. + [InlineData(" ")] // A white space path contributes no artwork. + [InlineData("track.flac")] // A path without a directory part contributes no artwork. public async Task GetArtworkAsync_WhenTheTrackPathDoesNotPointToADirectory_ShouldReturnEmpty(string? trackPath) { // Arrange diff --git a/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtistArtworkProviderTests.cs b/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtistArtworkProviderTests.cs index a612ec61..9beb6429 100644 --- a/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtistArtworkProviderTests.cs +++ b/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtistArtworkProviderTests.cs @@ -106,10 +106,10 @@ public class LocalMusicArtistArtworkProviderTests : IDisposable } [Theory] - [InlineData(null)] // a null path contributes no artwork - [InlineData("")] // an empty path contributes no artwork - [InlineData(" ")] // a white space path contributes no artwork - [InlineData("track.flac")] // a path without a directory part contributes no artwork + [InlineData(null)] // A null path contributes no artwork. + [InlineData("")] // An empty path contributes no artwork. + [InlineData(" ")] // A white space path contributes no artwork. + [InlineData("track.flac")] // A path without a directory part contributes no artwork. public async Task GetArtworkAsync_WhenTheTrackPathDoesNotPointToADirectory_ShouldReturnEmpty(string? trackPath) { // Arrange diff --git a/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtworkEmbeddedCoverExtractorTests.cs b/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtworkEmbeddedCoverExtractorTests.cs index 8ce06ac6..8b5f020f 100644 --- a/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtworkEmbeddedCoverExtractorTests.cs +++ b/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtworkEmbeddedCoverExtractorTests.cs @@ -68,9 +68,9 @@ public class LocalMusicArtworkEmbeddedCoverExtractorTests : IDisposable } [Theory] - [InlineData(null)] // a null path contributes no cover - [InlineData("")] // an empty path contributes no cover - [InlineData(" ")] // a white space path contributes no cover + [InlineData(null)] // A null path contributes no cover. + [InlineData("")] // An empty path contributes no cover. + [InlineData(" ")] // A white space path contributes no cover. public void Extract_WhenTheTrackPathIsNullOrEmpty_ShouldReturnNull(string? trackPath) { // Act @@ -101,11 +101,11 @@ public class LocalMusicArtworkEmbeddedCoverExtractorTests : IDisposable [InlineData("image/x-ms-bmp", ".bmp")] [InlineData("image/gif", ".gif")] [InlineData("image/tiff", ".tiff")] - [InlineData("IMAGE/PNG", ".png")] // the MIME type is matched without regard to casing - [InlineData(" image/png ", ".png")] // the MIME type is trimmed before it is matched - [InlineData("application/octet-stream", ".jpg")] // an unknown MIME type falls back to the JPEG extension - [InlineData("", ".jpg")] // an empty MIME type falls back to the JPEG extension - [InlineData(null, ".jpg")] // a missing MIME type falls back to the JPEG extension + [InlineData("IMAGE/PNG", ".png")] // The MIME type is matched without regard to casing. + [InlineData(" image/png ", ".png")] // The MIME type is trimmed before it is matched. + [InlineData("application/octet-stream", ".jpg")] // An unknown MIME type falls back to the JPEG extension. + [InlineData("", ".jpg")] // An empty MIME type falls back to the JPEG extension. + [InlineData(null, ".jpg")] // A missing MIME type falls back to the JPEG extension. public void Extract_WhenTheMimeTypeIsProvided_ShouldUseTheMatchingFileExtension(string? mimeType, string expectedExtension) { // Arrange diff --git a/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtworkScannerTests.cs b/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtworkScannerTests.cs index e1a3a25e..c3ce86c9 100644 --- a/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtworkScannerTests.cs +++ b/tests/IntegrationTests/Lumina.Plugins.LocalMusicArtwork.IntegrationTests/Core/LocalMusicArtworkScannerTests.cs @@ -308,10 +308,10 @@ public class LocalMusicArtworkScannerTests : IDisposable } [Theory] - [InlineData(null)] // a null path contributes no artwork - [InlineData("")] // an empty path contributes no artwork - [InlineData(" ")] // a white space path contributes no artwork - [InlineData("track.flac")] // a path without a directory part contributes no artwork + [InlineData(null)] // A null path contributes no artwork. + [InlineData("")] // An empty path contributes no artwork. + [InlineData(" ")] // A white space path contributes no artwork. + [InlineData("track.flac")] // A path without a directory part contributes no artwork. public void ScanAlbumArtwork_WhenTheTrackPathDoesNotPointToADirectory_ShouldReturnEmpty(string? trackPath) { // Act @@ -449,10 +449,10 @@ public class LocalMusicArtworkScannerTests : IDisposable } [Theory] - [InlineData(null)] // a null path contributes no artwork - [InlineData("")] // an empty path contributes no artwork - [InlineData(" ")] // a white space path contributes no artwork - [InlineData("track.flac")] // a path without a directory part contributes no artwork + [InlineData(null)] // A null path contributes no artwork. + [InlineData("")] // An empty path contributes no artwork. + [InlineData(" ")] // A white space path contributes no artwork. + [InlineData("track.flac")] // A path without a directory part contributes no artwork. public void ScanArtistArtwork_WhenTheTrackPathDoesNotPointToADirectory_ShouldReturnEmpty(string? trackPath) { // Act diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/AuthenticatedLuminaApiFactory.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/AuthenticatedLuminaApiFactory.cs index c89d7987..73550cc5 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/AuthenticatedLuminaApiFactory.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/AuthenticatedLuminaApiFactory.cs @@ -45,10 +45,10 @@ public class AuthenticatedLuminaApiFactory : LuminaApiFactory, IDisposable public string? TestUsername { get; private set; } /// - /// Creates an HTTP client with authentication headers and a test user + /// Creates an HTTP client with authentication headers and a test user. /// /// The permissions granted directly to the test user, if any. - /// An HTTP client configured with auth headers + /// An HTTP client configured with auth headers. public async Task CreateAuthenticatedClientAsync(params AuthorizationPermission[] permissions) { HttpClient client = CreateClient(); @@ -101,9 +101,9 @@ public class AuthenticatedLuminaApiFactory : LuminaApiFactory, IDisposable } /// - /// Creates an HTTP client with authentication headers and an admin test user with all permissions + /// Creates an HTTP client with authentication headers and an admin test user with all permissions. /// - /// An HTTP client configured with admin auth headers + /// An HTTP client configured with admin auth headers. public async Task CreateAuthenticatedAdminClientAsync() { HttpClient client = CreateClient(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/LuminaApiFactory.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/LuminaApiFactory.cs index 6930a535..4d793645 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/LuminaApiFactory.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Common/Setup/LuminaApiFactory.cs @@ -38,11 +38,11 @@ public class LuminaApiFactory : WebApplicationFactory, IDisposable /// public LuminaApiFactory() { - // each factory gets its own uniquely named shared in-memory database, so that parallel test classes remain isolated from one another; + // Each factory gets its own uniquely named shared in-memory database, so that parallel test classes remain isolated from one another; // the shared cache allows each DbContext to open its own pooled connection to the same database, instead of sharing a single connection, - // which would otherwise serialize every request on one connection and cause nested transaction errors between requests + // which would otherwise serialize every request on one connection and cause nested transaction errors between requests. _sharedInMemoryConnectionString = string.Format(SHARED_IN_MEMORY_CONNECTION_STRING_PREFIX, Guid.NewGuid()); - // keep a single anchor connection open, so that the shared in-memory database it refers to is not dropped + // Keep a single anchor connection open, so that the shared in-memory database it refers to is not dropped. _connection = new SqliteConnection(_sharedInMemoryConnectionString); _connection.Open(); } @@ -55,14 +55,14 @@ public class LuminaApiFactory : WebApplicationFactory, IDisposable { builder.ConfigureAppConfiguration((context, config) => { - // clear all existing configuration sources + // Clear all existing configuration sources. config.Sources.Clear(); config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); config.AddJsonFile($"appsettings.test.json", optional: true, reloadOnChange: true); config.AddJsonFile("appsettings.shared.json", optional: true, reloadOnChange: true); config.AddJsonFile($"appsettings.shared.test.json", optional: true, reloadOnChange: true); - // First add the test values directly + // First add the test values directly. config.AddInMemoryCollection(initialData: new Dictionary { ["JwtSettings:SecretKey"] = "test-key-thats-at-least-32-chars-long-for-jwt", @@ -70,22 +70,22 @@ public class LuminaApiFactory : WebApplicationFactory, IDisposable ["JwtSettings:Issuer"] = "test-issuer", ["JwtSettings:Audience"] = "test-audience", ["CorsSettings:AllowedOrigins:0"] = "http://localhost:5012", - ["EncryptionSettings:SecretKey"] = TEST_ENCRYPTION_KEY // base64 encoded test key + ["EncryptionSettings:SecretKey"] = TEST_ENCRYPTION_KEY // Base64 encoded test key. }); }); builder.ConfigureServices(services => { - // remove existing DbContext configuration + // Remove existing DbContext configuration. ServiceDescriptor? descriptor = services.SingleOrDefault(serviceDescriptor => serviceDescriptor.ServiceType == typeof(DbContextOptions)); if (descriptor is not null) services.Remove(descriptor); - // add SQLite DbContext configuration + // Add SQLite DbContext configuration. services.AddDbContext((serviceProvider, options) => { options.UseSqlite(_sharedInMemoryConnectionString); options.AddInterceptors(serviceProvider.GetRequiredService()); }); - // configure JWT authentication for testing + // Configure JWT authentication for testing. services.PostConfigure(JwtBearerDefaults.AuthenticationScheme, options => { options.TokenValidationParameters = new TokenValidationParameters @@ -99,7 +99,7 @@ public class LuminaApiFactory : WebApplicationFactory, IDisposable IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes("test-key-thats-at-least-32-chars-long-for-jwt")) }; }); - // build service provider and ensure database is created + // Build service provider and ensure database is created. ServiceProvider servicePreovider = services.BuildServiceProvider(); using (IServiceScope scope = servicePreovider.CreateScope()) { diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissionsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissionsEndpointTests.cs index d3291076..774159aa 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissionsEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissionsEndpointTests.cs @@ -79,7 +79,7 @@ public class GetPermissionsEndpointTests : IClassFixture(); - // clear junction tables first + // Clear junction tables first. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); - // then clear main tables + // Then clear main tables. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs index 7cf488f6..95dea694 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs @@ -173,11 +173,11 @@ public class AddRoleEndpointTests : IClassFixture using IServiceScope scope = _apiFactory.Services.CreateScope(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); - // clear junction tables first + // Clear junction tables first. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); - // then clear main tables + // Then clear main tables. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRoleEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRoleEndpointTests.cs index 9a3606d7..ef4b15f6 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRoleEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRoleEndpointTests.cs @@ -61,7 +61,7 @@ public class DeleteRoleEndpointTests : IClassFixture(); - // Create a test role first + // Create a test role first. RoleEntity role = _roleEntityFixture.Create(roleName: "TestRole"); dbContext.Roles.Add(role); await dbContext.SaveChangesAsync(); @@ -72,7 +72,7 @@ public class DeleteRoleEndpointTests : IClassFixture r.Id == role.Id); Assert.Null(deletedRole); } @@ -177,11 +177,11 @@ public class DeleteRoleEndpointTests : IClassFixture(); - // clear junction tables first + // Clear junction tables first. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); - // then clear main tables + // Then clear main tables. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissionsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissionsEndpointTests.cs index ca8ed7ea..d7d805b7 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissionsEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolePermissionsEndpointTests.cs @@ -89,7 +89,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture(); RoleEntity? role = dbContext.Roles.FirstOrDefault(); @@ -161,11 +161,11 @@ public class GetRolePermissionsEndpointTests : IClassFixture(); - // clear junction tables first + // Clear junction tables first. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); - // then clear main tables + // Then clear main tables. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolesEndpointTests.cs index 4c5c841b..8a6c5029 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolesEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/GetRolesEndpointTests.cs @@ -119,11 +119,11 @@ public class GetRolesEndpointTests : IClassFixture(); - // clear junction tables first + // Clear junction tables first. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); - // then clear main tables + // Then clear main tables. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRoleEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRoleEndpointTests.cs index a7130f4d..ca2714b8 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRoleEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRoleEndpointTests.cs @@ -185,11 +185,11 @@ public class UpdateRoleEndpointTests : IClassFixture(); - // clear junction tables first + // Clear junction tables first. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); - // then clear main tables + // Then clear main tables. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Favorites/AddFavorite/AddFavoriteEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Favorites/AddFavorite/AddFavoriteEndpointTests.cs index e74ccfd6..a0b08928 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Favorites/AddFavorite/AddFavoriteEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Favorites/AddFavorite/AddFavoriteEndpointTests.cs @@ -78,10 +78,10 @@ public class AddFavoriteEndpointTests : IClassFixture(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); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Statistics/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Statistics/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsEndpointTests.cs index 48206f5d..196880a5 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Statistics/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/Statistics/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsEndpointTests.cs @@ -272,9 +272,9 @@ public class GetAllUsersConsumptionStatisticsEndpointTests : IClassFixture 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 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 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 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 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 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: []); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/ApplicationSetup/SetupApplicationEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/ApplicationSetup/SetupApplicationEndpointTests.cs index 9fe63d89..4a42fcff 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/ApplicationSetup/SetupApplicationEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Maintenance/ApplicationSetup/SetupApplicationEndpointTests.cs @@ -93,7 +93,7 @@ public class SetupApplicationEndpointTests : IClassFixture(); - // TODO: update list when defaults change - // verify default permissions + // TODO: update list when defaults change. + // Verify default permissions. List permissions = await dbContext.Permissions.ToListAsync(); Assert.Contains(permissions, p => p.PermissionName == AuthorizationPermission.CanViewUsers); Assert.Contains(permissions, p => p.PermissionName == AuthorizationPermission.CanDeleteUsers); Assert.Contains(permissions, p => p.PermissionName == AuthorizationPermission.CanRegisterUsers); - // verify default roles + // Verify default roles. List roles = await dbContext.Roles.ToListAsync(); RoleEntity? adminRole = roles.FirstOrDefault(r => r.RoleName == "Admin"); Assert.NotNull(adminRole); - // verify admin role permissions + // Verify admin role permissions. List rolePermissions = await dbContext.RolePermissions .Where(rp => rp.RoleId == adminRole!.Id) .ToListAsync(); Assert.NotEmpty(rolePermissions); Assert.Contains(rolePermissions, rp => permissions.Any(p => p.Id == rp.PermissionId)); - // verify user has admin role + // Verify user has admin role. UserRoleEntity? userRole = await dbContext.UserRoles.FirstOrDefaultAsync(ur => ur.UserId == userId && ur.RoleId == adminRole!.Id); Assert.NotNull(userRole); } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs index ad484e92..6ba64a81 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs @@ -176,7 +176,7 @@ public class InstallPluginEndpointTests : IClassFixture(); - // the admin seeding performed by the factory is not idempotent, so the seed data must be cleared between tests + // The admin seeding performed by the factory is not idempotent, so the seed data must be cleared between tests. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/DeleteTheme/DeleteThemeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/DeleteTheme/DeleteThemeEndpointTests.cs index 1ea66b9e..3555bc25 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/DeleteTheme/DeleteThemeEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/DeleteTheme/DeleteThemeEndpointTests.cs @@ -72,12 +72,12 @@ public class DeleteThemeEndpointTests : IClassFixture(); Assert.Null(await dbContext.Themes.FirstOrDefaultAsync(theme => theme.ThemeId == themeId)); - // the theme no longer appears in GET /themes + // The theme no longer appears in GET /themes. HttpResponseMessage listResponse = await _client.GetAsync("/api/v1/themes"); List? themes = await listResponse.Content.ReadFromJsonAsync>(_jsonOptions); Assert.NotNull(themes); @@ -114,11 +114,11 @@ public class DeleteThemeEndpointTests : IClassFixture().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs index 95866a37..711bedf7 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs @@ -86,13 +86,13 @@ public class InstallThemeEndpointTests : IClassFixture? themes = await listResponse.Content.ReadFromJsonAsync>(_jsonOptions); Assert.NotNull(themes); Assert.Contains(themes!, theme => theme.ThemeId == themeId); - // the installed theme is persisted in the database + // The installed theme is persisted in the database. using IServiceScope scope = _apiFactory.Services.CreateScope(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); Assert.NotNull(await dbContext.Themes.FirstOrDefaultAsync(theme => theme.ThemeId == themeId)); @@ -131,7 +131,7 @@ public class InstallThemeEndpointTests : IClassFixture().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/RestoreTheme/RestoreThemeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/RestoreTheme/RestoreThemeEndpointTests.cs index 390d615b..549a7da0 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/RestoreTheme/RestoreThemeEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/RestoreTheme/RestoreThemeEndpointTests.cs @@ -79,7 +79,7 @@ public class RestoreThemeEndpointTests : IClassFixture(); ThemeEntity? restoredTheme = await verificationContext.Themes.FirstOrDefaultAsync(candidate => candidate.ThemeId == "editorial-paper"); @@ -218,7 +218,7 @@ public class RestoreThemeEndpointTests : IClassFixture().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/SetCurrentTheme/SetCurrentThemeEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/SetCurrentTheme/SetCurrentThemeEndpointTests.cs index 2a7b4ca0..e641d59d 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/SetCurrentTheme/SetCurrentThemeEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Management/SetCurrentTheme/SetCurrentThemeEndpointTests.cs @@ -82,7 +82,7 @@ public class SetCurrentThemeEndpointTests : IClassFixture(_jsonOptions); Assert.NotNull(current); @@ -222,7 +222,7 @@ public class SetCurrentThemeEndpointTests : IClassFixture t.ThemeId == "lumina-default"); if (bundledTheme is not null) bundledTheme.IsCurrent = true; @@ -233,7 +233,7 @@ public class SetCurrentThemeEndpointTests : IClassFixture().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Queries/GetThemeAsset/GetThemeAssetEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Queries/GetThemeAsset/GetThemeAssetEndpointTests.cs index 11561162..7b3f140a 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Queries/GetThemeAsset/GetThemeAssetEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Themes/Queries/GetThemeAsset/GetThemeAssetEndpointTests.cs @@ -52,7 +52,7 @@ public class GetThemeAssetEndpointTests : IClassFixture(); - // clear junction tables first + // Clear junction tables first. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); - // then clear main tables + // Then clear main tables. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/LoginEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/LoginEndpointTests.cs index 8524b88d..d20beb32 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/LoginEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/LoginEndpointTests.cs @@ -310,7 +310,7 @@ public class LoginEndpointTests : IClassFixture, UserEntity user = _userEntityFixture.Create(username: _testUsername, password: _hashService.HashString("TestPass123!")); user.TotpSecret = null; user.TempPassword = Uri.EscapeDataString(_hashService.HashString("TempPass123!")); - user.TempPasswordCreated = DateTime.UtcNow.AddMinutes(-16); // expired (> 15 minutes old) + user.TempPasswordCreated = DateTime.UtcNow.AddMinutes(-16); // Expired (> 15 minutes old). dbContext.Users.Add(user); await dbContext.SaveChangesAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/RecoverPasswordEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/RecoverPasswordEndpointTests.cs index ee74e477..6862e99d 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/RecoverPasswordEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/RecoverPasswordEndpointTests.cs @@ -58,7 +58,7 @@ public class RecoverPasswordEndpointTests : IClassFixture(); } @@ -78,7 +78,7 @@ public class RecoverPasswordEndpointTests : IClassFixture(); - // Ensure we get fresh data from the database + // Ensure we get fresh data from the database. verificationContext.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; UserEntity? updatedUser = await verificationContext.Users .AsNoTracking() @@ -244,12 +244,12 @@ public class RecoverPasswordEndpointTests : IClassFixture(); UserEntity userWithoutTotp = _userEntityFixture.Create(username: "userwithoutotp2", password: _hashService.HashString("OldPass123!")); - userWithoutTotp.TotpSecret = null; // No TOTP configured + userWithoutTotp.TotpSecret = null; // No TOTP configured. dbContext.Users.Add(userWithoutTotp); await dbContext.SaveChangesAsync(); } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/GetAuthorizationEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/GetAuthorizationEndpointTests.cs index 6064c214..b09b4ed4 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/GetAuthorizationEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/GetAuthorizationEndpointTests.cs @@ -174,7 +174,7 @@ public class GetAuthorizationEndpointTests : IClassFixture AddRolesAndPermissionsToUser(UserEntity existingUser, LuminaDbContext dbContext) { - // create and save role and permission first + // Create and save role and permission first. RoleEntity adminRole = _roleEntityFixture.Create(roleName: "Admin"); PermissionEntity viewUsersPermission = _permissionEntityFixture.Create(permissionName: AuthorizationPermission.CanViewUsers); @@ -182,21 +182,21 @@ public class GetAuthorizationEndpointTests : IClassFixture(); - // clear junction tables first + // Clear junction tables first. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); - // then clear main tables + // Then clear main tables. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/GetUserRoleEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/GetUserRoleEndpointTests.cs index f7590b88..447ec618 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/GetUserRoleEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/GetUserRoleEndpointTests.cs @@ -156,11 +156,11 @@ public class GetUserRoleEndpointTests : IClassFixture(); - // clear junction tables first + // Clear junction tables first. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); - // then clear main tables + // Then clear main tables. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissionsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissionsEndpointTests.cs index 3e968066..61767ce0 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissionsEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissionsEndpointTests.cs @@ -68,12 +68,12 @@ public class UpdateUserRoleAndPermissionsEndpointTests : IClassFixture(); - // create a non-admin role first + // Create a non-admin role first. RoleEntity editorRole = _roleEntityFixture.Create(roleName: "Editor"); dbContext.Roles.Add(editorRole); await dbContext.SaveChangesAsync(); - // create test user + // Create test user. UserEntity user = _userEntityFixture.Create(username: "TestUser", password: "HashedPassword"); user.TotpSecret = null; dbContext.Users.Add(user); @@ -140,12 +140,12 @@ public class UpdateUserRoleAndPermissionsEndpointTests : IClassFixture(); - // create Editor role + // Create Editor role. RoleEntity editorRole = _roleEntityFixture.Create(roleName: "Editor"); dbContext.Roles.Add(editorRole); await dbContext.SaveChangesAsync(); - // get the admin user that was created by CreateAuthenticatedAdminClientAsync + // Get the admin user that was created by CreateAuthenticatedAdminClientAsync. UserEntity? adminUser = dbContext.Users.FirstOrDefault(u => u.UserRole!.Role.RoleName == "Admin"); Assert.NotNull(adminUser); UpdateUserRoleAndPermissionsRequest request = _updateUserRoleAndPermissionsRequestFixture.Create( @@ -229,11 +229,11 @@ public class UpdateUserRoleAndPermissionsEndpointTests : IClassFixture(); - // clear junction tables first + // Clear junction tables first. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); - // then clear main tables + // Then clear main tables. await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); await dbContext.Set().ExecuteDeleteAsync(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointTests.cs index 35fd307a..d7c12996 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/UsersManagement/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointTests.cs @@ -155,8 +155,8 @@ public class UpdatePlaybackStateEndpointTests : IClassFixture { - // the health check resolves DatabaseHealthCheck from DI when it runs, so replacing its registration with a failing subclass makes /health/ready report Unhealthy + // The health check resolves DatabaseHealthCheck from DI when it runs, so replacing its registration with a failing subclass makes /health/ready report Unhealthy. services.RemoveAll(); services.AddScoped(); }); diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs index 8caf43cf..47adec78 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs @@ -90,10 +90,10 @@ public class GetFavoritesEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("", "users/me/favorites?currentPage=1&perPage=200")] // neither the page nor the size is supplied - [InlineData("?currentPage=3", "users/me/favorites?currentPage=3&perPage=200")] // only the page is supplied - [InlineData("?perPage=25", "users/me/favorites?currentPage=1&perPage=25")] // only the size is supplied - [InlineData("?currentPage=2&perPage=50", "users/me/favorites?currentPage=2&perPage=50")] // both the page and the size are supplied + [InlineData("", "users/me/favorites?currentPage=1&perPage=200")] // Neither the page nor the size is supplied. + [InlineData("?currentPage=3", "users/me/favorites?currentPage=3&perPage=200")] // Only the page is supplied. + [InlineData("?perPage=25", "users/me/favorites?currentPage=1&perPage=25")] // Only the size is supplied. + [InlineData("?currentPage=2&perPage=50", "users/me/favorites?currentPage=2&perPage=50")] // Both the page and the size are supplied. public async Task GetFavorites_WhenCalledWithPagination_ShouldForwardTheDocumentedUpstreamUrl(string queryString, string expectedUpstreamEndpoint) { // Arrange diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeIndexEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeIndexEndpointTests.cs index 598e4ccb..325fa10d 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeIndexEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Home/HomeIndexEndpointTests.cs @@ -73,9 +73,9 @@ public class HomeIndexEndpointTests : IClassFixture } [Theory] - [InlineData("/de-de")] // German culture - [InlineData("/fr-fr")] // French culture - [InlineData("/ja-jp")] // Japanese culture + [InlineData("/de-de")] // German culture. + [InlineData("/fr-fr")] // French culture. + [InlineData("/ja-jp")] // Japanese culture. public async Task Home_WhenCalledByAuthenticatedUserWithLocalizedCulture_ShouldReturnHomePage(string culturePath) { // Arrange diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetPlaybackManifest/GetPlaybackManifestEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetPlaybackManifest/GetPlaybackManifestEndpointTests.cs index 3cad3434..d5cbc541 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetPlaybackManifest/GetPlaybackManifestEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetPlaybackManifest/GetPlaybackManifestEndpointTests.cs @@ -150,8 +150,8 @@ public class GetPlaybackManifestEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetPlaybackManifest_WithSQLInjectionInRouteId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousId) { // Arrange diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrack/StreamMusicTrackEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrack/StreamMusicTrackEndpointTests.cs index c4f6c1b7..f8da003f 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrack/StreamMusicTrackEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrack/StreamMusicTrackEndpointTests.cs @@ -100,8 +100,8 @@ public class StreamMusicTrackEndpointTests : IClassFixture } [Theory] - [InlineData(HttpStatusCode.ServiceUnavailable)] // a busy normalization pipeline is a transient condition - [InlineData(HttpStatusCode.TooManyRequests)] // the stream concurrency limit was reached + [InlineData(HttpStatusCode.ServiceUnavailable)] // A busy normalization pipeline is a transient condition. + [InlineData(HttpStatusCode.TooManyRequests)] // The stream concurrency limit was reached. public async Task StreamMusicTrack_WhenApiReportsATransientCondition_ShouldReturnABareStatus(HttpStatusCode statusCode) { // Arrange @@ -131,8 +131,8 @@ public class StreamMusicTrackEndpointTests : IClassFixture } [Theory] - [InlineData(HttpStatusCode.ServiceUnavailable)] // a busy normalization pipeline is a transient condition - [InlineData(HttpStatusCode.TooManyRequests)] // the stream concurrency limit was reached + [InlineData(HttpStatusCode.ServiceUnavailable)] // A busy normalization pipeline is a transient condition. + [InlineData(HttpStatusCode.TooManyRequests)] // The stream concurrency limit was reached. public async Task StreamMusicTrack_WhenApiReportsATransientConditionForANonMediaCaller_ShouldStillReturnABareStatus(HttpStatusCode statusCode) { // Arrange diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrackSegment/StreamMusicTrackSegmentEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrackSegment/StreamMusicTrackSegmentEndpointTests.cs index d2396887..55df7172 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrackSegment/StreamMusicTrackSegmentEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrackSegment/StreamMusicTrackSegmentEndpointTests.cs @@ -91,8 +91,8 @@ public class StreamMusicTrackSegmentEndpointTests : IClassFixture public async Task LibrariesIndexView_WhenRenderedInACultureWithNonAsciiLabels_ShouldInjectTheScriptLabelsAsJson() { // Arrange - // Razor would encode the non-ASCII letters of a raw label as HTML entities, which the browser shows literally inside a script, while JSON escapes them + // Razor would encode the non-ASCII letters of a raw label as HTML entities, which the browser shows literally inside a script, while JSON escapes them. _apiFactory.ApiClientStub.Reset(); AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs index 2ed16460..813b4ab4 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs @@ -205,9 +205,9 @@ public class GetResumePointEndpointTests : IClassFixture } [Theory] - [InlineData("MediaResumePointNotFound")] // the user has no resume point for the media item - [InlineData("BookNotFound")] // the book of the resume point no longer exists - [InlineData("TrackNotFound")] // the track of the resume point no longer exists + [InlineData("MediaResumePointNotFound")] // The user has no resume point for the media item. + [InlineData("BookNotFound")] // The book of the resume point no longer exists. + [InlineData("TrackNotFound")] // The track of the resume point no longer exists. public async Task GetResumePoint_WhenApiReportsAnAbsentResumePoint_ShouldReturnSuccessWithNullData(string detail) { // Arrange diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpointTests.cs index 17e00d1f..2237e0c6 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpointTests.cs @@ -44,9 +44,9 @@ public class LoginViewEndpointTests : IClassFixture } [Theory] - [InlineData("/de-de/auth/login")] // German culture - [InlineData("/fr-fr/auth/login")] // French culture - [InlineData("/zh-cn/auth/login")] // Chinese culture + [InlineData("/de-de/auth/login")] // German culture. + [InlineData("/fr-fr/auth/login")] // French culture. + [InlineData("/zh-cn/auth/login")] // Chinese culture. public async Task LoginView_WhenCalledWithLocalizedCulture_ShouldRenderLoginPage(string culturePath) { // Arrange diff --git a/tests/SecurityTests/Lumina.Plugins.Calibre.SecurityTests/Core/CalibreArtworkProviderSecurityTests.cs b/tests/SecurityTests/Lumina.Plugins.Calibre.SecurityTests/Core/CalibreArtworkProviderSecurityTests.cs index 442ee77f..7a46448b 100644 --- a/tests/SecurityTests/Lumina.Plugins.Calibre.SecurityTests/Core/CalibreArtworkProviderSecurityTests.cs +++ b/tests/SecurityTests/Lumina.Plugins.Calibre.SecurityTests/Core/CalibreArtworkProviderSecurityTests.cs @@ -47,14 +47,14 @@ public class CalibreArtworkProviderSecurityTests } [Theory] - [InlineData("../cover.jpg")] // parent directory escape - [InlineData("../../cover.jpg")] // multiple parent directory escape - [InlineData("sub/cover.jpg")] // forward slash path traversal - [InlineData("sub\\cover.jpg")] // backslash path traversal - [InlineData(@"C:\Windows\System32\drivers\etc\hosts")] // absolute Windows path - [InlineData("/etc/passwd")] // absolute Unix path - [InlineData("http://evil.example/cover.jpg")] // remote URL - [InlineData("file:///etc/passwd")] // file URI + [InlineData("../cover.jpg")] // Parent directory escape. + [InlineData("../../cover.jpg")] // Multiple parent directory escape. + [InlineData("sub/cover.jpg")] // Forward slash path traversal. + [InlineData("sub\\cover.jpg")] // Backslash path traversal. + [InlineData(@"C:\Windows\System32\drivers\etc\hosts")] // Absolute Windows path. + [InlineData("/etc/passwd")] // Absolute Unix path. + [InlineData("http://evil.example/cover.jpg")] // Remote URL. + [InlineData("file:///etc/passwd")] // File URI. public async Task GetArtworkAsync_WhenCoverHrefEscapesTheBookDirectory_ShouldReturnNull(string coverHref) { // Arrange diff --git a/tests/SecurityTests/Lumina.Plugins.Calibre.SecurityTests/Core/Opf/OpfReaderSecurityTests.cs b/tests/SecurityTests/Lumina.Plugins.Calibre.SecurityTests/Core/Opf/OpfReaderSecurityTests.cs index 20904f19..eb2572f2 100644 --- a/tests/SecurityTests/Lumina.Plugins.Calibre.SecurityTests/Core/Opf/OpfReaderSecurityTests.cs +++ b/tests/SecurityTests/Lumina.Plugins.Calibre.SecurityTests/Core/Opf/OpfReaderSecurityTests.cs @@ -111,7 +111,7 @@ public class OpfReaderSecurityTests MetadataDto? result = await provider.GetMetadataAsync(_bookMetadataLookupDtoFixture.Create(path: bookPath), CancellationToken.None); // Assert - // a malformed OPF must be swallowed and must not leak an exception to the caller + // A malformed OPF must be swallowed and must not leak an exception to the caller. Assert.NotNull(result); Assert.Null(((BookMetadataDto)result!).Title); } diff --git a/tests/SecurityTests/Lumina.Plugins.CoverArtArchive.SecurityTests/Core/Api/CoverArtArchiveHttpClientSecurityTests.cs b/tests/SecurityTests/Lumina.Plugins.CoverArtArchive.SecurityTests/Core/Api/CoverArtArchiveHttpClientSecurityTests.cs index 6b2dcf25..77fd4d41 100644 --- a/tests/SecurityTests/Lumina.Plugins.CoverArtArchive.SecurityTests/Core/Api/CoverArtArchiveHttpClientSecurityTests.cs +++ b/tests/SecurityTests/Lumina.Plugins.CoverArtArchive.SecurityTests/Core/Api/CoverArtArchiveHttpClientSecurityTests.cs @@ -28,13 +28,13 @@ public class CoverArtArchiveHttpClientSecurityTests private readonly CoverArtArchiveSettingsDtoFixture _coverArtArchiveSettingsDtoFixture = new(); [Theory] - [InlineData("https://evil.example/index.json")] // an unrelated public host - [InlineData("https://localhost/index.json")] // the loopback host name - [InlineData("https://127.0.0.1/index.json")] // the IPv4 loopback address - [InlineData("https://169.254.169.254/latest/meta-data/")] // the link local cloud metadata endpoint - [InlineData("https://10.0.0.5/index.json")] // a private class A address - [InlineData("https://192.168.1.10/index.json")] // a private class C address - [InlineData("https://coverartarchive.org.evil.example/index.json")] // the trusted host used as a prefix of an attacker controlled host + [InlineData("https://evil.example/index.json")] // An unrelated public host. + [InlineData("https://localhost/index.json")] // The loopback host name. + [InlineData("https://127.0.0.1/index.json")] // The IPv4 loopback address. + [InlineData("https://169.254.169.254/latest/meta-data/")] // The link local cloud metadata endpoint. + [InlineData("https://10.0.0.5/index.json")] // A private class A address. + [InlineData("https://192.168.1.10/index.json")] // A private class C address. + [InlineData("https://coverartarchive.org.evil.example/index.json")] // The trusted host used as a prefix of an attacker controlled host. public async Task GetReleaseArtworkAsync_WhenTheRedirectPointsAtADisallowedHost_ShouldThrowAndNotReachIt(string location) { // Arrange @@ -59,8 +59,8 @@ public class CoverArtArchiveHttpClientSecurityTests } [Theory] - [InlineData("http://archive.org/index.json")] // a downgrade of the Internet Archive to plain HTTP - [InlineData("http://coverartarchive.org/index.json")] // a downgrade of the Cover Art Archive to plain HTTP + [InlineData("http://archive.org/index.json")] // A downgrade of the Internet Archive to plain HTTP. + [InlineData("http://coverartarchive.org/index.json")] // A downgrade of the Cover Art Archive to plain HTTP. public async Task GetReleaseArtworkAsync_WhenTheRedirectDowngradesToPlainHttp_ShouldThrow(string location) { // Arrange @@ -83,8 +83,8 @@ public class CoverArtArchiveHttpClientSecurityTests } [Theory] - [InlineData("user@example.com\r\nX-Injected: value")] // carriage return and line feed header injection - [InlineData("user@example.com\nX-Injected: value")] // line feed header injection + [InlineData("user@example.com\r\nX-Injected: value")] // Carriage return and line feed header injection. + [InlineData("user@example.com\nX-Injected: value")] // Line feed header injection. public async Task GetReleaseArtworkAsync_WhenThePersistedContactEmailAttemptsHeaderInjection_ShouldNotInjectAnyHeader(string maliciousEmail) { // Arrange diff --git a/tests/SecurityTests/Lumina.Plugins.CoverArtArchive.SecurityTests/Core/Mapping/CoverArtArchiveMapperSecurityTests.cs b/tests/SecurityTests/Lumina.Plugins.CoverArtArchive.SecurityTests/Core/Mapping/CoverArtArchiveMapperSecurityTests.cs index 7ade7a53..80712ea7 100644 --- a/tests/SecurityTests/Lumina.Plugins.CoverArtArchive.SecurityTests/Core/Mapping/CoverArtArchiveMapperSecurityTests.cs +++ b/tests/SecurityTests/Lumina.Plugins.CoverArtArchive.SecurityTests/Core/Mapping/CoverArtArchiveMapperSecurityTests.cs @@ -19,18 +19,18 @@ public class CoverArtArchiveMapperSecurityTests private readonly CoverArtArchiveImageResponseFixture _coverArtArchiveImageResponseFixture = new(); [Theory] - [InlineData("http://169.254.169.254/latest/meta-data/")] // the link local cloud metadata endpoint - [InlineData("http://localhost/admin")] // the loopback host name - [InlineData("http://127.0.0.1/admin")] // the IPv4 loopback address - [InlineData("http://[::1]/admin")] // the IPv6 loopback address - [InlineData("http://10.0.0.5/internal")] // a private class A address - [InlineData("http://172.16.0.1/internal")] // a private class B address - [InlineData("http://192.168.1.10/internal")] // a private class C address - [InlineData("http://0.0.0.0/internal")] // the unspecified address - [InlineData("http://[fc00::1]/internal")] // the IPv6 unique local range - [InlineData("https://evil.example/tracker.jpg")] // an unrelated public host - [InlineData("https://coverartarchive.org.evil.example/1.jpg")] // the trusted host used as a prefix of an attacker controlled host - [InlineData("https://archive.org.evil.example/1.jpg")] // the Internet Archive host used as a prefix of an attacker controlled host + [InlineData("http://169.254.169.254/latest/meta-data/")] // The link local cloud metadata endpoint. + [InlineData("http://localhost/admin")] // The loopback host name. + [InlineData("http://127.0.0.1/admin")] // The IPv4 loopback address. + [InlineData("http://[::1]/admin")] // The IPv6 loopback address. + [InlineData("http://10.0.0.5/internal")] // A private class A address. + [InlineData("http://172.16.0.1/internal")] // A private class B address. + [InlineData("http://192.168.1.10/internal")] // A private class C address. + [InlineData("http://0.0.0.0/internal")] // The unspecified address. + [InlineData("http://[fc00::1]/internal")] // The IPv6 unique local range. + [InlineData("https://evil.example/tracker.jpg")] // An unrelated public host. + [InlineData("https://coverartarchive.org.evil.example/1.jpg")] // The trusted host used as a prefix of an attacker controlled host. + [InlineData("https://archive.org.evil.example/1.jpg")] // The Internet Archive host used as a prefix of an attacker controlled host. public void MapArtwork_WhenAnImageUrlPointsAtAnInternalOrUntrustedHost_ShouldDropIt(string maliciousUrl) { // Arrange @@ -45,10 +45,10 @@ public class CoverArtArchiveMapperSecurityTests } [Theory] - [InlineData("file:///etc/passwd")] // a local file URI - [InlineData("ftp://coverartarchive.org/1.jpg")] // a non web scheme - [InlineData("javascript:alert(1)")] // a script scheme - [InlineData("data:image/png;base64,SGVsbG8=")] // an inline data URI + [InlineData("file:///etc/passwd")] // A local file URI. + [InlineData("ftp://coverartarchive.org/1.jpg")] // A non web scheme. + [InlineData("javascript:alert(1)")] // A script scheme. + [InlineData("data:image/png;base64,SGVsbG8=")] // An inline data URI. public void MapArtwork_WhenAnImageUrlUsesAnUnsupportedScheme_ShouldDropIt(string maliciousUrl) { // Arrange @@ -63,8 +63,8 @@ public class CoverArtArchiveMapperSecurityTests } [Theory] - [InlineData("https://coverartarchive.org/release/11111111-1111-1111-1111-111111111111/front.jpg")] // a trusted Cover Art Archive image - [InlineData("https://archive.org/download/mbid-11111111-1111-1111-1111-111111111111/front.jpg")] // a trusted Internet Archive image + [InlineData("https://coverartarchive.org/release/11111111-1111-1111-1111-111111111111/front.jpg")] // A trusted Cover Art Archive image. + [InlineData("https://archive.org/download/mbid-11111111-1111-1111-1111-111111111111/front.jpg")] // A trusted Internet Archive image. public void MapArtwork_WhenAnImageUrlPointsAtATrustedHostOverHttps_ShouldKeepIt(string trustedUrl) { // Arrange diff --git a/tests/SecurityTests/Lumina.Plugins.MusicBrainz.SecurityTests/Core/Api/MusicBrainzHttpClientSecurityTests.cs b/tests/SecurityTests/Lumina.Plugins.MusicBrainz.SecurityTests/Core/Api/MusicBrainzHttpClientSecurityTests.cs index 9a259e73..674cccde 100644 --- a/tests/SecurityTests/Lumina.Plugins.MusicBrainz.SecurityTests/Core/Api/MusicBrainzHttpClientSecurityTests.cs +++ b/tests/SecurityTests/Lumina.Plugins.MusicBrainz.SecurityTests/Core/Api/MusicBrainzHttpClientSecurityTests.cs @@ -24,12 +24,12 @@ public class MusicBrainzHttpClientSecurityTests private readonly MusicBrainzSettingsDtoFixture _musicBrainzSettingsDtoFixture = new(); [Theory] - [InlineData("A & B")] // ampersand query separator - [InlineData("Title #fragment")] // fragment separator - [InlineData("A?B")] // query separator - [InlineData("../../secret")] // path traversal - [InlineData("A\" OR \"B")] // quote escape - [InlineData("A\0B")] // null byte truncation + [InlineData("A & B")] // Ampersand query separator. + [InlineData("Title #fragment")] // Fragment separator. + [InlineData("A?B")] // Query separator. + [InlineData("../../secret")] // Path traversal. + [InlineData("A\" OR \"B")] // Quote escape. + [InlineData("A\0B")] // Null byte truncation. public async Task SearchArtistsAsync_WhenTheQueryContainsInjectionCharacters_ShouldNotAlterTheRequestTarget(string maliciousQuery) { // Arrange @@ -47,9 +47,9 @@ public class MusicBrainzHttpClientSecurityTests } [Theory] - [InlineData("../release/secret")] // path traversal - [InlineData("A&B")] // query separator - [InlineData("A#B")] // fragment separator + [InlineData("../release/secret")] // Path traversal. + [InlineData("A&B")] // Query separator. + [InlineData("A#B")] // Fragment separator. public async Task GetRecordingsByIsrcAsync_WhenTheIsrcContainsInjectionCharacters_ShouldNotAlterTheRequestTarget(string maliciousIsrc) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs index a8daf85c..7efe71ea 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/AddRoleEndpointTests.cs @@ -71,8 +71,8 @@ public class AddRoleEndpointTests : IClassFixture, IAsyncDispo } [Theory] - [InlineData("'; DROP TABLE Roles--")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Roles--")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task AddRole_WithSQLInjectionInRoleName_ShouldNotCorruptOrDeleteData(string maliciousRoleName) { // Arrange @@ -97,8 +97,8 @@ public class AddRoleEndpointTests : IClassFixture, IAsyncDispo HttpResponseMessage response = await client.PostAsync("/api/v1/auth/roles", content); // Assert - // the malicious role name passes the authenticated handler and the permissions validation, reaches the - // parameterized insert, and is persisted verbatim: if it were concatenated into raw SQL, the insert would fail + // The malicious role name passes the authenticated handler and the permissions validation, reaches the + // parameterized insert, and is persisted verbatim: if it were concatenated into raw SQL, the insert would fail. Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.DoesNotContain("SqliteException", await response.Content.ReadAsStringAsync(), StringComparison.OrdinalIgnoreCase); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRoleEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRoleEndpointTests.cs index bb93e13b..6b3dd80b 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRoleEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRoleEndpointTests.cs @@ -80,8 +80,8 @@ public class UpdateRoleEndpointTests : IClassFixture, IAsyncDi } [Theory] - [InlineData("'; DROP TABLE Roles--")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Roles--")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateRole_WithSQLInjectionInRoleName_ShouldNotCorruptOrDeleteData(string maliciousRoleName) { // Arrange @@ -108,8 +108,8 @@ public class UpdateRoleEndpointTests : IClassFixture, IAsyncDi HttpResponseMessage response = await client.PutAsync("/api/v1/auth/roles", content); // Assert - // the malicious role name passes the authenticated handler and the permissions validation, reaches the - // parameterized update, and is persisted verbatim: if it were concatenated into raw SQL, the update would fail + // The malicious role name passes the authenticated handler and the permissions validation, reaches the + // parameterized update, and is persisted verbatim: if it were concatenated into raw SQL, the update would fail. Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.DoesNotContain("SqliteException", await response.Content.ReadAsStringAsync(), StringComparison.OrdinalIgnoreCase); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/AddFavorite/AddFavoriteEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/AddFavorite/AddFavoriteEndpointTests.cs index fcebb3ee..968c8d43 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/AddFavorite/AddFavoriteEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/AddFavorite/AddFavoriteEndpointTests.cs @@ -81,12 +81,12 @@ public class AddFavoriteEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("1; DELETE FROM Favorites")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("1; DELETE FROM Favorites")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task AddFavorite_WithInjectionInMediaKind_ShouldRejectWithoutLeakingOrChangingData(string maliciousMediaKind) { // Arrange @@ -102,12 +102,12 @@ public class AddFavoriteEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("1; DELETE FROM Favorites")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("1; DELETE FROM Favorites")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task AddFavorite_WithInjectionInMediaItemId_ShouldRejectWithoutLeakingOrChangingData(string maliciousMediaItemId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/GetFavoriteStatus/GetFavoriteStatusEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/GetFavoriteStatus/GetFavoriteStatusEndpointTests.cs index 8ac6b144..24264489 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/GetFavoriteStatus/GetFavoriteStatusEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/GetFavoriteStatus/GetFavoriteStatusEndpointTests.cs @@ -69,12 +69,12 @@ public class GetFavoriteStatusEndpointTests : IClassFixture, I } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("1; DELETE FROM Favorites")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("1; DELETE FROM Favorites")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task GetFavoriteStatus_WithInjectionInMediaKind_ShouldRejectWithoutLeakingOrChangingData(string maliciousMediaKind) { // Arrange @@ -93,12 +93,12 @@ public class GetFavoriteStatusEndpointTests : IClassFixture, I } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("1; DELETE FROM Favorites")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("1; DELETE FROM Favorites")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task GetFavoriteStatus_WithInjectionInMediaItemIds_ShouldRejectWithoutLeakingOrChangingData(string maliciousMediaItemId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs index 6ddc70da..176923db 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs @@ -68,12 +68,12 @@ public class GetFavoritesEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("1; DELETE FROM Favorites")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("1; DELETE FROM Favorites")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task GetFavorites_WithInjectionInMediaKind_ShouldRejectWithoutLeakingOrChangingData(string maliciousMediaKind) { // Arrange @@ -92,11 +92,11 @@ public class GetFavoritesEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("1; DELETE FROM Favorites")] // stacked statement injection - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("1; DELETE FROM Favorites")] // Stacked statement injection. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task GetFavorites_WithInjectionInCurrentPage_ShouldRejectWithoutLeakingOrChangingData(string maliciousCurrentPage) { // Arrange @@ -115,11 +115,11 @@ public class GetFavoritesEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("1; DELETE FROM Favorites")] // stacked statement injection - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("1; DELETE FROM Favorites")] // Stacked statement injection. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task GetFavorites_WithInjectionInPerPage_ShouldRejectWithoutLeakingOrChangingData(string maliciousPerPage) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs index 4e7fe498..3d1aaf91 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs @@ -63,12 +63,12 @@ public class RemoveFavoriteEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("1; DELETE FROM Favorites")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("1; DELETE FROM Favorites")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task RemoveFavorite_WithInjectionInMediaKind_ShouldRejectWithoutLeakingOrChangingData(string maliciousMediaKind) { // Arrange @@ -88,12 +88,12 @@ public class RemoveFavoriteEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("1; DELETE FROM Favorites")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("1; DELETE FROM Favorites")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task RemoveFavorite_WithInjectionInMediaItemId_ShouldRejectWithoutLeakingOrChangingData(string maliciousMediaItemId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs index efa5fbb0..328675c9 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs @@ -97,9 +97,9 @@ public class AddAlbumEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task AddAlbum_WithSQLInjectionInRouteId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -123,9 +123,9 @@ public class AddAlbumEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task AddAlbum_WithSQLInjectionInArtistRouteId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange @@ -149,8 +149,8 @@ public class AddAlbumEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task AddAlbum_WithSQLInjectionInBody_ShouldNotCorruptOrDeleteData(string maliciousTitle) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteAlbum/DeleteAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteAlbum/DeleteAlbumEndpointTests.cs index 3ce42949..0c7693c5 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteAlbum/DeleteAlbumEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteAlbum/DeleteAlbumEndpointTests.cs @@ -75,9 +75,9 @@ public class DeleteAlbumEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task DeleteAlbum_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -99,9 +99,9 @@ public class DeleteAlbumEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task DeleteAlbum_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange @@ -123,9 +123,9 @@ public class DeleteAlbumEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task DeleteAlbum_WithSQLInjectionInAlbumId_ShouldNotCorruptOrLeakData(string maliciousAlbumId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbum/GetAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbum/GetAlbumEndpointTests.cs index 29503bcf..43e8a70c 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbum/GetAlbumEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbum/GetAlbumEndpointTests.cs @@ -73,9 +73,9 @@ public class GetAlbumEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetAlbum_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -97,9 +97,9 @@ public class GetAlbumEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetAlbum_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange @@ -121,9 +121,9 @@ public class GetAlbumEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetAlbum_WithSQLInjectionInAlbumId_ShouldNotCorruptOrLeakData(string maliciousAlbumId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracks/GetAlbumTracksEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracks/GetAlbumTracksEndpointTests.cs index 1506e1fd..06ded44a 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracks/GetAlbumTracksEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracks/GetAlbumTracksEndpointTests.cs @@ -74,9 +74,9 @@ public class GetAlbumTracksEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetAlbumTracks_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -98,9 +98,9 @@ public class GetAlbumTracksEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetAlbumTracks_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange @@ -122,9 +122,9 @@ public class GetAlbumTracksEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetAlbumTracks_WithSQLInjectionInAlbumId_ShouldNotCorruptOrLeakData(string maliciousAlbumId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointTests.cs index 0aaa8260..a0e85417 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointTests.cs @@ -74,9 +74,9 @@ public class GetAlbumTracksLiteEndpointTests : IClassFixture, } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetAlbumTracksLite_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -98,9 +98,9 @@ public class GetAlbumTracksLiteEndpointTests : IClassFixture, } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetAlbumTracksLite_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange @@ -122,9 +122,9 @@ public class GetAlbumTracksLiteEndpointTests : IClassFixture, } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetAlbumTracksLite_WithSQLInjectionInAlbumId_ShouldNotCorruptOrLeakData(string maliciousAlbumId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetDeletedAlbums/GetDeletedAlbumsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetDeletedAlbums/GetDeletedAlbumsEndpointTests.cs index 0a18409c..8080e699 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetDeletedAlbums/GetDeletedAlbumsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetDeletedAlbums/GetDeletedAlbumsEndpointTests.cs @@ -64,9 +64,9 @@ public class GetDeletedAlbumsEndpointTests : IClassFixture, ID } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetDeletedAlbums_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/RestoreAlbum/RestoreAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/RestoreAlbum/RestoreAlbumEndpointTests.cs index 6a663051..30145f0d 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/RestoreAlbum/RestoreAlbumEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/RestoreAlbum/RestoreAlbumEndpointTests.cs @@ -63,9 +63,9 @@ public class RestoreAlbumEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task RestoreAlbum_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -81,9 +81,9 @@ public class RestoreAlbumEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task RestoreAlbum_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange @@ -99,9 +99,9 @@ public class RestoreAlbumEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task RestoreAlbum_WithSQLInjectionInAlbumId_ShouldNotCorruptOrLeakData(string maliciousAlbumId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs index 22bec8c6..fa49ee16 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs @@ -95,8 +95,8 @@ public class UpdateAlbumEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateAlbum_WithSQLInjectionInBody_ShouldNotCorruptOrLeakData(string maliciousTitle) { // Arrange @@ -123,8 +123,8 @@ public class UpdateAlbumEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateAlbum_WithSQLInjectionInLibraryRouteId_ShouldRemainSecure(string maliciousLibraryId) { // Arrange @@ -141,8 +141,8 @@ public class UpdateAlbumEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateAlbum_WithSQLInjectionInArtistRouteId_ShouldRemainSecure(string maliciousArtistId) { // Arrange @@ -159,8 +159,8 @@ public class UpdateAlbumEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateAlbum_WithSQLInjectionInAlbumRouteId_ShouldRemainSecure(string maliciousAlbumId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs index 9f30b955..9f18328d 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs @@ -91,8 +91,8 @@ public class UpdateAlbumCoverEndpointTests : IClassFixture, ID } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateAlbumCover_WithSQLInjectionInLibraryRouteId_ShouldRemainSecure(string maliciousLibraryId) { // Arrange @@ -109,8 +109,8 @@ public class UpdateAlbumCoverEndpointTests : IClassFixture, ID } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateAlbumCover_WithSQLInjectionInArtistRouteId_ShouldRemainSecure(string maliciousArtistId) { // Arrange @@ -127,8 +127,8 @@ public class UpdateAlbumCoverEndpointTests : IClassFixture, ID } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateAlbumCover_WithSQLInjectionInAlbumRouteId_ShouldRemainSecure(string maliciousAlbumId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs index 23cf6b48..9f377081 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs @@ -97,9 +97,9 @@ public class AddArtistEndpointTests : IClassFixture, IDisposab } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task AddArtist_WithSQLInjectionInRouteId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -123,8 +123,8 @@ public class AddArtistEndpointTests : IClassFixture, IDisposab } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task AddArtist_WithSQLInjectionInBody_ShouldNotCorruptOrDeleteData(string maliciousName) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteArtist/DeleteArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteArtist/DeleteArtistEndpointTests.cs index 0630b67e..34d2f146 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteArtist/DeleteArtistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteArtist/DeleteArtistEndpointTests.cs @@ -74,9 +74,9 @@ public class DeleteArtistEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task DeleteArtist_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -98,9 +98,9 @@ public class DeleteArtistEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task DeleteArtist_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtist/GetArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtist/GetArtistEndpointTests.cs index 1c576572..743ecf7c 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtist/GetArtistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtist/GetArtistEndpointTests.cs @@ -72,9 +72,9 @@ public class GetArtistEndpointTests : IClassFixture, IDisposab } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetArtist_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -96,9 +96,9 @@ public class GetArtistEndpointTests : IClassFixture, IDisposab } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetArtist_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs index 49dcd05c..65ef51df 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs @@ -72,9 +72,9 @@ public class GetArtistAlbumsEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetArtistAlbums_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -96,9 +96,9 @@ public class GetArtistAlbumsEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetArtistAlbums_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointTests.cs index 1c681ab4..b28cb5bb 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointTests.cs @@ -72,9 +72,9 @@ public class GetArtistAlbumsLiteEndpointTests : IClassFixture, } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetArtistAlbumsLite_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -96,9 +96,9 @@ public class GetArtistAlbumsLiteEndpointTests : IClassFixture, } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetArtistAlbumsLite_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtists/GetArtistsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtists/GetArtistsEndpointTests.cs index fa05b321..8b9a3dfa 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtists/GetArtistsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtists/GetArtistsEndpointTests.cs @@ -70,8 +70,8 @@ public class GetArtistsEndpointTests : IClassFixture, IDisposa } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetArtists_WhenSearchTermContainsSqlInjection_ShouldNotCorruptOrDeleteData(string maliciousSearchTerm) { // Arrange @@ -89,7 +89,7 @@ public class GetArtistsEndpointTests : IClassFixture, IDisposa Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); Assert.DoesNotContain(maliciousSearchTerm, content, StringComparison.Ordinal); - // the injected statement must never be executed: the Artists table and the seeded rows must still be there + // The injected statement must never be executed: the Artists table and the seeded rows must still be there. using IServiceScope scope = _apiFactory.Services.CreateScope(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); Assert.Equal(1, await dbContext.Artists.CountAsync(artist => artist.LibraryId == libraryId)); @@ -97,9 +97,9 @@ public class GetArtistsEndpointTests : IClassFixture, IDisposa } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetArtists_WithSQLInjectionInRouteId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointTests.cs index ec5ae14e..f40cb24a 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointTests.cs @@ -70,8 +70,8 @@ public class GetArtistsLiteEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetArtistsLite_WhenSearchTermContainsSqlInjection_ShouldNotCorruptOrDeleteData(string maliciousSearchTerm) { // Arrange @@ -89,7 +89,7 @@ public class GetArtistsLiteEndpointTests : IClassFixture, IDis Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); Assert.DoesNotContain(maliciousSearchTerm, content, StringComparison.Ordinal); - // the injected statement must never be executed: the Artists table and the seeded rows must still be there + // The injected statement must never be executed: the Artists table and the seeded rows must still be there. using IServiceScope scope = _apiFactory.Services.CreateScope(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); Assert.Equal(1, await dbContext.Artists.CountAsync(artist => artist.LibraryId == libraryId)); @@ -97,9 +97,9 @@ public class GetArtistsLiteEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetArtistsLite_WithSQLInjectionInRouteId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetDeletedArtists/GetDeletedArtistsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetDeletedArtists/GetDeletedArtistsEndpointTests.cs index 2ce9e4ec..ab87ee31 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetDeletedArtists/GetDeletedArtistsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetDeletedArtists/GetDeletedArtistsEndpointTests.cs @@ -63,9 +63,9 @@ public class GetDeletedArtistsEndpointTests : IClassFixture, I } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetDeletedArtists_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/RestoreArtist/RestoreArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/RestoreArtist/RestoreArtistEndpointTests.cs index 89af99f8..320a8056 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/RestoreArtist/RestoreArtistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/RestoreArtist/RestoreArtistEndpointTests.cs @@ -62,9 +62,9 @@ public class RestoreArtistEndpointTests : IClassFixture, IDisp } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task RestoreArtist_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -85,9 +85,9 @@ public class RestoreArtistEndpointTests : IClassFixture, IDisp } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task RestoreArtist_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs index c73a891b..e55f2155 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs @@ -96,8 +96,8 @@ public class UpdateArtistEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateArtist_WithSQLInjectionInBody_ShouldNotCorruptOrLeakData(string maliciousName) { // Arrange @@ -131,8 +131,8 @@ public class UpdateArtistEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateArtist_WithSQLInjectionInLibraryRouteId_ShouldRemainSecure(string maliciousLibraryId) { // Arrange @@ -149,8 +149,8 @@ public class UpdateArtistEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateArtist_WithSQLInjectionInArtistRouteId_ShouldRemainSecure(string maliciousArtistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs index dab067a8..94f130b6 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs @@ -89,8 +89,8 @@ public class UpdateArtistCoverEndpointTests : IClassFixture, I } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateArtistCover_WithSQLInjectionInLibraryRouteId_ShouldRemainSecure(string maliciousLibraryId) { // Arrange @@ -107,8 +107,8 @@ public class UpdateArtistCoverEndpointTests : IClassFixture, I } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateArtistCover_WithSQLInjectionInArtistRouteId_ShouldRemainSecure(string maliciousArtistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs index a8653851..70d5720f 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs @@ -169,8 +169,8 @@ public class AddTrackEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task AddTrack_WithSQLInjectionInPath_ShouldNotCorruptOrDeleteData(string maliciousPath) { // Arrange @@ -198,8 +198,8 @@ public class AddTrackEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task AddTrack_WithSQLInjectionInBody_ShouldNotCorruptOrDeleteData(string maliciousTitle) { // Arrange @@ -228,8 +228,8 @@ public class AddTrackEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Tags; --")] // destructive injection in a tag and genre name - [InlineData("' OR '1'='1")] // boolean-based injection in a tag and genre name + [InlineData("'; DROP TABLE Tags; --")] // Destructive injection in a tag and genre name. + [InlineData("' OR '1'='1")] // Boolean-based injection in a tag and genre name. public async Task AddTrack_WithSQLInjectionInTagAndGenreNames_ShouldNotCorruptOrLeakData(string maliciousName) { // Arrange @@ -279,8 +279,8 @@ public class AddTrackEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task AddTrack_WithSQLInjectionInRouteId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteTrack/DeleteTrackEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteTrack/DeleteTrackEndpointTests.cs index 663b4753..a886b968 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteTrack/DeleteTrackEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteTrack/DeleteTrackEndpointTests.cs @@ -77,9 +77,9 @@ public class DeleteTrackEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task DeleteTrack_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -104,9 +104,9 @@ public class DeleteTrackEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task DeleteTrack_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange @@ -129,9 +129,9 @@ public class DeleteTrackEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task DeleteTrack_WithSQLInjectionInAlbumId_ShouldNotCorruptOrLeakData(string maliciousAlbumId) { // Arrange @@ -154,9 +154,9 @@ public class DeleteTrackEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task DeleteTrack_WithSQLInjectionInTrackId_ShouldNotCorruptOrLeakData(string maliciousTrackId) { // Arrange @@ -179,10 +179,10 @@ public class DeleteTrackEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("..%2F..%2Fevil")] // encoded slash traversal - [InlineData("%2e%2e%2f%2e%2e%2fevil")] // encoded dot-slash traversal - [InlineData("..%5Cevil")] // encoded backslash traversal - [InlineData("..%2F")] // encoded trailing slash traversal + [InlineData("..%2F..%2Fevil")] // Encoded slash traversal. + [InlineData("%2e%2e%2f%2e%2e%2fevil")] // Encoded dot-slash traversal. + [InlineData("..%5Cevil")] // Encoded backslash traversal. + [InlineData("..%2F")] // Encoded trailing slash traversal. public async Task DeleteTrack_WithPathTraversalInTrackId_ShouldReturnCleanProblemDetails(string maliciousTrackId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetDeletedTracks/GetDeletedTracksEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetDeletedTracks/GetDeletedTracksEndpointTests.cs index b29ddcec..19fff3a9 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetDeletedTracks/GetDeletedTracksEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetDeletedTracks/GetDeletedTracksEndpointTests.cs @@ -63,9 +63,9 @@ public class GetDeletedTracksEndpointTests : IClassFixture, ID } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetDeletedTracks_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrack/GetTrackEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrack/GetTrackEndpointTests.cs index 134df720..72df8e98 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrack/GetTrackEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrack/GetTrackEndpointTests.cs @@ -75,9 +75,9 @@ public class GetTrackEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetTrack_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -101,9 +101,9 @@ public class GetTrackEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetTrack_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange @@ -127,9 +127,9 @@ public class GetTrackEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetTrack_WithSQLInjectionInAlbumId_ShouldNotCorruptOrLeakData(string maliciousAlbumId) { // Arrange @@ -154,9 +154,9 @@ public class GetTrackEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetTrack_WithSQLInjectionInTrackId_ShouldNotCorruptOrLeakData(string maliciousTrackId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackSegment/GetTrackSegmentEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackSegment/GetTrackSegmentEndpointTests.cs index 69860c5d..26522e3a 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackSegment/GetTrackSegmentEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackSegment/GetTrackSegmentEndpointTests.cs @@ -77,24 +77,24 @@ public class GetTrackSegmentEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("libraryId", "'; DROP TABLE Tracks; --")] // destructive injection in the library Id - [InlineData("libraryId", "' OR '1'='1")] // boolean based injection in the library Id - [InlineData("artistId", "'; DROP TABLE Tracks; --")] // destructive injection in the artist Id - [InlineData("artistId", "'; EXEC xp_cmdshell('dir'); --")] // command execution attempt in the artist Id - [InlineData("albumId", "' OR '1'='1")] // boolean based injection in the album Id - [InlineData("albumId", "'; DROP TABLE Tracks; --")] // destructive injection in the album Id - [InlineData("trackId", "' OR '1'='1")] // boolean based injection in the track Id - [InlineData("trackId", "'; EXEC xp_cmdshell('dir'); --")] // command execution attempt in the track Id - [InlineData("deliveryId", "'; DROP TABLE Tracks; --")] // destructive injection in the delivery handle - [InlineData("deliveryId", "' OR '1'='1")] // boolean based injection in the delivery handle - [InlineData("segmentIndex", "'; DROP TABLE Tracks; --")] // destructive injection in the segment index - [InlineData("segmentIndex", "' OR '1'='1")] // boolean based injection in the segment index - [InlineData("libraryId", "../../etc/passwd")] // path traversal in the library Id - [InlineData("artistId", "../../etc/passwd")] // path traversal in the artist Id - [InlineData("albumId", "../../etc/passwd")] // path traversal in the album Id - [InlineData("trackId", "../../etc/passwd")] // path traversal in the track Id - [InlineData("deliveryId", "../../etc/passwd")] // path traversal in the delivery handle - [InlineData("segmentIndex", "../../etc/passwd")] // path traversal in the segment index + [InlineData("libraryId", "'; DROP TABLE Tracks; --")] // Destructive injection in the library Id. + [InlineData("libraryId", "' OR '1'='1")] // Boolean based injection in the library Id. + [InlineData("artistId", "'; DROP TABLE Tracks; --")] // Destructive injection in the artist Id. + [InlineData("artistId", "'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt in the artist Id. + [InlineData("albumId", "' OR '1'='1")] // Boolean based injection in the album Id. + [InlineData("albumId", "'; DROP TABLE Tracks; --")] // Destructive injection in the album Id. + [InlineData("trackId", "' OR '1'='1")] // Boolean based injection in the track Id. + [InlineData("trackId", "'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt in the track Id. + [InlineData("deliveryId", "'; DROP TABLE Tracks; --")] // Destructive injection in the delivery handle. + [InlineData("deliveryId", "' OR '1'='1")] // Boolean based injection in the delivery handle. + [InlineData("segmentIndex", "'; DROP TABLE Tracks; --")] // Destructive injection in the segment index. + [InlineData("segmentIndex", "' OR '1'='1")] // Boolean based injection in the segment index. + [InlineData("libraryId", "../../etc/passwd")] // Path traversal in the library Id. + [InlineData("artistId", "../../etc/passwd")] // Path traversal in the artist Id. + [InlineData("albumId", "../../etc/passwd")] // Path traversal in the album Id. + [InlineData("trackId", "../../etc/passwd")] // Path traversal in the track Id. + [InlineData("deliveryId", "../../etc/passwd")] // Path traversal in the delivery handle. + [InlineData("segmentIndex", "../../etc/passwd")] // Path traversal in the segment index. public async Task GetTrackSegment_WithAnInjectionPayloadInARouteValue_ShouldNotFailOrLeakData(string routeValue, string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackStream/GetTrackStreamEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackStream/GetTrackStreamEndpointTests.cs index d30b9c5e..c904bef5 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackStream/GetTrackStreamEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackStream/GetTrackStreamEndpointTests.cs @@ -74,18 +74,18 @@ public class GetTrackStreamEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("libraryId", "'; DROP TABLE Tracks; --")] // destructive injection in the library Id - [InlineData("libraryId", "' OR '1'='1")] // boolean based injection in the library Id - [InlineData("artistId", "'; DROP TABLE Tracks; --")] // destructive injection in the artist Id - [InlineData("artistId", "'; EXEC xp_cmdshell('dir'); --")] // command execution attempt in the artist Id - [InlineData("albumId", "' OR '1'='1")] // boolean based injection in the album Id - [InlineData("albumId", "'; DROP TABLE Tracks; --")] // destructive injection in the album Id - [InlineData("trackId", "' OR '1'='1")] // boolean based injection in the track Id - [InlineData("trackId", "'; EXEC xp_cmdshell('dir'); --")] // command execution attempt in the track Id - [InlineData("libraryId", "../../etc/passwd")] // path traversal in the library Id - [InlineData("artistId", "../../etc/passwd")] // path traversal in the artist Id - [InlineData("albumId", "../../etc/passwd")] // path traversal in the album Id - [InlineData("trackId", "../../etc/passwd")] // path traversal in the track Id + [InlineData("libraryId", "'; DROP TABLE Tracks; --")] // Destructive injection in the library Id. + [InlineData("libraryId", "' OR '1'='1")] // Boolean based injection in the library Id. + [InlineData("artistId", "'; DROP TABLE Tracks; --")] // Destructive injection in the artist Id. + [InlineData("artistId", "'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt in the artist Id. + [InlineData("albumId", "' OR '1'='1")] // Boolean based injection in the album Id. + [InlineData("albumId", "'; DROP TABLE Tracks; --")] // Destructive injection in the album Id. + [InlineData("trackId", "' OR '1'='1")] // Boolean based injection in the track Id. + [InlineData("trackId", "'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt in the track Id. + [InlineData("libraryId", "../../etc/passwd")] // Path traversal in the library Id. + [InlineData("artistId", "../../etc/passwd")] // Path traversal in the artist Id. + [InlineData("albumId", "../../etc/passwd")] // Path traversal in the album Id. + [InlineData("trackId", "../../etc/passwd")] // Path traversal in the track Id. public async Task GetTrackStream_WithAnInjectionPayloadInARouteValue_ShouldRejectItWithoutLeakingData(string routeValue, string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/RestoreTrack/RestoreTrackEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/RestoreTrack/RestoreTrackEndpointTests.cs index cd5c3607..530cfdb1 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/RestoreTrack/RestoreTrackEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/RestoreTrack/RestoreTrackEndpointTests.cs @@ -64,9 +64,9 @@ public class RestoreTrackEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task RestoreTrack_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -82,9 +82,9 @@ public class RestoreTrackEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task RestoreTrack_WithSQLInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange @@ -100,9 +100,9 @@ public class RestoreTrackEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task RestoreTrack_WithSQLInjectionInAlbumId_ShouldNotCorruptOrLeakData(string maliciousAlbumId) { // Arrange @@ -118,9 +118,9 @@ public class RestoreTrackEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task RestoreTrack_WithSQLInjectionInTrackId_ShouldNotCorruptOrLeakData(string maliciousTrackId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/ShuffleTracks/ShuffleTracksEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/ShuffleTracks/ShuffleTracksEndpointTests.cs index 764889c9..c0cb192f 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/ShuffleTracks/ShuffleTracksEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/ShuffleTracks/ShuffleTracksEndpointTests.cs @@ -82,9 +82,9 @@ public class ShuffleTracksEndpointTests : IClassFixture, IDisp } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task ShuffleTracks_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -109,8 +109,8 @@ public class ShuffleTracksEndpointTests : IClassFixture, IDisp } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task ShuffleTracks_WithInjectionInCount_ShouldNotCorruptOrLeakData(string maliciousCount) { // Arrange @@ -128,8 +128,8 @@ public class ShuffleTracksEndpointTests : IClassFixture, IDisp } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task ShuffleTracks_WithInjectionInArtistId_ShouldNotCorruptOrLeakData(string maliciousArtistId) { // Arrange @@ -146,8 +146,8 @@ public class ShuffleTracksEndpointTests : IClassFixture, IDisp } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task ShuffleTracks_WithInjectionInAlbumId_ShouldNotCorruptOrLeakData(string maliciousAlbumId) { // Arrange @@ -164,8 +164,8 @@ public class ShuffleTracksEndpointTests : IClassFixture, IDisp } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task ShuffleTracks_WithInjectionInExcludedTrackIds_ShouldNotCorruptOrLeakData(string maliciousTrackId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs index 34cf78f3..6a618f1e 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs @@ -80,8 +80,8 @@ public class UpdateTrackEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateTrack_WithSQLInjectionInBody_ShouldNotCorruptOrLeakData(string maliciousTitle) { // Arrange @@ -115,8 +115,8 @@ public class UpdateTrackEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("C:\\Windows\\System32\\drivers\\etc\\hosts")] // Windows sensitive file - [InlineData("/etc/passwd")] // Unix sensitive file + [InlineData("C:\\Windows\\System32\\drivers\\etc\\hosts")] // Windows sensitive file. + [InlineData("/etc/passwd")] // Unix sensitive file. public async Task UpdateTrack_WhenRequestBodyAttemptsToRedirectTheTrackFilePath_ShouldPreserveTheStoredPathAndNotLeakIt(string attemptedPath) { // Arrange @@ -163,8 +163,8 @@ public class UpdateTrackEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateTrack_WithSQLInjectionInLibraryRouteId_ShouldRemainSecure(string maliciousLibraryId) { // Arrange @@ -181,8 +181,8 @@ public class UpdateTrackEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateTrack_WithSQLInjectionInArtistRouteId_ShouldRemainSecure(string maliciousArtistId) { // Arrange @@ -199,8 +199,8 @@ public class UpdateTrackEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateTrack_WithSQLInjectionInAlbumRouteId_ShouldRemainSecure(string maliciousAlbumId) { // Arrange @@ -217,8 +217,8 @@ public class UpdateTrackEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Tracks; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Tracks; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateTrack_WithSQLInjectionInTrackRouteId_ShouldRemainSecure(string maliciousTrackId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointTests.cs index 4cd4261f..1a446505 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/AddLibrary/AddLibraryEndpointTests.cs @@ -73,8 +73,8 @@ public class AddLibraryEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Libraries--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Libraries--")] // Destructive injection. public async Task AddLibrary_WithSQLInjectionInTitle_ShouldNotLeakOrError(string maliciousTitle) { // Arrange @@ -96,7 +96,7 @@ public class AddLibraryEndpointTests : IClassFixture HttpResponseMessage response = await client.PostAsJsonAsync("/api/v1/libraries", request); // Assert - // the malicious title passes the authenticated handler, reaches the parameterized data access, and is persisted verbatim + // The malicious title passes the authenticated handler, reaches the parameterized data access, and is persisted verbatim. Assert.Equal(HttpStatusCode.Created, response.StatusCode); string content = await response.Content.ReadAsStringAsync(); Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); @@ -113,10 +113,10 @@ public class AddLibraryEndpointTests : IClassFixture } [Theory] - [InlineData(-1)] // just below the allowed range - [InlineData(101)] // just above the allowed range - [InlineData(int.MinValue)] // lowest possible value - [InlineData(int.MaxValue)] // highest possible value + [InlineData(-1)] // Just below the allowed range. + [InlineData(101)] // Just above the allowed range. + [InlineData(int.MinValue)] // Lowest possible value. + [InlineData(int.MaxValue)] // Highest possible value. public async Task AddLibrary_WhenThresholdIsOutsideAllowedRange_ShouldRejectTheRequestWithoutPersisting(int completionThresholdPercentage) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs index a22fed58..ec315422 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs @@ -62,12 +62,12 @@ public class CancelLibraryScanEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE LibraryScans--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE LibraryScans--")] // Destructive injection. public async Task CancelLibraryScan_WithSQLInjectionInRouteParameters_ShouldNotLeakOrError(string maliciousId) { // Arrange - // authenticate with an admin user and seed a library, so a valid libraryId would reach the handler and be authorized + // Authenticate with an admin user and seed a library, so a valid libraryId would reach the handler and be authorized. HttpClient client = _apiFactory.CreateClient(); Guid userId = await _apiFactory.CreateAndAuthenticateAdminUserAsync(client); await SeedLibraryAsync(userId); @@ -76,10 +76,10 @@ public class CancelLibraryScanEndpointTests : IClassFixture HttpResponseMessage response = await client.PostAsJsonAsync($"/api/v1/libraries/{Uri.EscapeDataString(maliciousId)}/scans/{Guid.NewGuid()}/cancel", new { }); // Assert - // note: the {libraryId} route parameter is Guid-typed, so the malicious value fails model binding before it reaches the handler - // note: observed status is 500 because FastEndpoints, combined with DontCatchExceptions(), turns the binding - // ValidationFailureException into a 500 response instead of 400/422 (pre-existing production bug, not fixed here) - // note: that 500 body leaks the ValidationFailureException details, so no DoesNotContain("Exception") is asserted here + // Note: the {libraryId} route parameter is Guid-typed, so the malicious value fails model binding before it reaches the handler. + // Note: observed status is 500 because FastEndpoints, combined with DontCatchExceptions(), turns the binding + // ValidationFailureException into a 500 response instead of 400/422 (pre-existing production bug, not fixed here). + // Note: that 500 body leaks the ValidationFailureException details, so no DoesNotContain("Exception") is asserted here. Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); string content = await response.Content.ReadAsStringAsync(); Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpointTests.cs index 569ef2d2..bad39b9c 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/GetLibrary/GetLibraryEndpointTests.cs @@ -70,12 +70,12 @@ public class GetLibraryEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Libraries--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Libraries--")] // Destructive injection. public async Task GetLibrary_WithSQLInjectionInLibraryId_ShouldNotLeakOrError(string maliciousLibraryId) { // Arrange - // authenticate with an admin user and seed a library, so a valid id would reach the handler and be authorized + // Authenticate with an admin user and seed a library, so a valid id would reach the handler and be authorized. HttpClient client = _apiFactory.CreateClient(); Guid userId = await _apiFactory.CreateAndAuthenticateAdminUserAsync(client); await SeedLibraryAsync(userId); @@ -84,12 +84,12 @@ public class GetLibraryEndpointTests : IClassFixture HttpResponseMessage response = await client.GetAsync($"/api/v1/libraries/{Uri.EscapeDataString(maliciousLibraryId)}"); // Assert - // note: the {id} route parameter is Guid-typed, so the malicious value fails model binding before it reaches the handler - // note: observed status is 500 because FastEndpoints, combined with DontCatchExceptions(), turns the binding - // ValidationFailureException into a 500 response instead of 400/422 (pre-existing production bug, not fixed here) - // note: that 500 body leaks the ValidationFailureException details, so no DoesNotContain("Exception") is asserted here - // note: the payloads never contain the literal "SQL", so checking for that word would assert nothing; what matters - // is that the injection never reaches the database, so no SQL engine error (SqliteException) may surface + // Note: the {id} route parameter is Guid-typed, so the malicious value fails model binding before it reaches the handler. + // Note: observed status is 500 because FastEndpoints, combined with DontCatchExceptions(), turns the binding + // ValidationFailureException into a 500 response instead of 400/422 (pre-existing production bug, not fixed here). + // Note: that 500 body leaks the ValidationFailureException details, so no DoesNotContain("Exception") is asserted here. + // Note: the payloads never contain the literal "SQL", so checking for that word would assert nothing; what matters + // is that the injection never reaches the database, so no SQL engine error (SqliteException) may surface. Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); string content = await response.Content.ReadAsStringAsync(); Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/GetLibraryPathTemplateParts/GetLibraryPathTemplatePartsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/GetLibraryPathTemplateParts/GetLibraryPathTemplatePartsEndpointTests.cs index 286e5cbb..9da6798d 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/GetLibraryPathTemplateParts/GetLibraryPathTemplatePartsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Management/GetLibraryPathTemplateParts/GetLibraryPathTemplatePartsEndpointTests.cs @@ -59,14 +59,14 @@ public class GetLibraryPathTemplatePartsEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Libraries--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Libraries--")] // Destructive injection. public async Task ScanLibrary_WithSQLInjectionInLibraryId_ShouldNotLeakOrError(string maliciousLibraryId) { // Arrange - // authenticate with an admin user and seed a library, so a valid id would reach the handler and be authorized + // Authenticate with an admin user and seed a library, so a valid id would reach the handler and be authorized. HttpClient client = _apiFactory.CreateClient(); Guid userId = await _apiFactory.CreateAndAuthenticateAdminUserAsync(client); await SeedLibraryAsync(userId); @@ -75,10 +75,10 @@ public class ScanLibraryEndpointTests : IClassFixture HttpResponseMessage response = await client.PostAsJsonAsync($"/api/v1/libraries/{Uri.EscapeDataString(maliciousLibraryId)}/scans", new { }); // Assert - // note: the {id} route parameter is Guid-typed, so the malicious value fails model binding before it reaches the handler - // note: observed status is 500 because FastEndpoints, combined with DontCatchExceptions(), turns the binding - // ValidationFailureException into a 500 response instead of 400/422 (pre-existing production bug, not fixed here) - // note: that 500 body leaks the ValidationFailureException details, so no DoesNotContain("Exception") is asserted here + // Note: the {id} route parameter is Guid-typed, so the malicious value fails model binding before it reaches the handler. + // Note: observed status is 500 because FastEndpoints, combined with DontCatchExceptions(), turns the binding + // ValidationFailureException into a 500 response instead of 400/422 (pre-existing production bug, not fixed here). + // Note: that 500 body leaks the ValidationFailureException details, so no DoesNotContain("Exception") is asserted here. Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); string content = await response.Content.ReadAsStringAsync(); Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearConsumptionHistory/ClearUserConsumptionHistoryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearConsumptionHistory/ClearUserConsumptionHistoryEndpointTests.cs index 4b014d20..f2010ef5 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearConsumptionHistory/ClearUserConsumptionHistoryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearConsumptionHistory/ClearUserConsumptionHistoryEndpointTests.cs @@ -168,11 +168,11 @@ public class ClearUserConsumptionHistoryEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task ClearUserConsumptionHistory_WithInjectionInUserIdRouteValue_ShouldRejectWithoutDeletingRows(string maliciousUserId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearResumePointsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearResumePointsEndpointTests.cs index 43ec3dca..da2083cd 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearResumePointsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearResumePointsEndpointTests.cs @@ -147,11 +147,11 @@ public class ClearResumePointsEndpointTests : IClassFixture, I } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaResumePoints--")] // destructive injection - [InlineData("1; DELETE FROM MediaResumePoints")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaResumePoints--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaResumePoints")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task ClearResumePoints_WithInjectionInLibraryIdQueryParameter_ShouldRejectWithoutDeletingRows(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearUserResumePointsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearUserResumePointsEndpointTests.cs index 165515b4..39e723e5 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearUserResumePointsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearUserResumePointsEndpointTests.cs @@ -173,11 +173,11 @@ public class ClearUserResumePointsEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaResumePoints--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaResumePoints")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task ClearUserResumePoints_WithInjectionInUserIdRouteValue_ShouldRejectWithoutDeletingRows(string maliciousUserId) { // Arrange @@ -196,11 +196,11 @@ public class ClearUserResumePointsEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaResumePoints--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaResumePoints")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task ClearUserResumePoints_WithInjectionInLibraryIdQueryParameter_ShouldRejectWithoutDeletingRows(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs index f2ba166b..b57ab4c3 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs @@ -162,11 +162,11 @@ public class DeleteConsumptionItemHistoryEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task DeleteConsumptionItemHistory_WithInjectionInMediaKind_ShouldRejectWithoutDeletingRows(string maliciousMediaKind) { // Arrange @@ -185,11 +185,11 @@ public class DeleteConsumptionItemHistoryEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task DeleteConsumptionItemHistory_WithInjectionInMediaItemId_ShouldRejectWithoutDeletingRows(string maliciousMediaItemId) { // Arrange @@ -208,11 +208,11 @@ public class DeleteConsumptionItemHistoryEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task DeleteConsumptionItemHistory_WithInjectionInLibraryId_ShouldRejectWithoutDeletingRows(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteUserConsumptionItemHistoryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteUserConsumptionItemHistoryEndpointTests.cs index d28189ad..91e7b647 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteUserConsumptionItemHistoryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteUserConsumptionItemHistoryEndpointTests.cs @@ -171,11 +171,11 @@ public class DeleteUserConsumptionItemHistoryEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task DeleteUserConsumptionItemHistory_WithInjectionInUserIdRouteValue_ShouldRejectWithoutDeletingRows(string maliciousUserId) { // Arrange @@ -194,11 +194,11 @@ public class DeleteUserConsumptionItemHistoryEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task DeleteUserConsumptionItemHistory_WithInjectionInMediaKind_ShouldRejectWithoutDeletingRows(string maliciousMediaKind) { // Arrange @@ -217,11 +217,11 @@ public class DeleteUserConsumptionItemHistoryEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task DeleteUserConsumptionItemHistory_WithInjectionInMediaItemId_ShouldRejectWithoutDeletingRows(string maliciousMediaItemId) { // Arrange @@ -240,11 +240,11 @@ public class DeleteUserConsumptionItemHistoryEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task DeleteUserConsumptionItemHistory_WithInjectionInLibraryId_ShouldRejectWithoutDeletingRows(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionRecord/DeleteConsumptionRecordEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionRecord/DeleteConsumptionRecordEndpointTests.cs index bf9a2c84..4a617d92 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionRecord/DeleteConsumptionRecordEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionRecord/DeleteConsumptionRecordEndpointTests.cs @@ -141,11 +141,11 @@ public class DeleteConsumptionRecordEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task DeleteConsumptionRecord_WithInjectionInRecordId_ShouldRejectWithoutDeletingRows(string maliciousRecordId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionRecord/DeleteUserConsumptionRecordEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionRecord/DeleteUserConsumptionRecordEndpointTests.cs index 249158ca..3e775bf1 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionRecord/DeleteUserConsumptionRecordEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionRecord/DeleteUserConsumptionRecordEndpointTests.cs @@ -166,11 +166,11 @@ public class DeleteUserConsumptionRecordEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task DeleteUserConsumptionRecord_WithInjectionInUserIdRouteValue_ShouldRejectWithoutDeletingRows(string maliciousUserId) { // Arrange @@ -189,11 +189,11 @@ public class DeleteUserConsumptionRecordEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task DeleteUserConsumptionRecord_WithInjectionInRecordIdRouteValue_ShouldRejectWithoutDeletingRows(string maliciousRecordId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsEndpointTests.cs index f9cb0a45..7dc8c994 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsEndpointTests.cs @@ -134,11 +134,11 @@ public class GetAllUsersConsumptionStatisticsEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetAllUsersConsumptionStatistics_WithInjectionInLibraryId_ShouldRejectWithoutLeakingData(string maliciousLibraryId) { // Arrange @@ -170,8 +170,8 @@ public class GetAllUsersConsumptionStatisticsEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetConsumptionStatistics_WithInjectionInLibraryId_ShouldRejectWithoutLeakingData(string maliciousLibraryId) { // Arrange @@ -154,11 +154,11 @@ public class GetConsumptionStatisticsEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetConsumptionStatistics_WithInjectionInFromUtc_ShouldRejectWithoutLeakingData(string maliciousFromUtc) { // Arrange @@ -180,8 +180,8 @@ public class GetConsumptionStatisticsEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetUserConsumptionStatistics_WithInjectionInUserIdRouteValue_ShouldRejectWithoutLeakingData(string maliciousUserId) { // Arrange @@ -200,8 +200,8 @@ public class GetUserConsumptionStatisticsEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetGenreConsumption_WithInjectionInLibraryId_ShouldRejectWithoutLeakingData(string maliciousLibraryId) { // Arrange @@ -161,8 +161,8 @@ public class GetGenreConsumptionEndpointTests : IClassFixture, } [Theory] - [InlineData("999")] // out of range numeric value - [InlineData("not-a-media-kind")] // textual value that is not an enum member + [InlineData("999")] // Out of range numeric value. + [InlineData("not-a-media-kind")] // Textual value that is not an enum member. public async Task GetGenreConsumption_WithUnsupportedMediaKind_ShouldNotReturnDataOrLeakInternals(string mediaKind) { // Arrange @@ -180,11 +180,11 @@ public class GetGenreConsumptionEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetGenreConsumption_WithInjectionInFromUtc_ShouldRejectWithoutLeakingData(string maliciousFromUtc) { // Arrange @@ -208,11 +208,11 @@ public class GetGenreConsumptionEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetGenreConsumption_WithInjectionInToUtc_ShouldRejectWithoutLeakingData(string maliciousToUtc) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetGenreConsumption/GetUserGenreConsumptionEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetGenreConsumption/GetUserGenreConsumptionEndpointTests.cs index 24dd7c10..6c669f08 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetGenreConsumption/GetUserGenreConsumptionEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetGenreConsumption/GetUserGenreConsumptionEndpointTests.cs @@ -185,11 +185,11 @@ public class GetUserGenreConsumptionEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetUserGenreConsumption_WithInjectionInUserIdRouteValue_ShouldRejectWithoutLeakingData(string maliciousUserId) { // Arrange @@ -211,11 +211,11 @@ public class GetUserGenreConsumptionEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetUserGenreConsumption_WithInjectionInLibraryId_ShouldRejectWithoutLeakingData(string maliciousLibraryId) { // Arrange @@ -238,8 +238,8 @@ public class GetUserGenreConsumptionEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetUserGenreConsumption_WithInjectionInFromUtc_ShouldRejectWithoutLeakingData(string maliciousFromUtc) { // Arrange @@ -286,11 +286,11 @@ public class GetUserGenreConsumptionEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetUserGenreConsumption_WithInjectionInToUtc_ShouldRejectWithoutLeakingData(string maliciousToUtc) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetMostConsumedEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetMostConsumedEndpointTests.cs index 505df6e2..602c8ea2 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetMostConsumedEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetMostConsumedEndpointTests.cs @@ -131,11 +131,11 @@ public class GetMostConsumedEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetMostConsumed_WithInjectionInLibraryId_ShouldRejectWithoutLeakingData(string maliciousLibraryId) { // Arrange @@ -157,8 +157,8 @@ public class GetMostConsumedEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("999")] // out of range numeric value - [InlineData("not-a-media-kind")] // textual value that is not an enum member + [InlineData("999")] // Out of range numeric value. + [InlineData("not-a-media-kind")] // Textual value that is not an enum member. public async Task GetMostConsumed_WithUnsupportedMediaKind_ShouldNotReturnDataOrLeakInternals(string mediaKind) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetUserMostConsumedEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetUserMostConsumedEndpointTests.cs index 8ff6547c..d1d27104 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetUserMostConsumedEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetUserMostConsumedEndpointTests.cs @@ -180,11 +180,11 @@ public class GetUserMostConsumedEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetUserMostConsumed_WithInjectionInUserIdRouteValue_ShouldRejectWithoutLeakingData(string maliciousUserId) { // Arrange @@ -206,8 +206,8 @@ public class GetUserMostConsumedEndpointTests : IClassFixture, } [Theory] - [InlineData("999")] // out of range numeric value - [InlineData("not-a-media-kind")] // textual value that is not an enum member + [InlineData("999")] // Out of range numeric value. + [InlineData("not-a-media-kind")] // Textual value that is not an enum member. public async Task GetUserMostConsumed_WithUnsupportedMediaKind_ShouldNotReturnDataOrLeakInternals(string mediaKind) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetRecentlyConsumedEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetRecentlyConsumedEndpointTests.cs index 7801035d..b565ba9d 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetRecentlyConsumedEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetRecentlyConsumedEndpointTests.cs @@ -131,11 +131,11 @@ public class GetRecentlyConsumedEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetRecentlyConsumed_WithInjectionInLibraryId_ShouldRejectWithoutLeakingData(string maliciousLibraryId) { // Arrange @@ -157,8 +157,8 @@ public class GetRecentlyConsumedEndpointTests : IClassFixture, } [Theory] - [InlineData("999")] // out of range numeric value - [InlineData("not-a-media-kind")] // textual value that is not an enum member + [InlineData("999")] // Out of range numeric value. + [InlineData("not-a-media-kind")] // Textual value that is not an enum member. public async Task GetRecentlyConsumed_WithUnsupportedMediaKind_ShouldNotReturnDataOrLeakInternals(string mediaKind) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetUserRecentlyConsumedEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetUserRecentlyConsumedEndpointTests.cs index 5fed89c5..246bdd4b 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetUserRecentlyConsumedEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetUserRecentlyConsumedEndpointTests.cs @@ -180,11 +180,11 @@ public class GetUserRecentlyConsumedEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetUserRecentlyConsumed_WithInjectionInUserIdRouteValue_ShouldRejectWithoutLeakingData(string maliciousUserId) { // Arrange @@ -206,8 +206,8 @@ public class GetUserRecentlyConsumedEndpointTests : IClassFixture, I } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetTagConsumption_WithInjectionInLibraryId_ShouldRejectWithoutLeakingData(string maliciousLibraryId) { // Arrange @@ -159,8 +159,8 @@ public class GetTagConsumptionEndpointTests : IClassFixture, I } [Theory] - [InlineData("999")] // out of range numeric value - [InlineData("not-a-media-kind")] // textual value that is not an enum member + [InlineData("999")] // Out of range numeric value. + [InlineData("not-a-media-kind")] // Textual value that is not an enum member. public async Task GetTagConsumption_WithUnsupportedMediaKind_ShouldNotReturnDataOrLeakInternals(string mediaKind) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetTagConsumption/GetUserTagConsumptionEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetTagConsumption/GetUserTagConsumptionEndpointTests.cs index f1ada4f3..61e3bdf7 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetTagConsumption/GetUserTagConsumptionEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/Statistics/GetTagConsumption/GetUserTagConsumptionEndpointTests.cs @@ -183,11 +183,11 @@ public class GetUserTagConsumptionEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetUserTagConsumption_WithInjectionInUserIdRouteValue_ShouldRejectWithoutLeakingData(string maliciousUserId) { // Arrange @@ -209,8 +209,8 @@ public class GetUserTagConsumptionEndpointTests : IClassFixture, IDisposable } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task AddBook_WithSQLInjectionInPath_ShouldNotCorruptOrDeleteData(string maliciousPath) { // Arrange @@ -133,23 +133,23 @@ public class AddBookEndpointTests : IClassFixture, IDisposable HttpResponseMessage response = await client.PostAsJsonAsync($"/api/v1/libraries/{libraryId}/books", request); // Assert - // the malicious path passes the authenticated handler, reaches the parameterized insert, and is persisted - // verbatim: if it were concatenated into raw SQL, the insert would fail and the book would not be created + // The malicious path passes the authenticated handler, reaches the parameterized insert, and is persisted + // verbatim: if it were concatenated into raw SQL, the insert would fail and the book would not be created. Assert.Equal(HttpStatusCode.Created, response.StatusCode); Assert.DoesNotContain("SqliteException", await response.Content.ReadAsStringAsync(), StringComparison.OrdinalIgnoreCase); using IServiceScope scope = _apiFactory.Services.CreateScope(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); Assert.Equal(1, await dbContext.Libraries.CountAsync(library => library.Id == libraryId)); - // the single book in the library is the one inserted by this request, with the malicious path stored as data + // The single book in the library is the one inserted by this request, with the malicious path stored as data. Assert.Equal(1, await dbContext.Books.CountAsync(book => book.LibraryId == libraryId)); await _apiFactory.RemoveTestUserAsync(username); } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task AddBook_WithSQLInjectionInBody_ShouldNotCorruptOrDeleteData(string maliciousTitle) { // Arrange @@ -170,8 +170,8 @@ public class AddBookEndpointTests : IClassFixture, IDisposable HttpResponseMessage response = await client.PostAsJsonAsync($"/api/v1/libraries/{libraryId}/books", request); // Assert - // the malicious title passes the authenticated handler, reaches the parameterized insert, and is persisted - // verbatim: if it were concatenated into raw SQL, the insert would fail and the book would not be created + // The malicious title passes the authenticated handler, reaches the parameterized insert, and is persisted + // verbatim: if it were concatenated into raw SQL, the insert would fail and the book would not be created. Assert.Equal(HttpStatusCode.Created, response.StatusCode); Assert.DoesNotContain("SqliteException", await response.Content.ReadAsStringAsync(), StringComparison.OrdinalIgnoreCase); @@ -184,8 +184,8 @@ public class AddBookEndpointTests : IClassFixture, IDisposable } [Theory] - [InlineData("'; DROP TABLE Tags; --")] // destructive injection in a tag and genre name - [InlineData("' OR '1'='1")] // boolean-based injection in a tag and genre name + [InlineData("'; DROP TABLE Tags; --")] // Destructive injection in a tag and genre name. + [InlineData("' OR '1'='1")] // Boolean-based injection in a tag and genre name. public async Task AddBook_WithSQLInjectionInTagAndGenreNames_ShouldNotCorruptOrLeakData(string maliciousName) { // Arrange @@ -246,8 +246,8 @@ public class AddBookEndpointTests : IClassFixture, IDisposable } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task AddBook_WithSQLInjectionInRouteId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -279,6 +279,6 @@ public class AddBookEndpointTests : IClassFixture, IDisposable /// public void Dispose() { - // nothing to clean up: each test removes its own seeded rows + // Nothing to clean up: each test removes its own seeded rows. } } diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/DeleteBook/DeleteBookEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/DeleteBook/DeleteBookEndpointTests.cs index 75a3f1de..62bff26e 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/DeleteBook/DeleteBookEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/DeleteBook/DeleteBookEndpointTests.cs @@ -73,9 +73,9 @@ public class DeleteBookEndpointTests : IClassFixture, IDisposa } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task DeleteBook_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -96,9 +96,9 @@ public class DeleteBookEndpointTests : IClassFixture, IDisposa } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task DeleteBook_WithSQLInjectionInBookId_ShouldNotCorruptOrLeakData(string maliciousBookId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs index 2b2ca95c..c9898e62 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs @@ -44,8 +44,8 @@ public class GetBookEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetBook_WithSQLInjectionInBookId_ShouldNotCorruptOrLeakData(string maliciousBookId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs index 3c7d99b6..3c37a353 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs @@ -57,8 +57,8 @@ public class GetBooksEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetBooks_WhenSearchTermContainsSqlInjection_ShouldNotCorruptOrDeleteData(string maliciousSearchTerm) { // Arrange @@ -77,7 +77,7 @@ public class GetBooksEndpointTests : IClassFixture, IDisposabl Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); Assert.DoesNotContain(maliciousSearchTerm, content, StringComparison.Ordinal); - // the injected statement must never be executed: the Books table and the seeded rows must still be there + // The injected statement must never be executed: the Books table and the seeded rows must still be there. using IServiceScope scope = _apiFactory.Services.CreateScope(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); Assert.Equal(1, await dbContext.Books.CountAsync(book => book.LibraryId == libraryId)); @@ -116,8 +116,8 @@ public class GetBooksEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetBooks_WithSQLInjectionInRouteId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -148,6 +148,6 @@ public class GetBooksEndpointTests : IClassFixture, IDisposabl /// public void Dispose() { - // nothing to clean up: each test removes its own seeded rows + // Nothing to clean up: each test removes its own seeded rows. } } diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs index 921f6122..2956625f 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs @@ -58,8 +58,8 @@ public class GetBooksLiteEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetBooksLite_WhenSearchTermContainsSqlInjection_ShouldNotCorruptOrDeleteData(string maliciousSearchTerm) { // Arrange @@ -78,7 +78,7 @@ public class GetBooksLiteEndpointTests : IClassFixture, IDispo Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); Assert.DoesNotContain(maliciousSearchTerm, content, StringComparison.Ordinal); - // the injected statement must never be executed: the Books table and the seeded rows must still be there + // The injected statement must never be executed: the Books table and the seeded rows must still be there. using IServiceScope scope = _apiFactory.Services.CreateScope(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); Assert.Equal(1, await dbContext.Books.CountAsync(book => book.LibraryId == libraryId)); @@ -117,8 +117,8 @@ public class GetBooksLiteEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetBooksLite_WithSQLInjectionInRouteId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange @@ -149,6 +149,6 @@ public class GetBooksLiteEndpointTests : IClassFixture, IDispo /// public void Dispose() { - // nothing to clean up: each test removes its own seeded rows + // Nothing to clean up: each test removes its own seeded rows. } } diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetDeletedBooks/GetDeletedBooksEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetDeletedBooks/GetDeletedBooksEndpointTests.cs index 9ae7c61c..db0fb640 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetDeletedBooks/GetDeletedBooksEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetDeletedBooks/GetDeletedBooksEndpointTests.cs @@ -59,9 +59,9 @@ public class GetDeletedBooksEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task GetDeletedBooks_WithSQLInjectionInLibraryId_ShouldNotCorruptOrLeakData(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs index 113292c6..fad9d3e1 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs @@ -58,8 +58,8 @@ public class GetReadingAvailabilityEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Books--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Books--")] // Destructive injection. public async Task GetReadingManifest_WithSQLInjectionInBookId_ShouldNotLeakDatabaseDetails(string maliciousBookId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs index 198f5e43..12f7984d 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs @@ -58,8 +58,8 @@ public class GetReadingResourceEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Books--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Books--")] // Destructive injection. public async Task GetReadingResource_WithSQLInjectionInResourceKey_ShouldNotLeakDatabaseDetails(string maliciousResourceKey) { // Arrange @@ -84,8 +84,8 @@ public class GetReadingResourceEndpointTests : IClassFixture } [Theory] - [InlineData("../../etc/passwd")] // directory traversal - [InlineData("..%2F..%2Fetc%2Fpasswd")] // encoded directory traversal + [InlineData("../../etc/passwd")] // Directory traversal. + [InlineData("..%2F..%2Fetc%2Fpasswd")] // Encoded directory traversal. public async Task GetReadingResource_WithPathTraversalInResourceKey_ShouldNotExposeFilesystemPaths(string traversalPayload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs index 86bb0fc6..f373241a 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs @@ -58,8 +58,8 @@ public class GetReadingSectionEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Books--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Books--")] // Destructive injection. public async Task GetReadingSection_WithSQLInjectionInLocationRef_ShouldNotLeakDatabaseDetails(string maliciousLocationRef) { // Arrange @@ -84,8 +84,8 @@ public class GetReadingSectionEndpointTests : IClassFixture } [Theory] - [InlineData("../../etc/passwd")] // directory traversal - [InlineData("..%2F..%2Fetc%2Fpasswd")] // encoded directory traversal + [InlineData("../../etc/passwd")] // Directory traversal. + [InlineData("..%2F..%2Fetc%2Fpasswd")] // Encoded directory traversal. public async Task GetReadingSection_WithPathTraversalInLocationRef_ShouldNotExposeFilesystemPaths(string traversalPayload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/RestoreBook/RestoreBookEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/RestoreBook/RestoreBookEndpointTests.cs index 6baed8ff..419041fd 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/RestoreBook/RestoreBookEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/RestoreBook/RestoreBookEndpointTests.cs @@ -59,9 +59,9 @@ public class RestoreBookEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; EXEC xp_cmdshell('dir'); --")] // command execution attempt + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; EXEC xp_cmdshell('dir'); --")] // Command execution attempt. public async Task RestoreBook_WithSQLInjectionInRouteIds_ShouldNotCorruptOrLeakData(string maliciousId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBook/UpdateBookEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBook/UpdateBookEndpointTests.cs index 3bcdc011..8975e2fc 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBook/UpdateBookEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBook/UpdateBookEndpointTests.cs @@ -64,8 +64,8 @@ public class UpdateBookEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateBook_WithSQLInjectionInBody_ShouldNotCorruptOrLeakData(string maliciousTitle) { // Arrange @@ -91,8 +91,8 @@ public class UpdateBookEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateBook_WithSQLInjectionInRouteId_ShouldNeverCorruptOrLeakData(string maliciousBookId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs index 8ab2aed7..383dbc66 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs @@ -97,8 +97,8 @@ public class UpdateBookCoverEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateBookCover_WithSQLInjectionInRouteId_ShouldNotCorruptOrLeakData(string maliciousBookId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Maintenance/ApplicationSetup/CheckInitializationEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Maintenance/ApplicationSetup/CheckInitializationEndpointTests.cs index 5a6daf05..408a1daa 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Maintenance/ApplicationSetup/CheckInitializationEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Maintenance/ApplicationSetup/CheckInitializationEndpointTests.cs @@ -30,7 +30,7 @@ public class CheckInitializationEndpointTests : IClassFixture HttpResponseMessage response = await _client.GetAsync("/api/v1/initialization"); // Assert - // the initialization check is anonymous, so it must never demand authentication or leak any internal data + // The initialization check is anonymous, so it must never demand authentication or leak any internal data. Assert.Equal(HttpStatusCode.OK, response.StatusCode); string content = await response.Content.ReadAsStringAsync(); Assert.DoesNotContain("password", content, StringComparison.OrdinalIgnoreCase); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Maintenance/ApplicationSetup/SetupApplicationEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Maintenance/ApplicationSetup/SetupApplicationEndpointTests.cs index e0b4383e..1fdade87 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Maintenance/ApplicationSetup/SetupApplicationEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Maintenance/ApplicationSetup/SetupApplicationEndpointTests.cs @@ -45,8 +45,8 @@ public class SetupApplicationEndpointTests : IClassFixture string content = await response.Content.ReadAsStringAsync(); // Assert - // the setup endpoint is anonymous, so it must never demand authentication; the admin account is created once, so - // the request either creates it or reports that it already exists, depending on the shared database state of the class + // The setup endpoint is anonymous, so it must never demand authentication; the admin account is created once, so + // the request either creates it or reports that it already exists, depending on the shared database state of the class. Assert.True(response.StatusCode == HttpStatusCode.Created || response.StatusCode == HttpStatusCode.Conflict); Assert.DoesNotContain("password", content, StringComparison.OrdinalIgnoreCase); Assert.DoesNotContain("hash", content, StringComparison.OrdinalIgnoreCase); @@ -55,16 +55,16 @@ public class SetupApplicationEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("admin'--")] // comment injection - [InlineData("' UNION SELECT * FROM Users--")] // union injection - [InlineData("'; DROP TABLE Users--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("admin'--")] // Comment injection. + [InlineData("' UNION SELECT * FROM Users--")] // Union injection. + [InlineData("'; DROP TABLE Users--")] // Destructive injection. public async Task SetupApplication_WithSQLInjectionAttempt_ShouldRemainSecure(string maliciousUsername) { // Arrange - // note: the setup validator only checks that the username is not empty, so the malicious value reaches the handler, + // Note: the setup validator only checks that the username is not empty, so the malicious value reaches the handler, // where it is used as a literal username in parameterized queries; the security guarantee is that it never - // executes as SQL or leaks the query internals + // executes as SQL or leaks the query internals. RegistrationRequest request = _registrationRequestFixture.Create( username: maliciousUsername, password: "TestPass123!", @@ -79,8 +79,8 @@ public class SetupApplicationEndpointTests : IClassFixture string content = await response.Content.ReadAsStringAsync(); // Assert - // the malicious username is treated as literal data (the setup either creates the admin or reports that one already exists), - // so the request must never fail with an unhandled exception or leak the query internals + // The malicious username is treated as literal data (the setup either creates the admin or reports that one already exists), + // so the request must never fail with an unhandled exception or leak the query internals. Assert.True(response.StatusCode == HttpStatusCode.Created || response.StatusCode == HttpStatusCode.Conflict); Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/CompleteConsumption/CompleteConsumptionEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/CompleteConsumption/CompleteConsumptionEndpointTests.cs index 2443b39a..abf17602 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/CompleteConsumption/CompleteConsumptionEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/CompleteConsumption/CompleteConsumptionEndpointTests.cs @@ -173,11 +173,11 @@ public class CompleteConsumptionEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task CompleteConsumption_WithSqlInjectionInRecordId_ShouldRejectWithoutLeaking(string maliciousRecordId) { // Arrange @@ -193,11 +193,11 @@ public class CompleteConsumptionEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task CompleteConsumption_WithUnknownPositionKind_ShouldRejectWithoutLeaking(string maliciousPositionKind) { // Arrange @@ -218,11 +218,11 @@ public class CompleteConsumptionEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task CompleteConsumption_WithOpaquePositionLocation_ShouldStoreItVerbatimWithoutLeaking(string location) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/GetConsumptionRecord/GetConsumptionRecordEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/GetConsumptionRecord/GetConsumptionRecordEndpointTests.cs index ef53bf7f..118ad1b0 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/GetConsumptionRecord/GetConsumptionRecordEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/GetConsumptionRecord/GetConsumptionRecordEndpointTests.cs @@ -185,11 +185,11 @@ public class GetConsumptionRecordEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetConsumptionRecord_WithSqlInjectionInRecordId_ShouldRejectWithoutLeaking(string maliciousRecordId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs index 16521328..6e1247f4 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs @@ -195,8 +195,8 @@ public class GetResumePointEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("0")] // MediaKind.None, a defined enumeration member - [InlineData("1")] // MediaKind.MusicTrack, a defined enumeration member + [InlineData("0")] // MediaKind.None, a defined enumeration member. + [InlineData("1")] // MediaKind.MusicTrack, a defined enumeration member. public async Task GetResumePoint_WhenMediaKindIsNumeric_ShouldReturnUnsupportedMediaKindAndServeNoData(string numericMediaKind) { // Arrange @@ -220,11 +220,11 @@ public class GetResumePointEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaResumePoints--")] // destructive injection - [InlineData("1; DELETE FROM MediaResumePoints")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaResumePoints--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaResumePoints")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetResumePoint_WithSqlInjectionInMediaKind_ShouldRejectWithoutLeaking(string maliciousMediaKind) { // Arrange @@ -239,11 +239,11 @@ public class GetResumePointEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaResumePoints--")] // destructive injection - [InlineData("1; DELETE FROM MediaResumePoints")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaResumePoints--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaResumePoints")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task GetResumePoint_WithSqlInjectionInMediaItemId_ShouldRejectWithoutLeaking(string maliciousMediaItemId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/ReportConsumptionProgress/ReportConsumptionProgressEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/ReportConsumptionProgress/ReportConsumptionProgressEndpointTests.cs index 301f88f6..23750da0 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/ReportConsumptionProgress/ReportConsumptionProgressEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/ReportConsumptionProgress/ReportConsumptionProgressEndpointTests.cs @@ -172,11 +172,11 @@ public class ReportConsumptionProgressEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task ReportConsumptionProgress_WithSqlInjectionInRecordId_ShouldRejectWithoutLeaking(string maliciousRecordId) { // Arrange @@ -192,11 +192,11 @@ public class ReportConsumptionProgressEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task ReportConsumptionProgress_WithUnknownPositionKind_ShouldRejectWithoutLeaking(string maliciousPositionKind) { // Arrange @@ -217,11 +217,11 @@ public class ReportConsumptionProgressEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task ReportConsumptionProgress_WithOpaquePositionLocation_ShouldStoreItVerbatimWithoutLeaking(string location) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/StartConsumption/StartConsumptionEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/StartConsumption/StartConsumptionEndpointTests.cs index 4395ac74..6b4f7fce 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/StartConsumption/StartConsumptionEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/StartConsumption/StartConsumptionEndpointTests.cs @@ -147,8 +147,8 @@ public class StartConsumptionEndpointTests : IClassFixture, ID } [Theory] - [InlineData("0")] // MediaKind.None, a defined enumeration member - [InlineData("1")] // MediaKind.MusicTrack, a defined enumeration member + [InlineData("0")] // MediaKind.None, a defined enumeration member. + [InlineData("1")] // MediaKind.MusicTrack, a defined enumeration member. public async Task StartConsumption_WhenMediaKindIsNumeric_ShouldReturnUnsupportedMediaKindAndCreateNoRecord(string numericMediaKind) { // Arrange @@ -170,11 +170,11 @@ public class StartConsumptionEndpointTests : IClassFixture, ID } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task StartConsumption_WithSqlInjectionInLibraryId_ShouldRejectWithoutLeaking(string maliciousLibraryId) { // Arrange @@ -189,11 +189,11 @@ public class StartConsumptionEndpointTests : IClassFixture, ID } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task StartConsumption_WithSqlInjectionInMediaKind_ShouldRejectWithoutLeaking(string maliciousMediaKind) { // Arrange @@ -208,11 +208,11 @@ public class StartConsumptionEndpointTests : IClassFixture, ID } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task StartConsumption_WithSqlInjectionInMediaItemId_ShouldRejectWithoutLeaking(string maliciousMediaItemId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/StopConsumption/StopConsumptionEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/StopConsumption/StopConsumptionEndpointTests.cs index 1a335518..6d84bfcb 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/StopConsumption/StopConsumptionEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/MediaConsumption/StopConsumption/StopConsumptionEndpointTests.cs @@ -173,11 +173,11 @@ public class StopConsumptionEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task StopConsumption_WithSqlInjectionInRecordId_ShouldRejectWithoutLeaking(string maliciousRecordId) { // Arrange @@ -193,11 +193,11 @@ public class StopConsumptionEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task StopConsumption_WithUnknownPositionKind_ShouldRejectWithoutLeaking(string maliciousPositionKind) { // Arrange @@ -218,11 +218,11 @@ public class StopConsumptionEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // destructive injection - [InlineData("1; DELETE FROM MediaConsumptionRecords")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE MediaConsumptionRecords--")] // Destructive injection. + [InlineData("1; DELETE FROM MediaConsumptionRecords")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. public async Task StopConsumption_WithOpaquePositionLocation_ShouldStoreItVerbatimWithoutLeaking(string location) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntries/AddPlaylistEntriesEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntries/AddPlaylistEntriesEndpointTests.cs index 6d956aa8..fbe1a41c 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntries/AddPlaylistEntriesEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntries/AddPlaylistEntriesEndpointTests.cs @@ -77,12 +77,12 @@ public class AddPlaylistEntriesEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE PlaylistEntries--")] // destructive injection - [InlineData("1; DELETE FROM Playlists")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE PlaylistEntries--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task AddPlaylistEntries_WithInjectionInPlaylistId_ShouldRejectWithoutLeakingOrChangingData(string maliciousPlaylistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs index f189069d..1545782f 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs @@ -78,12 +78,12 @@ public class AddPlaylistEntryEndpointTests : IClassFixture, ID } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE PlaylistEntries--")] // destructive injection - [InlineData("1; DELETE FROM Playlists")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE PlaylistEntries--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task AddPlaylistEntry_WithInjectionInPlaylistId_ShouldRejectWithoutLeakingOrChangingData(string maliciousPlaylistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs index b956a09a..94f658ff 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs @@ -77,12 +77,12 @@ public class AddPlaylistScopeEntriesEndpointTests : IClassFixturealert(1)")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE PlaylistEntries--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task AddPlaylistScopeEntries_WithInjectionInPlaylistId_ShouldRejectWithoutLeakingOrChangingData(string maliciousPlaylistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/CreatePlaylist/CreatePlaylistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/CreatePlaylist/CreatePlaylistEndpointTests.cs index 93a64d84..6ed8b344 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/CreatePlaylist/CreatePlaylistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/CreatePlaylist/CreatePlaylistEndpointTests.cs @@ -70,11 +70,11 @@ public class CreatePlaylistEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("1; DELETE FROM Playlists")] // stacked statement injection - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task CreatePlaylist_WithInjectionInTheName_ShouldStoreItVerbatimWithoutExecutingOrLeaking(string maliciousName) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs index 5998e2e8..ebbc4a3a 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs @@ -62,12 +62,12 @@ public class DeletePlaylistEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("1; DELETE FROM Playlists")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task DeletePlaylist_WithInjectionInPlaylistId_ShouldRejectWithoutLeakingOrDeletingData(string maliciousPlaylistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs index bbd01df8..f83e7a65 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs @@ -83,12 +83,12 @@ public class GetPlaylistEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("1; DELETE FROM Playlists")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task GetPlaylist_WithInjectionInPlaylistId_ShouldRejectWithoutLeakingOrChangingData(string maliciousPlaylistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs index bebaec38..52b63f1f 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs @@ -67,12 +67,12 @@ public class MovePlaylistEntryEndpointTests : IClassFixture, I } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE PlaylistEntries--")] // destructive injection - [InlineData("1; DELETE FROM Playlists")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE PlaylistEntries--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task MovePlaylistEntry_WithInjectionInPlaylistId_ShouldRejectWithoutLeakingOrChangingTheOrder(string maliciousPlaylistId) { // Arrange @@ -91,12 +91,12 @@ public class MovePlaylistEntryEndpointTests : IClassFixture, I } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE PlaylistEntries--")] // destructive injection - [InlineData("1; DELETE FROM Playlists")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE PlaylistEntries--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task MovePlaylistEntry_WithInjectionInPlaylistEntryId_ShouldRejectWithoutLeakingOrChangingTheOrder(string maliciousEntryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs index 8b2c4e47..bf5c4919 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs @@ -62,12 +62,12 @@ public class RemovePlaylistEntryEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE PlaylistEntries--")] // destructive injection - [InlineData("1; DELETE FROM Playlists")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE PlaylistEntries--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task RemovePlaylistEntry_WithInjectionInPlaylistId_ShouldRejectWithoutLeakingOrDeletingData(string maliciousPlaylistId) { // Arrange @@ -85,12 +85,12 @@ public class RemovePlaylistEntryEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE PlaylistEntries--")] // destructive injection - [InlineData("1; DELETE FROM Playlists")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE PlaylistEntries--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task RemovePlaylistEntry_WithInjectionInPlaylistEntryId_ShouldRejectWithoutLeakingOrDeletingData(string maliciousEntryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs index 535911f8..0753abfc 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs @@ -66,11 +66,11 @@ public class UpdatePlaylistEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("1; DELETE FROM Playlists")] // stacked statement injection - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task UpdatePlaylist_WithInjectionInTheName_ShouldStoreItVerbatimWithoutExecutingOrLeaking(string maliciousName) { // Arrange @@ -96,12 +96,12 @@ public class UpdatePlaylistEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("1; DELETE FROM Playlists")] // stacked statement injection - [InlineData("../../../etc/passwd")] // path traversal - [InlineData("")] // markup injection - [InlineData("Ünïcödé-💥")] // non ascii input + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("1; DELETE FROM Playlists")] // Stacked statement injection. + [InlineData("../../../etc/passwd")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("Ünïcödé-💥")] // Non ascii input. public async Task UpdatePlaylist_WithInjectionInPlaylistId_ShouldRejectWithoutLeakingOrChangingData(string maliciousPlaylistId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/GetLibraryArtworkProviders/GetLibraryArtworkProvidersEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/GetLibraryArtworkProviders/GetLibraryArtworkProvidersEndpointTests.cs index 43eb2eae..e2a68385 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/GetLibraryArtworkProviders/GetLibraryArtworkProvidersEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/GetLibraryArtworkProviders/GetLibraryArtworkProvidersEndpointTests.cs @@ -62,12 +62,12 @@ public class GetLibraryArtworkProvidersEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Plugins--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Plugins--")] // Destructive injection. public async Task GetPluginSettings_WithSQLInjectionInPluginId_ShouldNotLeakOrError(string maliciousPluginId) { // Arrange - // authenticate with an admin user and seed a plugin, so a valid pluginId would reach the handler + // Authenticate with an admin user and seed a plugin, so a valid pluginId would reach the handler. HttpClient client = _apiFactory.CreateClient(); await _apiFactory.CreateAndAuthenticateAdminUserAsync(client); await SeedPluginAsync(); @@ -74,10 +74,10 @@ public class GetPluginSettingsEndpointTests : IClassFixture HttpResponseMessage response = await client.GetAsync($"/api/v1/plugins/{Uri.EscapeDataString(maliciousPluginId)}/settings"); // Assert - // note: the {pluginId} route parameter is Guid-typed, so the malicious value fails model binding before it reaches the handler - // note: observed status is 500 because FastEndpoints, combined with DontCatchExceptions(), turns the binding - // ValidationFailureException into a 500 response instead of 400/422 (pre-existing production bug, not fixed here) - // note: that 500 body leaks the ValidationFailureException details, so no DoesNotContain("Exception") is asserted here + // Note: the {pluginId} route parameter is Guid-typed, so the malicious value fails model binding before it reaches the handler. + // Note: observed status is 500 because FastEndpoints, combined with DontCatchExceptions(), turns the binding + // ValidationFailureException into a 500 response instead of 400/422 (pre-existing production bug, not fixed here). + // Note: that 500 body leaks the ValidationFailureException details, so no DoesNotContain("Exception") is asserted here. Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); string content = await response.Content.ReadAsStringAsync(); Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs index 8549aa52..e8993e12 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs @@ -117,7 +117,7 @@ public class InstallPluginEndpointTests : IClassFixture, IDisp await _apiFactory.CreateAndAuthenticateAdminUserAsync(client); byte[] zipBytes = CreateZipWithEntries(new Dictionary { - [@"..\evil.dll"] = "evil" // path traversal entry inside the archive + [@"..\evil.dll"] = "evil" // Path traversal entry inside the archive. }); _installedPluginFileNames.Add("evil.dll"); @@ -128,7 +128,7 @@ public class InstallPluginEndpointTests : IClassFixture, IDisp // Assert response.EnsureSuccessStatusCode(); - // the entry is flattened, so it cannot escape the plugins directory + // The entry is flattened, so it cannot escape the plugins directory. Assert.False(File.Exists(Path.Combine(AppContext.BaseDirectory, "evil.dll"))); Assert.True(File.Exists(Path.Combine(AppContext.BaseDirectory, "plugins", "evil.dll"))); Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointTests.cs index 6b507f75..13850457 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointTests.cs @@ -70,8 +70,8 @@ public class UpdatePluginSettingsEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Plugins--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Plugins--")] // Destructive injection. public async Task UpdatePluginSettings_WithSQLInjectionInSettings_ShouldNotLeakOrError(string maliciousValue) { // Arrange @@ -87,7 +87,7 @@ public class UpdatePluginSettingsEndpointTests : IClassFixture HttpResponseMessage response = await client.PutAsJsonAsync($"/api/v1/plugins/{pluginId}/settings", request); // Assert - // the malicious value passes the authenticated handler, reaches the parameterized data access, and is persisted verbatim + // The malicious value passes the authenticated handler, reaches the parameterized data access, and is persisted verbatim. Assert.Equal(HttpStatusCode.OK, response.StatusCode); string content = await response.Content.ReadAsStringAsync(); Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Scheduling/AddScheduledJob/AddScheduledJobEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Scheduling/AddScheduledJob/AddScheduledJobEndpointTests.cs index deb1580d..2ad7b2c2 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Scheduling/AddScheduledJob/AddScheduledJobEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Scheduling/AddScheduledJob/AddScheduledJobEndpointTests.cs @@ -96,9 +96,9 @@ public class AddScheduledJobEndpointTests : IClassFixture, IAs } [Theory] - [InlineData("'; DROP TABLE ScheduledJobs--")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection - [InlineData("")] // script injection + [InlineData("'; DROP TABLE ScheduledJobs--")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. + [InlineData("")] // Script injection. public async Task AddScheduledJob_WithMaliciousName_ShouldNotLeakDataOrExecuteInjection(string maliciousName) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/DeleteTheme/DeleteThemeEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/DeleteTheme/DeleteThemeEndpointTests.cs index e004fb19..18ec29b1 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/DeleteTheme/DeleteThemeEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/DeleteTheme/DeleteThemeEndpointTests.cs @@ -85,10 +85,10 @@ public class DeleteThemeEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("..%2F..%2Fevil")] // encoded slash traversal - [InlineData("%2e%2e%2f%2e%2e%2fevil")] // encoded dot-slash traversal - [InlineData("..%5Cevil")] // encoded backslash traversal - [InlineData("..%2F")] // encoded trailing slash traversal + [InlineData("..%2F..%2Fevil")] // Encoded slash traversal. + [InlineData("%2e%2e%2f%2e%2e%2fevil")] // Encoded dot-slash traversal. + [InlineData("..%5Cevil")] // Encoded backslash traversal. + [InlineData("..%2F")] // Encoded trailing slash traversal. public async Task DeleteTheme_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId) { // Arrange @@ -107,8 +107,8 @@ public class DeleteThemeEndpointTests : IClassFixture, IDispos Assert.DoesNotContain("stack trace", content, StringComparison.OrdinalIgnoreCase); Assert.DoesNotContain(AppContext.BaseDirectory, content, StringComparison.OrdinalIgnoreCase); - // note: some payloads are normalized away by the server before routing, producing an empty-body 404; - // when the value reaches the handler, the failure must still be the generic theme-not-found problem + // Note: some payloads are normalized away by the server before routing, producing an empty-body 404; + // when the value reaches the handler, the failure must still be the generic theme-not-found problem. if (!string.IsNullOrWhiteSpace(content)) { Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs index f2727a36..2df44519 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs @@ -132,7 +132,7 @@ public class InstallThemeEndpointTests : IClassFixture, IDispo await _apiFactory.CreateAndAuthenticateAdminUserAsync(client); // Act - // a multipart upload carrying a 0 byte archive reaches the theme service, which must reject it without crashing + // A multipart upload carrying a 0 byte archive reaches the theme service, which must reject it without crashing. using MultipartFormDataContent form = CreateMultipartForm([], "pack.zip", "application/zip"); HttpResponseMessage response = await client.PostAsync("/api/v1/themes", form); string content = await response.Content.ReadAsStringAsync(); @@ -187,7 +187,7 @@ public class InstallThemeEndpointTests : IClassFixture, IDispo { ["theme.json"] = VALID_MANIFEST_JSON, ["templates/default.html"] = "default", - [@"..\evil.txt"] = "evil" // path traversal entry inside the archive + [@"..\evil.txt"] = "evil" // Path traversal entry inside the archive. }); // Act diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/RestoreTheme/RestoreThemeEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/RestoreTheme/RestoreThemeEndpointTests.cs index 738e9fb7..08f923a9 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/RestoreTheme/RestoreThemeEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/RestoreTheme/RestoreThemeEndpointTests.cs @@ -118,10 +118,10 @@ public class RestoreThemeEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("..%2F..%2Fevil")] // encoded slash traversal - [InlineData("%2e%2e%2f%2e%2e%2fevil")] // encoded dot-slash traversal - [InlineData("..%5Cevil")] // encoded backslash traversal - [InlineData("..%2F")] // encoded trailing slash traversal + [InlineData("..%2F..%2Fevil")] // Encoded slash traversal. + [InlineData("%2e%2e%2f%2e%2e%2fevil")] // Encoded dot-slash traversal. + [InlineData("..%5Cevil")] // Encoded backslash traversal. + [InlineData("..%2F")] // Encoded trailing slash traversal. public async Task RestoreTheme_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId) { // Arrange @@ -140,8 +140,8 @@ public class RestoreThemeEndpointTests : IClassFixture, IDispo Assert.DoesNotContain("stack trace", content, StringComparison.OrdinalIgnoreCase); Assert.DoesNotContain(AppContext.BaseDirectory, content, StringComparison.OrdinalIgnoreCase); - // note: some payloads are normalized away by the server before routing, producing an empty-body 404; - // when the value reaches the handler, the failure must still be the generic theme-not-found problem + // Note: some payloads are normalized away by the server before routing, producing an empty-body 404; + // when the value reaches the handler, the failure must still be the generic theme-not-found problem. if (!string.IsNullOrWhiteSpace(content)) { Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/SetCurrentTheme/SetCurrentThemeEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/SetCurrentTheme/SetCurrentThemeEndpointTests.cs index 3bdefdcd..3255e07b 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/SetCurrentTheme/SetCurrentThemeEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Management/SetCurrentTheme/SetCurrentThemeEndpointTests.cs @@ -87,11 +87,11 @@ public class SetCurrentThemeEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("../evil")] // dot-dot path traversal - [InlineData("..\\..\\evil")] // backslash path traversal - [InlineData("/etc/passwd")] // absolute path traversal - [InlineData("C:\\windows\\system32")] // absolute windows path traversal - [InlineData("' OR '1'='1")] // SQL injection attempt + [InlineData("../evil")] // Dot-dot path traversal. + [InlineData("..\\..\\evil")] // Backslash path traversal. + [InlineData("/etc/passwd")] // Absolute path traversal. + [InlineData("C:\\windows\\system32")] // Absolute windows path traversal. + [InlineData("' OR '1'='1")] // SQL injection attempt. public async Task SetCurrentTheme_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeArchive/GetThemeArchiveEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeArchive/GetThemeArchiveEndpointTests.cs index fc7a46ff..c7cce5dd 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeArchive/GetThemeArchiveEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeArchive/GetThemeArchiveEndpointTests.cs @@ -59,10 +59,10 @@ public class GetThemeArchiveEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("..%2F..%2Fevil")] // encoded slash traversal - [InlineData("%2e%2e%2f%2e%2e%2fevil")] // encoded dot-slash traversal - [InlineData("..%5Cevil")] // encoded backslash traversal - [InlineData("..%2F")] // encoded trailing slash traversal + [InlineData("..%2F..%2Fevil")] // Encoded slash traversal. + [InlineData("%2e%2e%2f%2e%2e%2fevil")] // Encoded dot-slash traversal. + [InlineData("..%5Cevil")] // Encoded backslash traversal. + [InlineData("..%2F")] // Encoded trailing slash traversal. public async Task GetThemeArchive_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeAsset/GetThemeAssetEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeAsset/GetThemeAssetEndpointTests.cs index 1076a932..e7ea113c 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeAsset/GetThemeAssetEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeAsset/GetThemeAssetEndpointTests.cs @@ -74,12 +74,12 @@ public class GetThemeAssetEndpointTests : IClassFixture, IDisp } [Theory] - [InlineData("..%2F..%2Fevil.txt")] // encoded slash path traversal - [InlineData("%2e%2e%2f%2e%2e%2fevil.txt")] // encoded dot-slash path traversal - [InlineData("..%5C..%5Cevil.txt")] // encoded backslash path traversal - [InlineData("assets%2F..%2F..%2Fevil.txt")] // traversal hiding behind the assets prefix - [InlineData("C:%5Cwindows%5Csystem32%5Cdrivers%5Cetc%5Chosts")] // absolute windows path - [InlineData("..%2F..%2F..%2F..%2Fdecoy-secret.txt")] // deep traversal targeting a decoy file outside the pack + [InlineData("..%2F..%2Fevil.txt")] // Encoded slash path traversal. + [InlineData("%2e%2e%2f%2e%2e%2fevil.txt")] // Encoded dot-slash path traversal. + [InlineData("..%5C..%5Cevil.txt")] // Encoded backslash path traversal. + [InlineData("assets%2F..%2F..%2Fevil.txt")] // Traversal hiding behind the assets prefix. + [InlineData("C:%5Cwindows%5Csystem32%5Cdrivers%5Cetc%5Chosts")] // Absolute windows path. + [InlineData("..%2F..%2F..%2F..%2Fdecoy-secret.txt")] // Deep traversal targeting a decoy file outside the pack. public async Task GetThemeAsset_WithEncodedPathTraversalInAssetPath_ShouldReturnPackageInvalid(string maliciousAssetPath) { // Arrange @@ -123,10 +123,10 @@ public class GetThemeAssetEndpointTests : IClassFixture, IDisp } [Theory] - [InlineData("..%2F..%2Fevil")] // encoded slash traversal - [InlineData("%2e%2e%2f%2e%2e%2fevil")] // encoded dot-slash traversal - [InlineData("..%5Cevil")] // encoded backslash traversal - [InlineData("..%2F")] // encoded trailing slash traversal + [InlineData("..%2F..%2Fevil")] // Encoded slash traversal. + [InlineData("%2e%2e%2f%2e%2e%2fevil")] // Encoded dot-slash traversal. + [InlineData("..%5Cevil")] // Encoded backslash traversal. + [InlineData("..%2F")] // Encoded trailing slash traversal. public async Task GetThemeAsset_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeTemplate/GetThemeTemplateEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeTemplate/GetThemeTemplateEndpointTests.cs index 395b65ee..f93c43ac 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeTemplate/GetThemeTemplateEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Themes/Queries/GetThemeTemplate/GetThemeTemplateEndpointTests.cs @@ -70,10 +70,10 @@ public class GetThemeTemplateEndpointTests : IClassFixture, ID } [Theory] - [InlineData("..%2F..%2Fevil.html")] // encoded slash path traversal - [InlineData("%2e%2e%2f%2e%2e%2fevil.html")] // encoded dot-slash path traversal - [InlineData("..%5C..%5Cevil.html")] // encoded backslash path traversal - [InlineData("..%2F..%2F..%2F..%2Fdecoy-secret.txt")] // deep traversal targeting a decoy file outside the pack + [InlineData("..%2F..%2Fevil.html")] // Encoded slash path traversal. + [InlineData("%2e%2e%2f%2e%2e%2fevil.html")] // Encoded dot-slash path traversal. + [InlineData("..%5C..%5Cevil.html")] // Encoded backslash path traversal. + [InlineData("..%2F..%2F..%2F..%2Fdecoy-secret.txt")] // Deep traversal targeting a decoy file outside the pack. public async Task GetThemeTemplate_WithEncodedPathTraversalInPageKey_ShouldOnlyServeInPackTemplates(string maliciousPageKey) { // Arrange @@ -120,10 +120,10 @@ public class GetThemeTemplateEndpointTests : IClassFixture, ID } [Theory] - [InlineData("..%2F..%2Fevil")] // encoded slash traversal - [InlineData("%2e%2e%2f%2e%2e%2fevil")] // encoded dot-slash traversal - [InlineData("..%5Cevil")] // encoded backslash traversal - [InlineData("..%2F")] // encoded trailing slash traversal + [InlineData("..%2F..%2Fevil")] // Encoded slash traversal. + [InlineData("%2e%2e%2f%2e%2e%2fevil")] // Encoded dot-slash traversal. + [InlineData("..%5Cevil")] // Encoded backslash traversal. + [InlineData("..%2F")] // Encoded trailing slash traversal. public async Task GetThemeTemplate_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/ChangePasswordEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/ChangePasswordEndpointTests.cs index 7dfc8702..3ad040c4 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/ChangePasswordEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/ChangePasswordEndpointTests.cs @@ -104,8 +104,8 @@ public class ChangePasswordEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("'; DROP TABLE Users--")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Users--")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task ChangePassword_WithSQLInjectionInUsername_ShouldNotCorruptOrDeleteData(string maliciousUsername) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/LoginEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/LoginEndpointTests.cs index 8e1286ef..680cc39f 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/LoginEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/LoginEndpointTests.cs @@ -81,12 +81,12 @@ public class LoginEndpointTests : IClassFixture, IDisposable JwtSecurityTokenHandler handler = new(); JwtSecurityToken token = handler.ReadJwtToken(result!.Token); - string expValue = token.Claims.First(c => c.Type == "exp").Value; // get token claims + string expValue = token.Claims.First(c => c.Type == "exp").Value; // Get token claims. DateTimeOffset tokenExpiration = DateTimeOffset.FromUnixTimeSeconds(long.Parse(expValue)); DateTimeOffset expectedExpiration = beforeRequest.AddMinutes(15); // Verify token duration (should be 15 minutes from request time - expiration value is set in tests setup class). - TimeSpan allowedVariance = TimeSpan.FromSeconds(30); // allow for processing time + TimeSpan allowedVariance = TimeSpan.FromSeconds(30); // Allow for processing time. TimeSpan actualDifference = tokenExpiration - beforeRequest; TimeSpan expectedDifference = TimeSpan.FromMinutes(15); @@ -178,11 +178,11 @@ public class LoginEndpointTests : IClassFixture, IDisposable } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("admin'--")] // comment injection - [InlineData("' UNION SELECT * FROM Users--")] // union injection - [InlineData("'; DROP TABLE Users--")] // destructive injection - [InlineData("' WAITFOR DELAY '0:0:10'--")] // time-based injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("admin'--")] // Comment injection. + [InlineData("' UNION SELECT * FROM Users--")] // Union injection. + [InlineData("'; DROP TABLE Users--")] // Destructive injection. + [InlineData("' WAITFOR DELAY '0:0:10'--")] // Time-based injection. public async Task Login_WithSQLInjectionAttempt_ShouldRemainSecure(string maliciousUsername) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RecoverPasswordEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RecoverPasswordEndpointTests.cs index c8857b5f..a4b98367 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RecoverPasswordEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RecoverPasswordEndpointTests.cs @@ -88,8 +88,8 @@ public class RecoverPasswordEndpointTests : IClassFixture, IDi } [Theory] - [InlineData("'; DROP TABLE Users--")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Users--")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task RecoverPassword_WithSQLInjectionInUsername_ShouldNotCorruptOrDeleteData(string maliciousUsername) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RegisterEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RegisterEndpointTests.cs index db028828..5b41c30d 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RegisterEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RegisterEndpointTests.cs @@ -106,11 +106,11 @@ public class RegisterEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("admin'--")] // comment injection - [InlineData("' UNION SELECT * FROM Users--")] // union injection - [InlineData("'; DROP TABLE Users--")] // destructive injection - [InlineData("' WAITFOR DELAY '0:0:10'--")] // time-based injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("admin'--")] // Comment injection. + [InlineData("' UNION SELECT * FROM Users--")] // Union injection. + [InlineData("'; DROP TABLE Users--")] // Destructive injection. + [InlineData("' WAITFOR DELAY '0:0:10'--")] // Time-based injection. public async Task Register_WithSQLInjectionAttempt_ShouldRemainSecure(string maliciousUsername) { // Arrange @@ -135,10 +135,10 @@ public class RegisterEndpointTests : IClassFixture, IDisposabl } [Theory] - [InlineData("password123")] // common password - [InlineData("123456789")] // numeric only - [InlineData("abcdefgh")] // lowercase only - [InlineData("short")] // too short + [InlineData("password123")] // Common password. + [InlineData("123456789")] // Numeric only. + [InlineData("abcdefgh")] // Lowercase only. + [InlineData("short")] // Too short. public async Task Register_WithWeakPassword_ShouldBeDenied(string weakPassword) { // Arrange @@ -156,12 +156,12 @@ public class RegisterEndpointTests : IClassFixture, IDisposabl // Assert Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode); - Assert.DoesNotContain(weakPassword, content); // shouldn't leak the actual password + Assert.DoesNotContain(weakPassword, content); // Shouldn't leak the actual password. } [Theory] - [InlineData("TestPass123!")] // valid password - [InlineData("Ab1!defghijklmnopqrstuvwxyz")] // long password + [InlineData("TestPass123!")] // Valid password. + [InlineData("Ab1!defghijklmnopqrstuvwxyz")] // Long password. public async Task Register_WithValidPassword_ShouldAcceptPassword(string password) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissionsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissionsEndpointTests.cs index ae410e05..e7ac9440 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissionsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/UsersManagement/Authorization/UpdateUserRoleAndPermissionsEndpointTests.cs @@ -144,8 +144,8 @@ public class UpdateUserRoleAndPermissionsEndpointTests : IClassFixture } [Theory] - [InlineData(int.MaxValue)] // far above the maximum - [InlineData(int.MinValue)] // far below the minimum + [InlineData(int.MaxValue)] // Far above the maximum. + [InlineData(int.MinValue)] // Far below the minimum. public async Task UpdateUserSettings_WhenVuMeterSegmentCountIsAtAnIntExtreme_ShouldReturnValidationErrorWithoutCrashing(int vuMeterSegmentCount) { // Arrange @@ -145,8 +145,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture } [Theory] - [InlineData(int.MaxValue)] // far above the maximum - [InlineData(int.MinValue)] // far below the minimum + [InlineData(int.MaxValue)] // Far above the maximum. + [InlineData(int.MinValue)] // Far below the minimum. public async Task UpdateUserSettings_WhenVuMeterSegmentGapIsAtAnIntExtreme_ShouldReturnValidationErrorWithoutCrashing(int vuMeterSegmentGap) { // Arrange @@ -164,8 +164,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture } [Theory] - [InlineData(double.MaxValue)] // far above the maximum - [InlineData(double.MinValue)] // far below the minimum + [InlineData(double.MaxValue)] // Far above the maximum. + [InlineData(double.MinValue)] // Far below the minimum. public async Task UpdateUserSettings_WhenVuMeterMediumThresholdIsAtADoubleExtreme_ShouldReturnValidationErrorWithoutCrashing(double vuMeterMediumThreshold) { // Arrange @@ -185,8 +185,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture } [Theory] - [InlineData(double.MaxValue)] // far above the maximum - [InlineData(double.MinValue)] // far below the minimum + [InlineData(double.MaxValue)] // Far above the maximum. + [InlineData(double.MinValue)] // Far below the minimum. public async Task UpdateUserSettings_WhenVuMeterHighThresholdIsAtADoubleExtreme_ShouldReturnValidationErrorWithoutCrashing(double vuMeterHighThreshold) { // Arrange @@ -206,8 +206,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture } [Theory] - [InlineData(int.MaxValue)] // far above the maximum - [InlineData(int.MinValue)] // far below the minimum + [InlineData(int.MaxValue)] // Far above the maximum. + [InlineData(int.MinValue)] // Far below the minimum. public async Task UpdateUserSettings_WhenVuMeterPeakHoldDurationIsAtAnIntExtreme_ShouldReturnValidationErrorWithoutCrashing(int vuMeterPeakHoldDurationInMilliseconds) { // Arrange @@ -226,8 +226,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture } [Theory] - [InlineData(double.MaxValue)] // far above the maximum - [InlineData(double.MinValue)] // far below the minimum + [InlineData(double.MaxValue)] // Far above the maximum. + [InlineData(double.MinValue)] // Far below the minimum. public async Task UpdateUserSettings_WhenVuMeterReleasePerSecondIsAtADoubleExtreme_ShouldReturnValidationErrorWithoutCrashing(double vuMeterReleasePerSecond) { // Arrange @@ -245,8 +245,8 @@ public class UpdateUserSettingsEndpointTests : IClassFixture } [Theory] - [InlineData(double.MaxValue)] // far above the maximum - [InlineData(double.MinValue)] // far below the minimum + [InlineData(double.MaxValue)] // Far above the maximum. + [InlineData(double.MinValue)] // Far below the minimum. public async Task UpdateUserSettings_WhenVuMeterPeakReleasePerSecondIsAtADoubleExtreme_ShouldReturnValidationErrorWithoutCrashing(double vuMeterPeakReleasePerSecond) { // Arrange @@ -281,9 +281,9 @@ public class UpdateUserSettingsEndpointTests : IClassFixture } [Theory(Skip = "Production bug: a JSON payload whose VuMeterOrientation is not a valid enumeration value makes the FastEndpoints binder throw a System.Text.Json.JsonException, which escapes because UpdateUserSettingsEndpoint calls DontCatchExceptions(), so the API responds with 500 instead of 400 or 422. The body is the generic ProblemDetails and leaks no internals. The test stays skipped until the endpoint maps binding failures to a client error.")] - [InlineData("'; DROP TABLE UserSettings; --")] // SQL injection - [InlineData("$(rm -rf /)")] // command injection - [InlineData("{{7*7}}")] // template injection + [InlineData("'; DROP TABLE UserSettings; --")] // SQL injection. + [InlineData("$(rm -rf /)")] // Command injection. + [InlineData("{{7*7}}")] // Template injection. public async Task UpdateUserSettings_WhenVuMeterOrientationIsAMaliciousString_ShouldReturnClientErrorWithoutLeakingInternals(string maliciousOrientation) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/MediaLibrary/Artwork/BookArtworkServiceSecurityTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/MediaLibrary/Artwork/BookArtworkServiceSecurityTests.cs index 169819d2..812750c8 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/MediaLibrary/Artwork/BookArtworkServiceSecurityTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/MediaLibrary/Artwork/BookArtworkServiceSecurityTests.cs @@ -57,7 +57,7 @@ public class BookArtworkServiceSecurityTests ServiceCollection services = new(); services.AddInfrastructureLayerServices(mockConfiguration); services.AddScoped(_ => mockEnvironmentContext); - // the real path service is used, so that the sanitization of hostile segment names is exercised + // The real path service is used, so that the sanitization of hostile segment names is exercised. services.AddScoped(_ => CreateRealPathService()); services.AddSingleton(Options.Create(mediaSettings)); ServiceProvider serviceProvider = services.BuildServiceProvider(); @@ -75,7 +75,7 @@ public class BookArtworkServiceSecurityTests if (!TryCreateJunction(linkPath, targetDirectory)) { Directory.Delete(targetDirectory, true); - return; // the environment does not support creating reparse points + return; // The environment does not support creating reparse points. } try @@ -92,7 +92,7 @@ public class BookArtworkServiceSecurityTests } finally { - // Windows removes a junction with Directory.Delete, while Unix-like platforms unlink the symbolic link with File.Delete + // Windows removes a junction with Directory.Delete, while Unix-like platforms unlink the symbolic link with File.Delete. if (OperatingSystem.IsWindows()) Directory.Delete(linkPath, true); else diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointTests.cs index d22d1455..ee7eff56 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/AddRole/AddRoleEndpointTests.cs @@ -105,8 +105,8 @@ public class AddRoleEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Roles--")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Roles--")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task AddRole_WithInjectionInRoleName_ShouldRemainSecure(string maliciousRoleName) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointTests.cs index 53c891dc..8d8004b7 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/DeleteRole/DeleteRoleEndpointTests.cs @@ -87,8 +87,8 @@ public class DeleteRoleEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Roles--")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Roles--")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task DeleteRole_WithInjectionInRoleId_ShouldRemainSecure(string maliciousRoleId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointTests.cs index 378064d1..25d169c1 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/Authorization/Roles/UpdateRole/UpdateRoleEndpointTests.cs @@ -105,8 +105,8 @@ public class UpdateRoleEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Roles--")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Roles--")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateRole_WithInjectionInRoleName_ShouldRemainSecure(string maliciousRoleName) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointTests.cs index a22183a9..2e64f5ef 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Admin/UsersManagement/Authorization/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsEndpointTests.cs @@ -103,8 +103,8 @@ public class UpdateUserRoleAndPermissionsEndpointTests : IClassFixturealert(1)")] // script injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Script injection. public async Task AddFavorite_WithInjectionPayloadInMediaKind_ShouldRejectItAndNotCallTheApi(string payload) { // Arrange @@ -118,10 +118,10 @@ public class AddFavoriteEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // script injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Script injection. public async Task AddFavorite_WithInjectionPayloadInMediaItemId_ShouldRejectItAndNotCallTheApi(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/GetFavoriteStatus/GetFavoriteStatusEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/GetFavoriteStatus/GetFavoriteStatusEndpointTests.cs index ac45a54e..2fb48aac 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/GetFavoriteStatus/GetFavoriteStatusEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/GetFavoriteStatus/GetFavoriteStatusEndpointTests.cs @@ -54,10 +54,10 @@ public class GetFavoriteStatusEndpointTests : IClassFixture, I } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // script injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Script injection. public async Task GetFavoriteStatus_WithInjectionPayloadInMediaKind_ShouldRejectItAndNotCallTheApi(string payload) { // Arrange @@ -83,10 +83,10 @@ public class GetFavoriteStatusEndpointTests : IClassFixture, I } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // script injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Script injection. public async Task GetFavoriteStatus_WithInjectionPayloadInMediaItemIds_ShouldRejectItAndNotCallTheApi(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs index 72d288e9..5887d9d4 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs @@ -56,10 +56,10 @@ public class GetFavoritesEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // script injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Script injection. public async Task GetFavorites_WithInjectionPayloadInMediaKind_ShouldRejectItAndNotCallTheApi(string payload) { // Arrange @@ -85,10 +85,10 @@ public class GetFavoritesEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("currentPage", "' OR '1'='1")] // basic SQL injection in the page number - [InlineData("currentPage", "1;DROP TABLE Favorites")] // destructive injection in the page number - [InlineData("perPage", "' OR '1'='1")] // basic SQL injection in the page size - [InlineData("perPage", "../../admin")] // path traversal in the page size + [InlineData("currentPage", "' OR '1'='1")] // Basic SQL injection in the page number. + [InlineData("currentPage", "1;DROP TABLE Favorites")] // Destructive injection in the page number. + [InlineData("perPage", "' OR '1'='1")] // Basic SQL injection in the page size. + [InlineData("perPage", "../../admin")] // Path traversal in the page size. public async Task GetFavorites_WithInjectionPayloadInPagination_ShouldRejectItAndNotCallTheApi(string parameterName, string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs index 487a7fb8..86112dc3 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs @@ -86,11 +86,11 @@ public class RemoveFavoriteEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // script injection - [InlineData("MusicTrack/../../admin")] // path traversal through a valid media kind prefix + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Script injection. + [InlineData("MusicTrack/../../admin")] // Path traversal through a valid media kind prefix. public async Task RemoveFavorite_WithInjectionPayloadInMediaKind_ShouldSanitizeItAndNotForwardTheRawValue(string payload) { // Arrange @@ -118,10 +118,10 @@ public class RemoveFavoriteEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Favorites--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // script injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Favorites--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Script injection. public async Task RemoveFavorite_WithInjectionPayloadInMediaItemId_ShouldSanitizeItAndNotForwardTheRawValue(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectories/GetDirectoriesEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectories/GetDirectoriesEndpointTests.cs index 4f58512a..1a41f8ce 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectories/GetDirectoriesEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Directories/GetDirectories/GetDirectoriesEndpointTests.cs @@ -44,8 +44,8 @@ public class GetDirectoriesEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Directories--")] // destructive SQL injection - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Directories--")] // Destructive SQL injection. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task GetDirectories_WhenCalledWithInjectionInPath_ShouldRemainSecure(string maliciousPath) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Files/GetFiles/GetFilesEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Files/GetFiles/GetFilesEndpointTests.cs index aec5d2fc..5780559b 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Files/GetFiles/GetFilesEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Files/GetFiles/GetFilesEndpointTests.cs @@ -44,8 +44,8 @@ public class GetFilesEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Files--")] // destructive SQL injection - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Files--")] // Destructive SQL injection. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task GetFiles_WhenCalledWithInjectionInPath_ShouldRemainSecure(string maliciousPath) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExists/CheckPathExistsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExists/CheckPathExistsEndpointTests.cs index 0b5a8761..02f5ef0e 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExists/CheckPathExistsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/CheckPathExists/CheckPathExistsEndpointTests.cs @@ -45,8 +45,8 @@ public class CheckPathExistsEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Paths--")] // destructive SQL injection - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Paths--")] // Destructive SQL injection. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task CheckPathExists_WhenCalledWithInjectionInPath_ShouldRemainSecure(string maliciousPath) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathParent/GetPathParentEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathParent/GetPathParentEndpointTests.cs index 8bc0c82a..afd815ee 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathParent/GetPathParentEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathParent/GetPathParentEndpointTests.cs @@ -44,8 +44,8 @@ public class GetPathParentEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Paths--")] // destructive SQL injection - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Paths--")] // Destructive SQL injection. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task GetPathParent_WhenCalledWithInjectionInPath_ShouldRemainSecure(string maliciousPath) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs index f05f993e..6a22272a 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs @@ -45,15 +45,15 @@ public class GetPathRootEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Paths--")] // destructive SQL injection - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Paths--")] // Destructive SQL injection. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task GetPathRoot_WhenCalledWithInjectionInPath_ShouldRemainSecure(string maliciousPath) { // Arrange _apiFactory.ApiClientStub.Reset(); string expectedEndpoint = $"path/get-path-root?path={Uri.EscapeDataString(maliciousPath)}"; - // a deterministic path keeps the content assertions independent of randomized fixture data, which could - // otherwise contain one of the forbidden substrings by coincidence + // A deterministic path keeps the content assertions independent of randomized fixture data, which could + // otherwise contain one of the forbidden substrings by coincidence. _apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, _pathSegmentDtoFixture.Create(path: "/documents/reports/final-report.pdf")); AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); HttpRequestMessage getRequest = new(HttpMethod.Get, $"/path/api-get-path-root?path={Uri.EscapeDataString(maliciousPath)}"); diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointTests.cs index 0c42a838..cea326a1 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/SplitPath/SplitPathEndpointTests.cs @@ -44,8 +44,8 @@ public class SplitPathEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Paths--")] // destructive SQL injection - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Paths--")] // Destructive SQL injection. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task SplitPath_WhenCalledWithInjectionInPath_ShouldRemainSecure(string maliciousPath) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpointTests.cs index a145872e..89b0fce0 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/ValidatePath/ValidatePathEndpointTests.cs @@ -45,8 +45,8 @@ public class ValidatePathEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Paths--")] // destructive SQL injection - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Paths--")] // Destructive SQL injection. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task ValidatePath_WhenCalledWithInjectionInPath_ShouldRemainSecure(string maliciousPath) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpointTests.cs index eedd5a34..1a34ce95 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpointTests.cs @@ -46,9 +46,9 @@ public class GetThumbnailEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Thumbnails--")] // destructive SQL injection - [InlineData("..\\..\\appsettings.json")] // path traversal - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Thumbnails--")] // Destructive SQL injection. + [InlineData("..\\..\\appsettings.json")] // Path traversal. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task GetThumbnail_WhenCalledWithInjectionInPath_ShouldRemainSecure(string maliciousPath) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs index f91858f0..27e0e527 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs @@ -31,8 +31,8 @@ public class DeleteMusicAlbumEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task DeleteMusicAlbum_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverDeleteAnotherAlbum(string maliciousId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs index 0658ff50..72776ec8 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs @@ -49,8 +49,8 @@ public class GetArtistAlbumsEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetArtistAlbums_WithSQLInjectionInArtistId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs index f84c387a..2fbbabb1 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs @@ -48,8 +48,8 @@ public class GetMusicAlbumEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetMusicAlbum_WithSQLInjectionInRouteId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/RestoreMusicAlbum/RestoreMusicAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/RestoreMusicAlbum/RestoreMusicAlbumEndpointTests.cs index 05cc74b6..6ac72e1e 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/RestoreMusicAlbum/RestoreMusicAlbumEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/RestoreMusicAlbum/RestoreMusicAlbumEndpointTests.cs @@ -32,8 +32,8 @@ public class RestoreMusicAlbumEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task RestoreMusicAlbum_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverRestoreAnotherAlbum(string maliciousId) { // Arrange @@ -58,8 +58,8 @@ public class RestoreMusicAlbumEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task RestoreMusicAlbum_WithSQLInjectionInLibraryQueryId_ShouldNormalizeTheLibraryId(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs index de55bc26..4903d571 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs @@ -38,8 +38,8 @@ public class SaveMusicAlbumEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task SaveMusicAlbum_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverCallAnotherAlbum(string maliciousId) { // Arrange @@ -67,8 +67,8 @@ public class SaveMusicAlbumEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task SaveMusicAlbum_WithSQLInjectionInLibraryQueryId_ShouldNormalizeTheLibraryId(string maliciousLibraryId) { // Arrange @@ -93,8 +93,8 @@ public class SaveMusicAlbumEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task SaveMusicAlbum_WithSQLInjectionInPostedTitle_ShouldNotLeakOrExecuteIt(string maliciousTitle) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs index a4424354..a085e307 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs @@ -33,8 +33,8 @@ public class UpdateAlbumCoverEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Albums; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Albums; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateAlbumCover_WithSQLInjectionInRouteId_ShouldNeverReachAnAlbumOrLeakData(string maliciousId) { // Arrange @@ -57,8 +57,8 @@ public class UpdateAlbumCoverEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE MusicArtwork; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE MusicArtwork; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateAlbumCover_WithSQLInjectionInLibraryQueryId_ShouldNormalizeItAndNotLeakData(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs index 377f1e60..05ce1afc 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs @@ -31,8 +31,8 @@ public class DeleteMusicArtistEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task DeleteMusicArtist_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverDeleteAnotherArtist(string maliciousId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs index 6cbdf0f7..7afacbd2 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs @@ -48,8 +48,8 @@ public class GetMusicArtistEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetMusicArtist_WithSQLInjectionInRouteId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs index 784d5091..b41a9257 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs @@ -49,8 +49,8 @@ public class GetMusicArtistsEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Artists--")] // destructive SQL injection - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Artists--")] // Destructive SQL injection. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task GetMusicArtists_WhenCalledWithInjectionInSearchTerm_ShouldRemainSecure(string maliciousSearchTerm) { // Arrange @@ -80,8 +80,8 @@ public class GetMusicArtistsEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Artists--")] // destructive SQL injection - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Artists--")] // Destructive SQL injection. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task GetMusicArtists_WhenCalledWithInjectionInFilterAlphaKey_ShouldRemainSecure(string maliciousAlphaKey) { // Arrange @@ -106,8 +106,8 @@ public class GetMusicArtistsEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Artists--")] // destructive SQL injection - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Artists--")] // Destructive SQL injection. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task GetMusicArtists_WhenCalledWithInjectionInSortBy_ShouldRemainSecure(string maliciousSortBy) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/RestoreMusicArtist/RestoreMusicArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/RestoreMusicArtist/RestoreMusicArtistEndpointTests.cs index 9dbe7890..82f93ed0 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/RestoreMusicArtist/RestoreMusicArtistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/RestoreMusicArtist/RestoreMusicArtistEndpointTests.cs @@ -32,8 +32,8 @@ public class RestoreMusicArtistEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task RestoreMusicArtist_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverRestoreAnotherArtist(string maliciousId) { // Arrange @@ -58,8 +58,8 @@ public class RestoreMusicArtistEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task RestoreMusicArtist_WithSQLInjectionInLibraryQueryId_ShouldNormalizeTheLibraryId(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs index 5af3b5a0..ba7283a2 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs @@ -37,8 +37,8 @@ public class SaveMusicArtistEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task SaveMusicArtist_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverCallAnotherArtist(string maliciousId) { // Arrange @@ -66,8 +66,8 @@ public class SaveMusicArtistEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task SaveMusicArtist_WithSQLInjectionInLibraryQueryId_ShouldNormalizeTheLibraryId(string maliciousLibraryId) { // Arrange @@ -91,8 +91,8 @@ public class SaveMusicArtistEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task SaveMusicArtist_WithSQLInjectionInPostedName_ShouldNotLeakOrExecuteIt(string maliciousName) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs index 31b778d2..59139441 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs @@ -33,8 +33,8 @@ public class UpdateArtistCoverEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Artists; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Artists; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateArtistCover_WithSQLInjectionInRouteId_ShouldNeverReachAnArtistOrLeakData(string maliciousId) { // Arrange @@ -57,8 +57,8 @@ public class UpdateArtistCoverEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE MusicArtwork; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE MusicArtwork; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateArtistCover_WithSQLInjectionInLibraryQueryId_ShouldNormalizeItAndNotLeakData(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/DeletedMusicItems/DeletedMusicItemsViewEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/DeletedMusicItems/DeletedMusicItemsViewEndpointTests.cs index 8360913a..7f785c82 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/DeletedMusicItems/DeletedMusicItemsViewEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/DeletedMusicItems/DeletedMusicItemsViewEndpointTests.cs @@ -44,8 +44,8 @@ public class DeletedMusicItemsViewEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Libraries--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Libraries--")] // Destructive injection. public async Task ScanLibrary_WithInjectionInId_ShouldNotLeakOrError(string maliciousId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs index 8b010c76..90011945 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs @@ -96,8 +96,8 @@ public class DeleteConsumptionItemHistoryEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task DeleteBook_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverDeleteAnotherBook(string maliciousId) { // Arrange @@ -54,8 +54,8 @@ public class DeleteBookEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task DeleteBook_WithSQLInjectionInLibraryQueryId_ShouldNormalizeTheLibraryId(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBookDetails/GetBookDetailsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBookDetails/GetBookDetailsEndpointTests.cs index 079263c2..15ba3658 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBookDetails/GetBookDetailsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBookDetails/GetBookDetailsEndpointTests.cs @@ -48,8 +48,8 @@ public class GetBookDetailsEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task GetBookDetails_WithSQLInjectionInBookId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousBookId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointTests.cs index e866a815..65219347 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointTests.cs @@ -47,8 +47,8 @@ public class GetLibraryItemsEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books--")] // destructive SQL injection - [InlineData("' OR '1'='1")] // basic SQL injection + [InlineData("'; DROP TABLE Books--")] // Destructive SQL injection. + [InlineData("' OR '1'='1")] // Basic SQL injection. public async Task GetLibraryItems_WhenCalledWithInjectionInSearchTerm_ShouldRemainSecure(string maliciousSearchTerm) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs index 2492f5db..0a95613a 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs @@ -49,8 +49,8 @@ public class GetReadingAvailabilityEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Books--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Books--")] // Destructive injection. public async Task GetReadingManifest_WhenCalledWithInjectionInBookId_ShouldRemainSecure(string maliciousBookId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs index 696e9977..dc322c5c 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs @@ -47,8 +47,8 @@ public class GetReadingResourceEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("../../etc/passwd")] // directory traversal + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("../../etc/passwd")] // Directory traversal. public async Task GetReadingResource_WhenCalledWithMaliciousResourceKey_ShouldRemainSecure(string maliciousResourceKey) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs index 9473a415..d7b2981c 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs @@ -49,8 +49,8 @@ public class GetReadingSectionEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Books--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Books--")] // Destructive injection. public async Task GetReadingSection_WhenCalledWithInjectionInLocationRef_ShouldRemainSecure(string maliciousLocationRef) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/RestoreBook/RestoreBookEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/RestoreBook/RestoreBookEndpointTests.cs index 292466e5..62cf5544 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/RestoreBook/RestoreBookEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/RestoreBook/RestoreBookEndpointTests.cs @@ -28,8 +28,8 @@ public class RestoreBookEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task RestoreBook_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverRestoreAnotherBook(string maliciousId) { // Arrange @@ -54,8 +54,8 @@ public class RestoreBookEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task RestoreBook_WithSQLInjectionInLibraryQueryId_ShouldNormalizeTheLibraryId(string maliciousLibraryId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointTests.cs index edff3a6b..0d1930d3 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointTests.cs @@ -38,8 +38,8 @@ public class SaveBookEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task SaveBook_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverCallTheBodyBookEndpoint(string maliciousBookId) { // Arrange @@ -69,8 +69,8 @@ public class SaveBookEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task SaveBook_WithSQLInjectionInPostedTitle_ShouldNotLeakOrExecuteIt(string maliciousTitle) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs index e1ffbdb8..825ca945 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs @@ -31,8 +31,8 @@ public class UpdateBookCoverEndpointTests : IClassFixture } [Theory] - [InlineData("'; DROP TABLE Books; --")] // destructive injection - [InlineData("' OR '1'='1")] // boolean-based injection + [InlineData("'; DROP TABLE Books; --")] // Destructive injection. + [InlineData("' OR '1'='1")] // Boolean-based injection. public async Task UpdateBookCover_WithSQLInjectionInRouteId_ShouldNeverReachABookOrLeakData(string maliciousBookId) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/CompleteConsumption/CompleteConsumptionEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/CompleteConsumption/CompleteConsumptionEndpointTests.cs index 4545d330..426d41ce 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/CompleteConsumption/CompleteConsumptionEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/CompleteConsumption/CompleteConsumptionEndpointTests.cs @@ -124,10 +124,10 @@ public class CompleteConsumptionEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // script injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Script injection. public async Task CompleteConsumption_WithInjectionPayloadInRecordId_ShouldUseTheEmptyGuidAndNotForwardTheRawValue(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs index 85becd9a..91a6659b 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs @@ -60,11 +60,11 @@ public class GetResumePointEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // script injection - [InlineData("MusicTrack/../../admin")] // path traversal through a valid media kind prefix + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Script injection. + [InlineData("MusicTrack/../../admin")] // Path traversal through a valid media kind prefix. public async Task GetResumePoint_WithInjectionPayloadInMediaKind_ShouldSanitizeItAndNotForwardTheRawValue(string payload) { // Arrange @@ -91,10 +91,10 @@ public class GetResumePointEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // script injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Script injection. public async Task GetResumePoint_WithInjectionPayloadInMediaItemId_ShouldUseTheEmptyGuidAndNotForwardTheRawValue(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/ReportConsumptionProgress/ReportConsumptionProgressEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/ReportConsumptionProgress/ReportConsumptionProgressEndpointTests.cs index 033a731b..de3ff69e 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/ReportConsumptionProgress/ReportConsumptionProgressEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/MediaConsumption/ReportConsumptionProgress/ReportConsumptionProgressEndpointTests.cs @@ -122,10 +122,10 @@ public class ReportConsumptionProgressEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. public async Task AddPlaylistEntries_WithInjectionPayloadInPlaylistId_ShouldNormalizeItAndNotForwardTheRawValue(string payload) { // Arrange @@ -137,9 +137,9 @@ public class AddPlaylistEntriesEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("../../admin")] // path traversal + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. public async Task AddPlaylistEntries_WithInjectionPayloadInTrackIds_ShouldRejectTheRequestWithoutCallingTheApi(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs index 96a0e975..d2dc9f1c 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs @@ -105,10 +105,10 @@ public class AddPlaylistEntryEndpointTests : IClassFixture, ID } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. public async Task AddPlaylistEntry_WithInjectionPayloadInPlaylistId_ShouldNormalizeItAndNotForwardTheRawValue(string payload) { // Arrange @@ -134,9 +134,9 @@ public class AddPlaylistEntryEndpointTests : IClassFixture, ID } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("../../admin")] // path traversal + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. public async Task AddPlaylistEntry_WithInjectionPayloadInTrackId_ShouldRejectTheRequestWithoutCallingTheApi(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs index 28d8705b..65b9e87a 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs @@ -105,10 +105,10 @@ public class AddPlaylistScopeEntriesEndpointTests : IClassFixturealert(1)")] // markup injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. public async Task AddPlaylistScopeEntries_WithInjectionPayloadInPlaylistId_ShouldNormalizeItAndNotForwardTheRawValue(string payload) { // Arrange @@ -134,9 +134,9 @@ public class AddPlaylistScopeEntriesEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. public async Task CreatePlaylist_WithInjectionPayloadInName_ShouldNotFailOrLeakThePayload(string payload) { // Arrange @@ -134,8 +134,8 @@ public class CreatePlaylistEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. public async Task CreatePlaylist_WithInjectionPayloadInType_ShouldRejectTheRequestWithoutCallingTheApi(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs index f7d11935..d0dca891 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs @@ -98,10 +98,10 @@ public class DeletePlaylistEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. public async Task DeletePlaylist_WithInjectionPayloadInPlaylistId_ShouldNormalizeItAndNotForwardTheRawValue(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs index 59042451..0d31f9aa 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs @@ -97,11 +97,11 @@ public class GetPlaylistEndpointTests : IClassFixture, IDispos } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection - [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // unicode payload + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // Unicode payload. public async Task GetPlaylist_WithInjectionPayloadInPlaylistId_ShouldNormalizeItAndNotForwardTheRawValue(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/GetPlaylists/GetPlaylistsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/GetPlaylists/GetPlaylistsEndpointTests.cs index 58c3d3fd..9c8182dc 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/GetPlaylists/GetPlaylistsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/GetPlaylists/GetPlaylistsEndpointTests.cs @@ -87,10 +87,10 @@ public class GetPlaylistsEndpointTests : IClassFixture, IDispo } [Theory] - [InlineData("other-user-id")] // a plain identifier of another user - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("../../admin")] // path traversal + [InlineData("other-user-id")] // A plain identifier of another user. + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. public async Task GetPlaylists_WithAnotherUserIdInTheQueryString_ShouldKeepTheUsersMeScope(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/Item/PlaylistItemViewEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/Item/PlaylistItemViewEndpointTests.cs index f1d1c94c..ffd2a26b 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/Item/PlaylistItemViewEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/Item/PlaylistItemViewEndpointTests.cs @@ -105,11 +105,11 @@ public class PlaylistItemViewEndpointTests : IClassFixture, ID } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection - [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // unicode payload + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // Unicode payload. public async Task PlaylistItemView_WithInjectionPayloadInPlaylistId_ShouldNormalizeItAndNotForwardTheRawValue(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs index b9d6ec3f..e48aecc1 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs @@ -105,10 +105,10 @@ public class MovePlaylistEntryEndpointTests : IClassFixture, I } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. public async Task MovePlaylistEntry_WithInjectionPayloadInRouteIds_ShouldNormalizeThemAndNotForwardTheRawValues(string payload) { // Arrange @@ -139,8 +139,8 @@ public class MovePlaylistEntryEndpointTests : IClassFixture, I } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. public async Task MovePlaylistEntry_WithInjectionPayloadInTargetPosition_ShouldRejectTheRequestWithoutCallingTheApi(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs index fef630f2..b97e8eb9 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs @@ -98,10 +98,10 @@ public class RemovePlaylistEntryEndpointTests : IClassFixture, } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. public async Task RemovePlaylistEntry_WithInjectionPayloadInRouteIds_ShouldNormalizeThemAndNotForwardTheRawValues(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs index effaf129..a90a83a0 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs @@ -105,10 +105,10 @@ public class UpdatePlaylistEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. public async Task UpdatePlaylist_WithInjectionPayloadInPlaylistId_ShouldNormalizeItAndNotForwardTheRawValue(string payload) { // Arrange @@ -135,10 +135,10 @@ public class UpdatePlaylistEndpointTests : IClassFixture, IDis } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Playlists--")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Playlists--")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. public async Task UpdatePlaylist_WithInjectionPayloadInName_ShouldNotFailOrLeakThePayload(string payload) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Plugins/GetPluginSettings/GetPluginSettingsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Plugins/GetPluginSettings/GetPluginSettingsEndpointTests.cs index 7a433c6f..259ed7c9 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Plugins/GetPluginSettings/GetPluginSettingsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Plugins/GetPluginSettings/GetPluginSettingsEndpointTests.cs @@ -47,8 +47,8 @@ public class GetPluginSettingsEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Plugins--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Plugins--")] // Destructive injection. public async Task GetPluginSettings_WithInjectionInPluginId_ShouldNotLeakOrError(string maliciousPluginId) { // Arrange @@ -62,8 +62,8 @@ public class GetPluginSettingsEndpointTests : IClassFixture string content = await response.Content.ReadAsStringAsync(); // Assert - // note: the {pluginId} route parameter is Guid-typed, so the malicious value fails model binding and never - // reaches the handler; the Web application reports the binding failure as a 200 response carrying success=false + // Note: the {pluginId} route parameter is Guid-typed, so the malicious value fails model binding and never + // Reaches the handler; the Web application reports the binding failure as a 200 response carrying success=false. using JsonDocument json = JsonDocument.Parse(content); Assert.False(json.RootElement.GetProperty("success").GetBoolean()); Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Themes/ThemeAssets/ThemeAssetsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Themes/ThemeAssets/ThemeAssetsEndpointTests.cs index fdf4df2d..94b211aa 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Themes/ThemeAssets/ThemeAssetsEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Themes/ThemeAssets/ThemeAssetsEndpointTests.cs @@ -48,8 +48,8 @@ public class ThemeAssetsEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("'; DROP TABLE Themes--")] // destructive injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("'; DROP TABLE Themes--")] // Destructive injection. public async Task ThemeAssets_WithInjectionInThemeId_ShouldNotLeakOrError(string maliciousThemeId) { // Arrange @@ -71,8 +71,8 @@ public class ThemeAssetsEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("..\\..\\appsettings.json")] // path traversal + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("..\\..\\appsettings.json")] // Path traversal. public async Task ThemeAssets_WithInjectionInPath_ShouldNotLeakOrError(string maliciousPath) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/ChangePassword/ChangePasswordEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/ChangePassword/ChangePasswordEndpointTests.cs index 9c1cb631..4be9ba51 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/ChangePassword/ChangePasswordEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/ChangePassword/ChangePasswordEndpointTests.cs @@ -82,11 +82,11 @@ public class ChangePasswordEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("admin'--")] // comment injection - [InlineData("' UNION SELECT * FROM Users--")] // union injection - [InlineData("'; DROP TABLE Users--")] // destructive injection - [InlineData("{{7*7}}")] // template injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("admin'--")] // Comment injection. + [InlineData("' UNION SELECT * FROM Users--")] // Union injection. + [InlineData("'; DROP TABLE Users--")] // Destructive injection. + [InlineData("{{7*7}}")] // Template injection. public async Task ChangePassword_WithInjectionAttemptInNewPassword_ShouldRemainSecure(string maliciousNewPassword) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpointTests.cs index c310e773..2db6240b 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpointTests.cs @@ -35,11 +35,11 @@ public class LoginEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("admin'--")] // comment injection - [InlineData("' UNION SELECT * FROM Users--")] // union injection - [InlineData("'; DROP TABLE Users--")] // destructive injection - [InlineData("{{7*7}}")] // template injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("admin'--")] // Comment injection. + [InlineData("' UNION SELECT * FROM Users--")] // Union injection. + [InlineData("'; DROP TABLE Users--")] // Destructive injection. + [InlineData("{{7*7}}")] // Template injection. public async Task Login_WithInjectionAttemptInUsername_ShouldRemainSecure(string maliciousUsername) { // Arrange @@ -81,7 +81,7 @@ public class LoginEndpointTests : IClassFixture Assert.DoesNotContain("TestPass123!", content); Assert.DoesNotContain("hash", content, StringComparison.OrdinalIgnoreCase); Assert.DoesNotContain("salt", content, StringComparison.OrdinalIgnoreCase); - // the JWT token returned by the API must not be exposed in plaintext; it is stored encrypted in the Token cookie + // The JWT token returned by the API must not be exposed in plaintext; it is stored encrypted in the Token cookie. Assert.DoesNotContain("test_jwt_token", content); string allSetCookies = string.Join("; ", response.Headers.GetValues("Set-Cookie")); Assert.Contains("Token=", allSetCookies); diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RecoverPassword/RecoverPasswordEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RecoverPassword/RecoverPasswordEndpointTests.cs index 5ffa3257..5ba8909f 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RecoverPassword/RecoverPasswordEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/RecoverPassword/RecoverPasswordEndpointTests.cs @@ -35,11 +35,11 @@ public class RecoverPasswordEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("admin'--")] // comment injection - [InlineData("' UNION SELECT * FROM Users--")] // union injection - [InlineData("'; DROP TABLE Users--")] // destructive injection - [InlineData("{{7*7}}")] // template injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("admin'--")] // Comment injection. + [InlineData("' UNION SELECT * FROM Users--")] // Union injection. + [InlineData("'; DROP TABLE Users--")] // Destructive injection. + [InlineData("{{7*7}}")] // Template injection. public async Task RecoverPassword_WithInjectionAttemptInUsername_ShouldRemainSecure(string maliciousUsername) { // Arrange diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/Register/RegisterEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/Register/RegisterEndpointTests.cs index 2487d7a8..d72bd1f8 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/Register/RegisterEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/UsersManagement/Authentication/Register/RegisterEndpointTests.cs @@ -35,11 +35,11 @@ public class RegisterEndpointTests : IClassFixture } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("admin'--")] // comment injection - [InlineData("' UNION SELECT * FROM Users--")] // union injection - [InlineData("'; DROP TABLE Users--")] // destructive injection - [InlineData("{{7*7}}")] // template injection + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("admin'--")] // Comment injection. + [InlineData("' UNION SELECT * FROM Users--")] // Union injection. + [InlineData("'; DROP TABLE Users--")] // Destructive injection. + [InlineData("{{7*7}}")] // Template injection. public async Task Register_WithInjectionAttemptInUsername_ShouldRemainSecure(string maliciousUsername) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/CQRS/HandlersCallTheirValidatorsTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/CQRS/HandlersCallTheirValidatorsTests.cs index 0672be4a..ac29585f 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/CQRS/HandlersCallTheirValidatorsTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/CQRS/HandlersCallTheirValidatorsTests.cs @@ -123,7 +123,7 @@ public class HandlersCallTheirValidatorsTests int offset = 0; while (offset < il.Length) { - // read the opcode, handling the 0xFE prefix used by two-byte opcodes + // Read the opcode, handling the 0xFE prefix used by two-byte opcodes. short opCodeValue = il[offset]; int opCodeSize = 1; if (opCodeValue == 0xFE && offset + 1 < il.Length) @@ -152,15 +152,15 @@ public class HandlersCallTheirValidatorsTests } catch (ArgumentException) { - // the token is not a valid method token, skip it + // The token is not a valid method token, skip it. } catch (BadImageFormatException) { - // the token references corrupt metadata, skip it + // The token references corrupt metadata, skip it. } catch (InvalidOperationException) { - // the token cannot be resolved as a method, skip it + // The token cannot be resolved as a method, skip it. } } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/Directories/DirectoryMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/Directories/DirectoryMappingTests.cs index a262a5b5..ba9a84c9 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/Directories/DirectoryMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/Directories/DirectoryMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/FileSystem/FileSystemItemMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/FileSystem/FileSystemItemMappingTests.cs index 92de7a8e..d7beaa30 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/FileSystem/FileSystemItemMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/FileSystem/FileSystemItemMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/Files/FileMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/Files/FileMappingTests.cs index e32305ae..d45251d4 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/Files/FileMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/FileSystemManagement/Files/FileMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/GetMostConsumedRequestMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/GetMostConsumedRequestMappingTests.cs index 31f886b7..deaabd1c 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/GetMostConsumedRequestMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/GetMostConsumedRequestMappingTests.cs @@ -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, diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/GetRecentlyConsumedRequestMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/GetRecentlyConsumedRequestMappingTests.cs index 3700f3be..d1240752 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/GetRecentlyConsumedRequestMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/GetRecentlyConsumedRequestMappingTests.cs @@ -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, diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaConsumptionRecordEntityMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaConsumptionRecordEntityMappingTests.cs index d864aa84..6043981a 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaConsumptionRecordEntityMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaConsumptionRecordEntityMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaKindConsumptionStatisticsDtoMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaKindConsumptionStatisticsDtoMappingTests.cs index f7cccf1d..a19eaf1e 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaKindConsumptionStatisticsDtoMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaKindConsumptionStatisticsDtoMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaResumePointEntityMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaResumePointEntityMappingTests.cs index e73cbc04..258fd0a1 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaResumePointEntityMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaConsumption/MediaResumePointEntityMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMappingTests.cs index d373afcf..fa367c49 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMappingTests.cs @@ -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); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/ArtistAliasEntityMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/ArtistAliasEntityMappingTests.cs index 5922a39f..862b4061 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/ArtistAliasEntityMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/ArtistAliasEntityMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/IsrcDtoMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/IsrcDtoMappingTests.cs index a3049af4..d60957ee 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/IsrcDtoMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/IsrcDtoMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/IsrcEntityMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/IsrcEntityMappingTests.cs index 2408a577..4be5be7e 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/IsrcEntityMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/IsrcEntityMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MoodDtoMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MoodDtoMappingTests.cs index 1798a966..918a3350 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MoodDtoMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MoodDtoMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MoodEntityMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MoodEntityMappingTests.cs index 8c6ad9f6..66920b97 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MoodEntityMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MoodEntityMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicAreaDtoMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicAreaDtoMappingTests.cs index 39431223..413b9c34 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicAreaDtoMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicAreaDtoMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicAreaEntityMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicAreaEntityMappingTests.cs index 060be802..8f4a93e1 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicAreaEntityMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicAreaEntityMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicArtistAliasDtoMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicArtistAliasDtoMappingTests.cs index fe8d7b0e..761c7970 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicArtistAliasDtoMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Common/MusicArtistAliasDtoMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/MusicWorkDtoMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/MusicWorkDtoMappingTests.cs index 4383b3c5..879f9c95 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/MusicWorkDtoMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/MusicWorkDtoMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/ShuffleTracksRequestMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/ShuffleTracksRequestMappingTests.cs index 0aa7879e..1cf0b13b 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/ShuffleTracksRequestMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/ShuffleTracksRequestMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMappingTests.cs index 1957b668..984ec227 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMappingTests.cs @@ -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); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/Management/GetLibraryPathTemplatePartsRequestMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/Management/GetLibraryPathTemplatePartsRequestMappingTests.cs index 7f651edd..277cd293 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/Management/GetLibraryPathTemplatePartsRequestMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/Management/GetLibraryPathTemplatePartsRequestMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookMappingTests.cs index dae97b83..18f73045 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookMappingTests.cs @@ -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); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookMetadataDtoMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookMetadataDtoMappingTests.cs index d94307bc..73d624f4 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookMetadataDtoMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/BookMetadataDtoMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/BookRatingDtoMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/BookRatingDtoMappingTests.cs index 8126c123..869c4e85 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/BookRatingDtoMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/BookRatingDtoMappingTests.cs @@ -104,13 +104,13 @@ public class BookRatingDtoMappingTests foreach (Result 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); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/BookRatingMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/BookRatingMappingTests.cs index 7913f255..b0d91f3d 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/BookRatingMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/BookRatingMappingTests.cs @@ -92,19 +92,19 @@ public class BookRatingMappingTests List 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); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/IsbnDtoMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/IsbnDtoMappingTests.cs index 9855a514..804aa30b 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/IsbnDtoMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/WrittenContentLibrary/BookLibrary/Common/IsbnDtoMappingTests.cs @@ -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] diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UserManagement/Users/UserMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UserManagement/Users/UserMappingTests.cs index ef7c73ef..6a8381b6 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UserManagement/Users/UserMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UserManagement/Users/UserMappingTests.cs @@ -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); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdatePlaybackStateRequestMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdatePlaybackStateRequestMappingTests.cs index 29a90003..c27fbf9a 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdatePlaybackStateRequestMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/UsersManagement/Users/UpdatePlaybackStateRequestMappingTests.cs @@ -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 diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Telemetry/TelemetryTestHelpers.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Telemetry/TelemetryTestHelpers.cs index 64c03f30..c881fbb8 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Telemetry/TelemetryTestHelpers.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Telemetry/TelemetryTestHelpers.cs @@ -49,7 +49,7 @@ internal static class TelemetryTestHelpers }; // InstrumentPublished fires for instruments created after Start(), and Start() also replays every instrument // that already exists on the meter; therefore the lazily-initialized static handler instruments are captured by - // every listener, whether they were created before or during the test + // every listener, whether they were created before or during the test. listener.SetMeasurementEventCallback((instrument, value, tags, state) => measurements.Add((instrument.Name, value, GetOutcomeTag(tags)))); listener.SetMeasurementEventCallback((instrument, value, tags, state) => measurements.Add((instrument.Name, value, GetOutcomeTag(tags)))); listener.Start(); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/AudioFileFormatUtilitiesTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/AudioFileFormatUtilitiesTests.cs index 43e9c9ef..200ea9b3 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/AudioFileFormatUtilitiesTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/AudioFileFormatUtilitiesTests.cs @@ -13,21 +13,21 @@ namespace Lumina.Application.UnitTests.Common.Utilities; public class AudioFileFormatUtilitiesTests { [Theory] - [InlineData("track.mp3", AudioFileFormat.MP3)] // mp3 audio file - [InlineData("track.flac", AudioFileFormat.FLAC)] // flac audio file - [InlineData("track.m4a", AudioFileFormat.M4A)] // m4a audio file - [InlineData("track.aac", AudioFileFormat.AAC)] // aac audio file - [InlineData("track.ogg", AudioFileFormat.OGG)] // ogg audio file - [InlineData("track.opus", AudioFileFormat.OPUS)] // opus audio file - [InlineData("track.wav", AudioFileFormat.WAV)] // wav audio file - [InlineData("track.wma", AudioFileFormat.WMA)] // wma audio file - [InlineData("track.aiff", AudioFileFormat.AIFF)] // aiff audio file - [InlineData("track.aif", AudioFileFormat.AIFF)] // aif audio file - [InlineData("track.ape", AudioFileFormat.APE)] // ape audio file - [InlineData("track.wv", AudioFileFormat.WAVPACK)] // wavpack audio file - [InlineData("track.dsf", AudioFileFormat.DSF)] // dsf audio file - [InlineData("track.dff", AudioFileFormat.DFF)] // dff audio file - [InlineData("track.mka", AudioFileFormat.MATROSKA)] // matroska audio file + [InlineData("track.mp3", AudioFileFormat.MP3)] // MP3 audio file. + [InlineData("track.flac", AudioFileFormat.FLAC)] // FLAC audio file. + [InlineData("track.m4a", AudioFileFormat.M4A)] // M4A audio file. + [InlineData("track.aac", AudioFileFormat.AAC)] // AAC audio file. + [InlineData("track.ogg", AudioFileFormat.OGG)] // OGG audio file. + [InlineData("track.opus", AudioFileFormat.OPUS)] // Opus audio file. + [InlineData("track.wav", AudioFileFormat.WAV)] // WAV audio file. + [InlineData("track.wma", AudioFileFormat.WMA)] // WMA audio file. + [InlineData("track.aiff", AudioFileFormat.AIFF)] // AIFF audio file. + [InlineData("track.aif", AudioFileFormat.AIFF)] // AIF audio file. + [InlineData("track.ape", AudioFileFormat.APE)] // APE audio file. + [InlineData("track.wv", AudioFileFormat.WAVPACK)] // WavPack audio file. + [InlineData("track.dsf", AudioFileFormat.DSF)] // DSF audio file. + [InlineData("track.dff", AudioFileFormat.DFF)] // DFF audio file. + [InlineData("track.mka", AudioFileFormat.MATROSKA)] // Matroska audio file. public void ToAudioFileFormat_WhenExtensionIsKnown_ShouldReturnMappedFormat(string filePath, AudioFileFormat expectedFormat) { // Act diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/DurationUtilitiesTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/DurationUtilitiesTests.cs index f4f7df50..f8329c2b 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/DurationUtilitiesTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/DurationUtilitiesTests.cs @@ -23,9 +23,9 @@ public class DurationUtilitiesTests } [Theory] - [InlineData(1, 0.001)] // a single millisecond is preserved - [InlineData(1_500, 1.5)] // whole milliseconds convert to fractional seconds - [InlineData(60_000, 60)] // a full minute converts exactly + [InlineData(1, 0.001)] // A single millisecond is preserved. + [InlineData(1_500, 1.5)] // Whole milliseconds convert to fractional seconds. + [InlineData(60_000, 60)] // A full minute converts exactly. public void ToClampedTimeSpan_WhenMillisecondsIsWithinTheRepresentableRange_ShouldConvertToTheEquivalentSeconds(long milliseconds, double expectedTotalSeconds) { // Act @@ -36,8 +36,8 @@ public class DurationUtilitiesTests } [Theory] - [InlineData(-1)] // a single negative millisecond - [InlineData(-1_500)] // negative fractional seconds + [InlineData(-1)] // A single negative millisecond. + [InlineData(-1_500)] // Negative fractional seconds. public void ToClampedTimeSpan_WhenMillisecondsIsNegative_ShouldReturnTheEquivalentNegativeDuration(long milliseconds) { // Act diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/FavoriteMediaKindExtensionsTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/FavoriteMediaKindExtensionsTests.cs index 03716fac..48cd2364 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/FavoriteMediaKindExtensionsTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/FavoriteMediaKindExtensionsTests.cs @@ -15,10 +15,10 @@ namespace Lumina.Application.UnitTests.Common.Utilities; public class FavoriteMediaKindExtensionsTests { [Theory] - [InlineData(FavoriteMediaKind.MusicArtist, nameof(DomainErrors.Music.ArtistNotFound))] // an artist has no library of its own - [InlineData(FavoriteMediaKind.MusicAlbum, nameof(DomainErrors.Music.AlbumNotFound))] // an album is not a media item that can be favorited - [InlineData(FavoriteMediaKind.MusicTrack, nameof(DomainErrors.Music.TrackNotFound))] // a track is resolved through the music catalogue - [InlineData(FavoriteMediaKind.Book, nameof(DomainErrors.WrittenContent.BookNotFound))] // a book is resolved through the written content catalogue + [InlineData(FavoriteMediaKind.MusicArtist, nameof(DomainErrors.Music.ArtistNotFound))] // An artist has no library of its own. + [InlineData(FavoriteMediaKind.MusicAlbum, nameof(DomainErrors.Music.AlbumNotFound))] // An album is not a media item that can be favorited. + [InlineData(FavoriteMediaKind.MusicTrack, nameof(DomainErrors.Music.TrackNotFound))] // A track is resolved through the music catalogue. + [InlineData(FavoriteMediaKind.Book, nameof(DomainErrors.WrittenContent.BookNotFound))] // A book is resolved through the written content catalogue. public void ToMediaItemNotFoundError_WhenTheMediaKindIsCatalogued_ShouldReturnTheMediaSpecificNotFoundError(FavoriteMediaKind mediaKind, string expectedDescription) { // Act @@ -29,9 +29,9 @@ public class FavoriteMediaKindExtensionsTests } [Theory] - [InlineData(FavoriteMediaKind.None)] // the default value, which is not a kind that can be favorited - [InlineData(FavoriteMediaKind.Video)] // video libraries are not catalogued yet - [InlineData(FavoriteMediaKind.Photo)] // photo libraries are not catalogued yet + [InlineData(FavoriteMediaKind.None)] // The default value, which is not a kind that can be favorited. + [InlineData(FavoriteMediaKind.Video)] // Video libraries are not catalogued yet. + [InlineData(FavoriteMediaKind.Photo)] // Photo libraries are not catalogued yet. public void ToMediaItemNotFoundError_WhenTheMediaKindIsNotCatalogued_ShouldReturnTheNotSupportedError(FavoriteMediaKind mediaKind) { // Act diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/ValidatorUtilitiesTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/ValidatorUtilitiesTests.cs index aa7c8ca1..af389ad2 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/ValidatorUtilitiesTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Utilities/ValidatorUtilitiesTests.cs @@ -34,8 +34,8 @@ public class ValidatorUtilitiesTests } [Theory] - [InlineData(4)] // value is greater than the comparison value - [InlineData(100)] // value is much greater than the comparison value + [InlineData(4)] // Value is greater than the comparison value. + [InlineData(100)] // Value is much greater than the comparison value. public void Validate_WhenIntValueIsGreaterThanComparison_ShouldNotHaveValidationError(int value) { // Arrange @@ -50,9 +50,9 @@ public class ValidatorUtilitiesTests } [Theory] - [InlineData(3)] // value equals the comparison value - [InlineData(1)] // value is smaller than the comparison value - [InlineData(-5)] // value is negative and smaller than the comparison value + [InlineData(3)] // Value equals the comparison value. + [InlineData(1)] // Value is smaller than the comparison value. + [InlineData(-5)] // Value is negative and smaller than the comparison value. public void Validate_WhenIntValueIsNotGreaterThanComparison_ShouldHaveValidationError(int value) { // Arrange @@ -262,9 +262,9 @@ public class ValidatorUtilitiesTests } [Theory] - [InlineData(null)] // null string - [InlineData("")] // empty string - [InlineData(" ")] // white-space only string + [InlineData(null)] // Null string. + [InlineData("")] // Empty string. + [InlineData(" ")] // White-space only string. public void Validate_WhenNotEmptyValueIsEmpty_ShouldHaveValidationError(string? value) { // Arrange @@ -432,9 +432,9 @@ public class ValidatorUtilitiesTests } [Theory] - [InlineData(nameof(ValidatorUtilitiesTestEnum.First))] // the exact member name - [InlineData("first")] // the member name in lower case - [InlineData("SECOND")] // the member name in upper case + [InlineData(nameof(ValidatorUtilitiesTestEnum.First))] // The exact member name. + [InlineData("first")] // The member name in lower case. + [InlineData("SECOND")] // The member name in upper case. public void Validate_WhenTextualEnumValueIsAMemberName_ShouldNotHaveValidationError(string textualEnumValue) { // Arrange @@ -448,12 +448,12 @@ public class ValidatorUtilitiesTests } [Theory] - [InlineData("")] // an empty value - [InlineData(" ")] // a whitespace only value - [InlineData("Unknown")] // a name that is not a member of the enumeration - [InlineData("0")] // a number that is a defined member value, which must still be rejected - [InlineData("1")] // another number that is a defined member value - [InlineData("99")] // a number that is not a member value + [InlineData("")] // An empty value. + [InlineData(" ")] // A whitespace only value. + [InlineData("Unknown")] // A name that is not a member of the enumeration. + [InlineData("0")] // A number that is a defined member value, which must still be rejected. + [InlineData("1")] // Another number that is a defined member value. + [InlineData("99")] // A number that is not a member value. public void Validate_WhenTextualEnumValueIsNotAMemberName_ShouldHaveValidationError(string textualEnumValue) { // Arrange @@ -886,8 +886,8 @@ public class ValidatorUtilitiesTests } [Theory] - [InlineData(0.99)] // just below the minimum - [InlineData(10.01)] // just above the maximum + [InlineData(0.99)] // Just below the minimum. + [InlineData(10.01)] // Just above the maximum. public void Validate_WhenInclusiveNullableDoubleValueIsOutsideRange_ShouldHaveValidationError(double inclusiveNullableDoubleValue) { // Arrange @@ -902,9 +902,9 @@ public class ValidatorUtilitiesTests } [Theory] - [InlineData(1.0)] // the minimum - [InlineData(5.0)] // a middle value - [InlineData(10.0)] // the maximum + [InlineData(1.0)] // The minimum. + [InlineData(5.0)] // A middle value. + [InlineData(10.0)] // The maximum. public void Validate_WhenInclusiveNullableDoubleValueIsWithinRange_ShouldNotHaveValidationError(double inclusiveNullableDoubleValue) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/AddFavorite/AddFavoriteCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/AddFavorite/AddFavoriteCommandHandlerTests.cs index 81f71710..4b4ed6f1 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/AddFavorite/AddFavoriteCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/AddFavorite/AddFavoriteCommandHandlerTests.cs @@ -117,9 +117,9 @@ public class AddFavoriteCommandHandlerTests } [Theory] - [InlineData(FavoriteMediaKind.None)] // the default value, which is not a kind that can be favorited - [InlineData(FavoriteMediaKind.Video)] // video libraries are not catalogued yet - [InlineData(FavoriteMediaKind.Photo)] // photo libraries are not catalogued yet + [InlineData(FavoriteMediaKind.None)] // The default value, which is not a kind that can be favorited. + [InlineData(FavoriteMediaKind.Video)] // Video libraries are not catalogued yet. + [InlineData(FavoriteMediaKind.Photo)] // Photo libraries are not catalogued yet. public async Task HandleAsync_WhenMediaKindIsNotSupported_ShouldReturnNotSupportedAndNotResolveTheLibrary(FavoriteMediaKind mediaKind) { // Arrange @@ -156,10 +156,10 @@ public class AddFavoriteCommandHandlerTests } [Theory] - [InlineData(FavoriteMediaKind.MusicArtist, nameof(DomainErrors.Music.ArtistNotFound))] // the artist does not exist - [InlineData(FavoriteMediaKind.MusicAlbum, nameof(DomainErrors.Music.AlbumNotFound))] // the album does not exist - [InlineData(FavoriteMediaKind.MusicTrack, nameof(DomainErrors.Music.TrackNotFound))] // the track does not exist - [InlineData(FavoriteMediaKind.Book, nameof(DomainErrors.WrittenContent.BookNotFound))] // the book does not exist + [InlineData(FavoriteMediaKind.MusicArtist, nameof(DomainErrors.Music.ArtistNotFound))] // The artist does not exist. + [InlineData(FavoriteMediaKind.MusicAlbum, nameof(DomainErrors.Music.AlbumNotFound))] // The album does not exist. + [InlineData(FavoriteMediaKind.MusicTrack, nameof(DomainErrors.Music.TrackNotFound))] // The track does not exist. + [InlineData(FavoriteMediaKind.Book, nameof(DomainErrors.WrittenContent.BookNotFound))] // The book does not exist. public async Task HandleAsync_WhenTheMediaItemHasNoLibrary_ShouldReturnTheMediaKindSpecificNotFoundError(FavoriteMediaKind mediaKind, string expectedErrorDescription) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/AddFavorite/AddFavoriteCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/AddFavorite/AddFavoriteCommandValidatorTests.cs index e268c2c4..5ca9d64d 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/AddFavorite/AddFavoriteCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/AddFavorite/AddFavoriteCommandValidatorTests.cs @@ -61,12 +61,12 @@ public class AddFavoriteCommandValidatorTests } [Theory] - [InlineData(FavoriteMediaKind.MusicArtist)] // a catalogued music kind - [InlineData(FavoriteMediaKind.MusicAlbum)] // a catalogued music kind - [InlineData(FavoriteMediaKind.MusicTrack)] // a catalogued music kind - [InlineData(FavoriteMediaKind.Book)] // a catalogued written content kind - [InlineData(FavoriteMediaKind.Video)] // a planned kind is still a defined enumeration member - [InlineData(FavoriteMediaKind.Photo)] // a planned kind is still a defined enumeration member + [InlineData(FavoriteMediaKind.MusicArtist)] // A catalogued music kind. + [InlineData(FavoriteMediaKind.MusicAlbum)] // A catalogued music kind. + [InlineData(FavoriteMediaKind.MusicTrack)] // A catalogued music kind. + [InlineData(FavoriteMediaKind.Book)] // A catalogued written content kind. + [InlineData(FavoriteMediaKind.Video)] // A planned kind is still a defined enumeration member. + [InlineData(FavoriteMediaKind.Photo)] // A planned kind is still a defined enumeration member. public void Validate_WhenMediaKindIsDefined_ShouldNotHaveValidationError(FavoriteMediaKind mediaKind) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/RemoveFavorite/RemoveFavoriteCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/RemoveFavorite/RemoveFavoriteCommandValidatorTests.cs index eacf588e..d4f63f14 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/RemoveFavorite/RemoveFavoriteCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Commands/RemoveFavorite/RemoveFavoriteCommandValidatorTests.cs @@ -34,15 +34,15 @@ public class RemoveFavoriteCommandValidatorTests } [Theory] - [InlineData("")] // the media kind is empty - [InlineData(" ")] // the media kind is whitespace only - [InlineData("Hologram")] // the media kind is not a member of the enumeration - [InlineData("None")] // the default value is not a kind that can be favorited - [InlineData("none")] // the default value, matched case insensitively - [InlineData("0")] // the media kind is a numeric route value, which the validator rejects by name - [InlineData("1")] // a numeric route value that parses to a defined member, which the name check rejects - [InlineData("MusicTrack,Book")] // a comma separated list is not a single member name - [InlineData("../MusicTrack")] // a path-like value is not a member name + [InlineData("")] // The media kind is empty. + [InlineData(" ")] // The media kind is whitespace only. + [InlineData("Hologram")] // The media kind is not a member of the enumeration. + [InlineData("None")] // The default value is not a kind that can be favorited. + [InlineData("none")] // The default value, matched case insensitively. + [InlineData("0")] // The media kind is a numeric route value, which the validator rejects by name. + [InlineData("1")] // A numeric route value that parses to a defined member, which the name check rejects. + [InlineData("MusicTrack,Book")] // A comma separated list is not a single member name. + [InlineData("../MusicTrack")] // A path-like value is not a member name. public void Validate_WhenMediaKindIsEmptyOrNotAMemberName_ShouldHaveValidationError(string mediaKind) { // Arrange @@ -56,8 +56,8 @@ public class RemoveFavoriteCommandValidatorTests } [Theory] - [InlineData("musictrack")] // the member name is lower case - [InlineData("BoOk")] // the member name is mixed case + [InlineData("musictrack")] // The member name is lower case. + [InlineData("BoOk")] // The member name is mixed case. public void Validate_WhenMediaKindUsesDifferentCasing_ShouldNotHaveValidationError(string mediaKind) { // Arrange @@ -84,10 +84,10 @@ public class RemoveFavoriteCommandValidatorTests } [Theory] - [InlineData("")] // the media item Id is empty - [InlineData(" ")] // the media item Id is whitespace only - [InlineData("not-a-guid")] // the media item Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the media item Id is the empty Guid + [InlineData("")] // The media item Id is empty. + [InlineData(" ")] // The media item Id is whitespace only. + [InlineData("not-a-guid")] // The media item Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The media item Id is the empty Guid. public void Validate_WhenMediaItemIdIsEmptyOrInvalid_ShouldHaveValidationError(string mediaItemId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Queries/GetFavorites/GetFavoritesQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Queries/GetFavorites/GetFavoritesQueryValidatorTests.cs index 1d000eb6..a5c5489e 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Queries/GetFavorites/GetFavoritesQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Favorites/Queries/GetFavorites/GetFavoritesQueryValidatorTests.cs @@ -61,12 +61,12 @@ public class GetFavoritesQueryValidatorTests } [Theory] - [InlineData(FavoriteMediaKind.MusicArtist)] // a catalogued music kind - [InlineData(FavoriteMediaKind.MusicAlbum)] // a catalogued music kind - [InlineData(FavoriteMediaKind.MusicTrack)] // a catalogued music kind - [InlineData(FavoriteMediaKind.Book)] // a catalogued written content kind - [InlineData(FavoriteMediaKind.Video)] // a planned kind is still a defined enumeration member - [InlineData(FavoriteMediaKind.Photo)] // a planned kind is still a defined enumeration member + [InlineData(FavoriteMediaKind.MusicArtist)] // A catalogued music kind. + [InlineData(FavoriteMediaKind.MusicAlbum)] // A catalogued music kind. + [InlineData(FavoriteMediaKind.MusicTrack)] // A catalogued music kind. + [InlineData(FavoriteMediaKind.Book)] // A catalogued written content kind. + [InlineData(FavoriteMediaKind.Video)] // A planned kind is still a defined enumeration member. + [InlineData(FavoriteMediaKind.Photo)] // A planned kind is still a defined enumeration member. public void Validate_WhenMediaKindIsDefined_ShouldNotHaveValidationError(FavoriteMediaKind mediaKind) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Paths/Queries/GetPathParent/GetPathParentQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Paths/Queries/GetPathParent/GetPathParentQueryHandlerTests.cs index d3a5fdf3..23d8cf4b 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Paths/Queries/GetPathParent/GetPathParentQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Paths/Queries/GetPathParent/GetPathParentQueryHandlerTests.cs @@ -51,7 +51,7 @@ public class GetPathParentQueryHandlerTests IEnumerable pathSegments = _pathSegmentFixture.CreateMany(); - // Create PathSegmentResponses based on the PathSegments + // Create PathSegmentResponses based on the PathSegments. IEnumerable pathSegmentResponses = pathSegments.Select(segment => _pathSegmentResponseFixture.Create(path: segment.Name)); _mockPathService.GoUpOneLevel(query.Path!) diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Maintenance/ApplicationSetup/Commands/SetupApplication/SetupApplicationCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Maintenance/ApplicationSetup/Commands/SetupApplication/SetupApplicationCommandValidatorTests.cs index c9ec1dd1..5d549bbc 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Maintenance/ApplicationSetup/Commands/SetupApplication/SetupApplicationCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Maintenance/ApplicationSetup/Commands/SetupApplication/SetupApplicationCommandValidatorTests.cs @@ -160,12 +160,12 @@ public class SetupApplicationCommandValidatorTests } [Theory] - [InlineData("password123")] // Missing uppercase and special character - [InlineData("PASSWORD123")] // Missing special character - [InlineData("Password123")] // Missing special character - [InlineData("Password!@#")] // Missing number - [InlineData("Pass1!")] // Too short - [InlineData("password")] // Missing uppercase, number, and special character + [InlineData("password123")] // Missing uppercase and special character. + [InlineData("PASSWORD123")] // Missing special character. + [InlineData("Password123")] // Missing special character. + [InlineData("Password!@#")] // Missing number. + [InlineData("Pass1!")] // Too short. + [InlineData("password")] // Missing uppercase, number, and special character. public void Validate_WhenPasswordDoesNotMatchPattern_ShouldHaveValidationError(string password) { // Arrange @@ -180,10 +180,10 @@ public class SetupApplicationCommandValidatorTests } [Theory] - [InlineData("Password1!")] // Valid password - [InlineData("Complex1@Password")] // Valid password - [InlineData("MyP@ssw0rd")] // Valid password - [InlineData("Abcd123!@#")] // Valid password + [InlineData("Password1!")] // Valid password. + [InlineData("Complex1@Password")] // Valid password. + [InlineData("MyP@ssw0rd")] // Valid password. + [InlineData("Abcd123!@#")] // Valid password. public void Validate_WhenPasswordMatchesPattern_ShouldNotHaveValidationError(string password) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ClearConsumptionHistory/ClearConsumptionHistoryCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ClearConsumptionHistory/ClearConsumptionHistoryCommandValidatorTests.cs index b1b9781b..9e910218 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ClearConsumptionHistory/ClearConsumptionHistoryCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ClearConsumptionHistory/ClearConsumptionHistoryCommandValidatorTests.cs @@ -33,10 +33,10 @@ public class ClearConsumptionHistoryCommandValidatorTests } [Theory] - [InlineData("")] // the target user Id is empty - [InlineData(" ")] // the target user Id is whitespace only - [InlineData("not-a-guid")] // the target user Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the target user Id is the empty Guid + [InlineData("")] // The target user Id is empty. + [InlineData(" ")] // The target user Id is whitespace only. + [InlineData("not-a-guid")] // The target user Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The target user Id is the empty Guid. public void Validate_WhenTargetUserIdIsEmptyOrInvalid_ShouldHaveValidationError(string targetUserId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ClearResumePoints/ClearResumePointsCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ClearResumePoints/ClearResumePointsCommandValidatorTests.cs index bc19405b..a21b2d6c 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ClearResumePoints/ClearResumePointsCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ClearResumePoints/ClearResumePointsCommandValidatorTests.cs @@ -33,10 +33,10 @@ public class ClearResumePointsCommandValidatorTests } [Theory] - [InlineData("")] // the target user Id is empty - [InlineData(" ")] // the target user Id is whitespace only - [InlineData("not-a-guid")] // the target user Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the target user Id is the empty Guid + [InlineData("")] // The target user Id is empty. + [InlineData(" ")] // The target user Id is whitespace only. + [InlineData("not-a-guid")] // The target user Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The target user Id is the empty Guid. public void Validate_WhenTargetUserIdIsEmptyOrInvalid_ShouldHaveValidationError(string targetUserId) { // Arrange @@ -76,10 +76,10 @@ public class ClearResumePointsCommandValidatorTests } [Theory] - [InlineData("")] // the library Id is empty - [InlineData(" ")] // the library Id is whitespace only - [InlineData("not-a-guid")] // the library Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the library Id is the empty Guid + [InlineData("")] // The library Id is empty. + [InlineData(" ")] // The library Id is whitespace only. + [InlineData("not-a-guid")] // The library Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The library Id is the empty Guid. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string libraryId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/CompleteConsumption/CompleteConsumptionCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/CompleteConsumption/CompleteConsumptionCommandValidatorTests.cs index 4fa89abc..e9ca202d 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/CompleteConsumption/CompleteConsumptionCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/CompleteConsumption/CompleteConsumptionCommandValidatorTests.cs @@ -34,10 +34,10 @@ public class CompleteConsumptionCommandValidatorTests } [Theory] - [InlineData("")] // the consumption record Id is empty - [InlineData(" ")] // the consumption record Id is whitespace only - [InlineData("not-a-guid")] // the consumption record Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the consumption record Id is the empty Guid + [InlineData("")] // The consumption record Id is empty. + [InlineData(" ")] // The consumption record Id is whitespace only. + [InlineData("not-a-guid")] // The consumption record Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The consumption record Id is the empty Guid. public void Validate_WhenConsumptionRecordIdIsEmptyOrInvalid_ShouldHaveValidationError(string consumptionRecordId) { // Arrange @@ -182,8 +182,8 @@ public class CompleteConsumptionCommandValidatorTests } [Theory] - [InlineData(-1)] // a negative offset cannot describe a position within a media item - [InlineData(-0.5)] // a fractional negative offset is rejected the same way + [InlineData(-1)] // A negative offset cannot describe a position within a media item. + [InlineData(-0.5)] // A fractional negative offset is rejected the same way. public void Validate_WhenPositionKindIsTimeOffsetAndOffsetIsNegative_ShouldHaveValidationError(double timeOffsetInSeconds) { // Arrange @@ -199,9 +199,9 @@ public class CompleteConsumptionCommandValidatorTests } [Theory] - [InlineData(double.NaN)] // not a number is not a position - [InlineData(double.PositiveInfinity)] // an infinite offset is not a position - [InlineData(double.NegativeInfinity)] // a negative infinite offset is not a position either + [InlineData(double.NaN)] // Not a number is not a position. + [InlineData(double.PositiveInfinity)] // An infinite offset is not a position. + [InlineData(double.NegativeInfinity)] // A negative infinite offset is not a position either. public void Validate_WhenPositionKindIsTimeOffsetAndOffsetIsNotFinite_ShouldHaveValidationError(double timeOffsetInSeconds) { // Arrange @@ -340,8 +340,8 @@ public class CompleteConsumptionCommandValidatorTests } [Theory] - [InlineData(-0.1)] // a fraction below zero is not a fraction of the media item - [InlineData(1.1)] // a fraction above one is not a fraction of the media item + [InlineData(-0.1)] // A fraction below zero is not a fraction of the media item. + [InlineData(1.1)] // A fraction above one is not a fraction of the media item. public void Validate_WhenProgressFractionIsOutsideItsRange_ShouldHaveValidationError(double progressFraction) { // Arrange @@ -355,9 +355,9 @@ public class CompleteConsumptionCommandValidatorTests } [Theory] - [InlineData(double.NaN)] // not a number is not a fraction - [InlineData(double.PositiveInfinity)] // an infinite fraction is not a fraction - [InlineData(double.NegativeInfinity)] // a negative infinite fraction is not a fraction + [InlineData(double.NaN)] // Not a number is not a fraction. + [InlineData(double.PositiveInfinity)] // An infinite fraction is not a fraction. + [InlineData(double.NegativeInfinity)] // A negative infinite fraction is not a fraction. public void Validate_WhenProgressFractionIsNotFinite_ShouldHaveValidationError(double progressFraction) { // Arrange @@ -371,9 +371,9 @@ public class CompleteConsumptionCommandValidatorTests } [Theory] - [InlineData(0)] // the start of the media item is a valid fraction - [InlineData(0.5)] // a fraction in between the boundaries is valid - [InlineData(1)] // the end of the media item is a valid fraction + [InlineData(0)] // The start of the media item is a valid fraction. + [InlineData(0.5)] // A fraction in between the boundaries is valid. + [InlineData(1)] // The end of the media item is a valid fraction. public void Validate_WhenProgressFractionIsWithinItsRange_ShouldNotHaveValidationError(double progressFraction) { // Arrange @@ -400,8 +400,8 @@ public class CompleteConsumptionCommandValidatorTests } [Theory] - [InlineData(-1)] // a negative duration cannot describe consumed time - [InlineData(-0.5)] // a fractional negative duration is rejected the same way + [InlineData(-1)] // A negative duration cannot describe consumed time. + [InlineData(-0.5)] // A fractional negative duration is rejected the same way. public void Validate_WhenConsumedDurationIsNegative_ShouldHaveValidationError(double consumedDurationInSeconds) { // Arrange @@ -415,9 +415,9 @@ public class CompleteConsumptionCommandValidatorTests } [Theory] - [InlineData(double.NaN)] // not a number is not a duration - [InlineData(double.PositiveInfinity)] // an infinite duration is not a duration - [InlineData(double.NegativeInfinity)] // a negative infinite duration is not a duration + [InlineData(double.NaN)] // Not a number is not a duration. + [InlineData(double.PositiveInfinity)] // An infinite duration is not a duration. + [InlineData(double.NegativeInfinity)] // A negative infinite duration is not a duration. public void Validate_WhenConsumedDurationIsNotFinite_ShouldHaveValidationError(double consumedDurationInSeconds) { // Arrange @@ -444,8 +444,8 @@ public class CompleteConsumptionCommandValidatorTests } [Theory] - [InlineData(0)] // a session that consumed no time is valid - [InlineData(2_678_400)] // exactly the maximum accepted duration is valid + [InlineData(0)] // A session that consumed no time is valid. + [InlineData(2_678_400)] // Exactly the maximum accepted duration is valid. public void Validate_WhenConsumedDurationIsWithinItsRange_ShouldNotHaveValidationError(double consumedDurationInSeconds) { // Arrange @@ -486,8 +486,8 @@ public class CompleteConsumptionCommandValidatorTests } [Theory] - [InlineData(0)] // no pages read is still a valid count - [InlineData(42)] // a positive count is valid + [InlineData(0)] // No pages read is still a valid count. + [InlineData(42)] // A positive count is valid. public void Validate_WhenConsecutivePagesReadIsNotNegative_ShouldNotHaveValidationError(int consecutivePagesRead) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryCommandValidatorTests.cs index 46819854..2f96d4bf 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryCommandValidatorTests.cs @@ -35,10 +35,10 @@ public class DeleteConsumptionItemHistoryCommandValidatorTests } [Theory] - [InlineData("")] // the target user Id is empty - [InlineData(" ")] // the target user Id is whitespace only - [InlineData("not-a-guid")] // the target user Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the target user Id is the empty Guid + [InlineData("")] // The target user Id is empty. + [InlineData(" ")] // The target user Id is whitespace only. + [InlineData("not-a-guid")] // The target user Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The target user Id is the empty Guid. public void Validate_WhenTargetUserIdIsEmptyOrInvalid_ShouldHaveValidationError(string targetUserId) { // Arrange @@ -78,11 +78,11 @@ public class DeleteConsumptionItemHistoryCommandValidatorTests } [Theory] - [InlineData("")] // the media kind is empty - [InlineData(" ")] // the media kind is whitespace only - [InlineData("not-a-media-kind")] // the media kind is not a member name - [InlineData("999")] // the media kind is numeric, which must not be accepted as a member name - [InlineData("None")] // None is not a valid media kind for a consumption record + [InlineData("")] // The media kind is empty. + [InlineData(" ")] // The media kind is whitespace only. + [InlineData("not-a-media-kind")] // The media kind is not a member name. + [InlineData("999")] // The media kind is numeric, which must not be accepted as a member name. + [InlineData("None")] // None is not a valid media kind for a consumption record. public void Validate_WhenMediaKindIsInvalid_ShouldHaveValidationError(string mediaKind) { // Arrange @@ -96,11 +96,11 @@ public class DeleteConsumptionItemHistoryCommandValidatorTests } [Theory] - [InlineData(nameof(MediaKind.MusicTrack))] // a kind supported by the current catalogues - [InlineData(nameof(MediaKind.Book))] // another kind supported by the current catalogues - [InlineData(nameof(MediaKind.Movie))] // a kind without a catalogue, still a defined kind - [InlineData(nameof(MediaKind.Photo))] // a kind that every session counts for, still a defined kind - [InlineData("musicTrack")] // member names are matched case-insensitively + [InlineData(nameof(MediaKind.MusicTrack))] // A kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Book))] // Another kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Movie))] // A kind without a catalogue, still a defined kind. + [InlineData(nameof(MediaKind.Photo))] // A kind that every session counts for, still a defined kind. + [InlineData("musicTrack")] // Member names are matched case-insensitively. public void Validate_WhenMediaKindIsDefined_ShouldNotHaveValidationError(string mediaKind) { // Arrange @@ -127,10 +127,10 @@ public class DeleteConsumptionItemHistoryCommandValidatorTests } [Theory] - [InlineData("")] // the media item Id is empty - [InlineData(" ")] // the media item Id is whitespace only - [InlineData("not-a-guid")] // the media item Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the media item Id is the empty Guid + [InlineData("")] // The media item Id is empty. + [InlineData(" ")] // The media item Id is whitespace only. + [InlineData("not-a-guid")] // The media item Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The media item Id is the empty Guid. public void Validate_WhenMediaItemIdIsEmptyOrInvalid_ShouldHaveValidationError(string mediaItemId) { // Arrange @@ -170,10 +170,10 @@ public class DeleteConsumptionItemHistoryCommandValidatorTests } [Theory] - [InlineData("")] // the library Id is empty - [InlineData(" ")] // the library Id is whitespace only - [InlineData("not-a-guid")] // the library Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the library Id is the empty Guid + [InlineData("")] // The library Id is empty. + [InlineData(" ")] // The library Id is whitespace only. + [InlineData("not-a-guid")] // The library Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The library Id is the empty Guid. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string libraryId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/DeleteConsumptionRecord/DeleteConsumptionRecordCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/DeleteConsumptionRecord/DeleteConsumptionRecordCommandValidatorTests.cs index ab0915e1..6b31d3b9 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/DeleteConsumptionRecord/DeleteConsumptionRecordCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/DeleteConsumptionRecord/DeleteConsumptionRecordCommandValidatorTests.cs @@ -33,10 +33,10 @@ public class DeleteConsumptionRecordCommandValidatorTests } [Theory] - [InlineData("")] // the consumption record Id is empty - [InlineData(" ")] // the consumption record Id is whitespace only - [InlineData("not-a-guid")] // the consumption record Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the consumption record Id is the empty Guid + [InlineData("")] // The consumption record Id is empty. + [InlineData(" ")] // The consumption record Id is whitespace only. + [InlineData("not-a-guid")] // The consumption record Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The consumption record Id is the empty Guid. public void Validate_WhenConsumptionRecordIdIsEmptyOrInvalid_ShouldHaveValidationError(string consumptionRecordId) { // Arrange @@ -76,10 +76,10 @@ public class DeleteConsumptionRecordCommandValidatorTests } [Theory] - [InlineData("")] // the target user Id is empty - [InlineData(" ")] // the target user Id is whitespace only - [InlineData("not-a-guid")] // the target user Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the target user Id is the empty Guid + [InlineData("")] // The target user Id is empty. + [InlineData(" ")] // The target user Id is whitespace only. + [InlineData("not-a-guid")] // The target user Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The target user Id is the empty Guid. public void Validate_WhenTargetUserIdIsEmptyOrInvalid_ShouldHaveValidationError(string targetUserId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ReportConsumptionProgress/ReportConsumptionProgressCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ReportConsumptionProgress/ReportConsumptionProgressCommandValidatorTests.cs index 9108e915..798ed7c3 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ReportConsumptionProgress/ReportConsumptionProgressCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/ReportConsumptionProgress/ReportConsumptionProgressCommandValidatorTests.cs @@ -34,10 +34,10 @@ public class ReportConsumptionProgressCommandValidatorTests } [Theory] - [InlineData("")] // the consumption record Id is empty - [InlineData(" ")] // the consumption record Id is whitespace only - [InlineData("not-a-guid")] // the consumption record Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the consumption record Id is the empty Guid + [InlineData("")] // The consumption record Id is empty. + [InlineData(" ")] // The consumption record Id is whitespace only. + [InlineData("not-a-guid")] // The consumption record Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The consumption record Id is the empty Guid. public void Validate_WhenConsumptionRecordIdIsEmptyOrInvalid_ShouldHaveValidationError(string consumptionRecordId) { // Arrange @@ -182,8 +182,8 @@ public class ReportConsumptionProgressCommandValidatorTests } [Theory] - [InlineData(-1)] // a negative offset cannot describe a position within a media item - [InlineData(-0.5)] // a fractional negative offset is rejected the same way + [InlineData(-1)] // A negative offset cannot describe a position within a media item. + [InlineData(-0.5)] // A fractional negative offset is rejected the same way. public void Validate_WhenPositionKindIsTimeOffsetAndOffsetIsNegative_ShouldHaveValidationError(double timeOffsetInSeconds) { // Arrange @@ -199,9 +199,9 @@ public class ReportConsumptionProgressCommandValidatorTests } [Theory] - [InlineData(double.NaN)] // not a number is not a position - [InlineData(double.PositiveInfinity)] // an infinite offset is not a position - [InlineData(double.NegativeInfinity)] // a negative infinite offset is not a position either + [InlineData(double.NaN)] // Not a number is not a position. + [InlineData(double.PositiveInfinity)] // An infinite offset is not a position. + [InlineData(double.NegativeInfinity)] // A negative infinite offset is not a position either. public void Validate_WhenPositionKindIsTimeOffsetAndOffsetIsNotFinite_ShouldHaveValidationError(double timeOffsetInSeconds) { // Arrange @@ -340,8 +340,8 @@ public class ReportConsumptionProgressCommandValidatorTests } [Theory] - [InlineData(-0.1)] // a fraction below zero is not a fraction of the media item - [InlineData(1.1)] // a fraction above one is not a fraction of the media item + [InlineData(-0.1)] // A fraction below zero is not a fraction of the media item. + [InlineData(1.1)] // A fraction above one is not a fraction of the media item. public void Validate_WhenProgressFractionIsOutsideItsRange_ShouldHaveValidationError(double progressFraction) { // Arrange @@ -355,9 +355,9 @@ public class ReportConsumptionProgressCommandValidatorTests } [Theory] - [InlineData(double.NaN)] // not a number is not a fraction - [InlineData(double.PositiveInfinity)] // an infinite fraction is not a fraction - [InlineData(double.NegativeInfinity)] // a negative infinite fraction is not a fraction + [InlineData(double.NaN)] // Not a number is not a fraction. + [InlineData(double.PositiveInfinity)] // An infinite fraction is not a fraction. + [InlineData(double.NegativeInfinity)] // A negative infinite fraction is not a fraction. public void Validate_WhenProgressFractionIsNotFinite_ShouldHaveValidationError(double progressFraction) { // Arrange @@ -371,9 +371,9 @@ public class ReportConsumptionProgressCommandValidatorTests } [Theory] - [InlineData(0)] // the start of the media item is a valid fraction - [InlineData(0.5)] // a fraction in between the boundaries is valid - [InlineData(1)] // the end of the media item is a valid fraction + [InlineData(0)] // The start of the media item is a valid fraction. + [InlineData(0.5)] // A fraction in between the boundaries is valid. + [InlineData(1)] // The end of the media item is a valid fraction. public void Validate_WhenProgressFractionIsWithinItsRange_ShouldNotHaveValidationError(double progressFraction) { // Arrange @@ -400,8 +400,8 @@ public class ReportConsumptionProgressCommandValidatorTests } [Theory] - [InlineData(-1)] // a negative duration cannot describe consumed time - [InlineData(-0.5)] // a fractional negative duration is rejected the same way + [InlineData(-1)] // A negative duration cannot describe consumed time. + [InlineData(-0.5)] // A fractional negative duration is rejected the same way. public void Validate_WhenConsumedDurationIsNegative_ShouldHaveValidationError(double consumedDurationInSeconds) { // Arrange @@ -415,9 +415,9 @@ public class ReportConsumptionProgressCommandValidatorTests } [Theory] - [InlineData(double.NaN)] // not a number is not a duration - [InlineData(double.PositiveInfinity)] // an infinite duration is not a duration - [InlineData(double.NegativeInfinity)] // a negative infinite duration is not a duration + [InlineData(double.NaN)] // Not a number is not a duration. + [InlineData(double.PositiveInfinity)] // An infinite duration is not a duration. + [InlineData(double.NegativeInfinity)] // A negative infinite duration is not a duration. public void Validate_WhenConsumedDurationIsNotFinite_ShouldHaveValidationError(double consumedDurationInSeconds) { // Arrange @@ -444,8 +444,8 @@ public class ReportConsumptionProgressCommandValidatorTests } [Theory] - [InlineData(0)] // a session that consumed no time is valid - [InlineData(2_678_400)] // exactly the maximum accepted duration is valid + [InlineData(0)] // A session that consumed no time is valid. + [InlineData(2_678_400)] // Exactly the maximum accepted duration is valid. public void Validate_WhenConsumedDurationIsWithinItsRange_ShouldNotHaveValidationError(double consumedDurationInSeconds) { // Arrange @@ -473,8 +473,8 @@ public class ReportConsumptionProgressCommandValidatorTests } [Theory] - [InlineData(0)] // no pages read is still a valid count - [InlineData(42)] // a positive count is valid + [InlineData(0)] // No pages read is still a valid count. + [InlineData(42)] // A positive count is valid. public void Validate_WhenConsecutivePagesReadIsNotNegative_ShouldNotHaveValidationError(int consecutivePagesRead) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/StartConsumption/StartConsumptionCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/StartConsumption/StartConsumptionCommandValidatorTests.cs index 80b24e72..2fdee9f1 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/StartConsumption/StartConsumptionCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/StartConsumption/StartConsumptionCommandValidatorTests.cs @@ -33,10 +33,10 @@ public class StartConsumptionCommandValidatorTests } [Theory] - [InlineData("")] // the library Id is empty - [InlineData(" ")] // the library Id is whitespace only - [InlineData("not-a-guid")] // the library Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the library Id is the empty Guid + [InlineData("")] // The library Id is empty. + [InlineData(" ")] // The library Id is whitespace only. + [InlineData("not-a-guid")] // The library Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The library Id is the empty Guid. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string libraryId) { // Arrange @@ -76,11 +76,11 @@ public class StartConsumptionCommandValidatorTests } [Theory] - [InlineData("")] // the media kind is empty - [InlineData(" ")] // the media kind is whitespace only - [InlineData("Hologram")] // the media kind is not a member of the enumeration - [InlineData("0")] // the media kind is a numeric route value, which the validator rejects by name - [InlineData("1")] // a numeric route value that parses to the defined MusicTrack member, which the old Enum.TryParse and Enum.IsDefined logic accepted + [InlineData("")] // The media kind is empty. + [InlineData(" ")] // The media kind is whitespace only. + [InlineData("Hologram")] // The media kind is not a member of the enumeration. + [InlineData("0")] // The media kind is a numeric route value, which the validator rejects by name. + [InlineData("1")] // A numeric route value that parses to the defined MusicTrack member, which the old Enum.TryParse and Enum.IsDefined logic accepted. public void Validate_WhenMediaKindIsEmptyOrUnsupported_ShouldHaveValidationError(string mediaKind) { // Arrange @@ -94,7 +94,7 @@ public class StartConsumptionCommandValidatorTests } [Theory] - [InlineData("None")] // the default enumeration member is still a member name + [InlineData("None")] // The default enumeration member is still a member name. [InlineData("MusicTrack")] [InlineData("PodcastEpisode")] [InlineData("Audiobook")] @@ -116,8 +116,8 @@ public class StartConsumptionCommandValidatorTests } [Theory] - [InlineData("musictrack")] // the member name is lower case - [InlineData("BoOk")] // the member name is mixed case + [InlineData("musictrack")] // The member name is lower case. + [InlineData("BoOk")] // The member name is mixed case. public void Validate_WhenMediaKindUsesDifferentCasing_ShouldNotHaveValidationError(string mediaKind) { // Arrange @@ -144,10 +144,10 @@ public class StartConsumptionCommandValidatorTests } [Theory] - [InlineData("")] // the media item Id is empty - [InlineData(" ")] // the media item Id is whitespace only - [InlineData("not-a-guid")] // the media item Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the media item Id is the empty Guid + [InlineData("")] // The media item Id is empty. + [InlineData(" ")] // The media item Id is whitespace only. + [InlineData("not-a-guid")] // The media item Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The media item Id is the empty Guid. public void Validate_WhenMediaItemIdIsEmptyOrInvalid_ShouldHaveValidationError(string mediaItemId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/StopConsumption/StopConsumptionCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/StopConsumption/StopConsumptionCommandValidatorTests.cs index 98385b7c..0e344e2e 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/StopConsumption/StopConsumptionCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Commands/StopConsumption/StopConsumptionCommandValidatorTests.cs @@ -34,10 +34,10 @@ public class StopConsumptionCommandValidatorTests } [Theory] - [InlineData("")] // the consumption record Id is empty - [InlineData(" ")] // the consumption record Id is whitespace only - [InlineData("not-a-guid")] // the consumption record Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the consumption record Id is the empty Guid + [InlineData("")] // The consumption record Id is empty. + [InlineData(" ")] // The consumption record Id is whitespace only. + [InlineData("not-a-guid")] // The consumption record Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The consumption record Id is the empty Guid. public void Validate_WhenConsumptionRecordIdIsEmptyOrInvalid_ShouldHaveValidationError(string consumptionRecordId) { // Arrange @@ -182,8 +182,8 @@ public class StopConsumptionCommandValidatorTests } [Theory] - [InlineData(-1)] // a negative offset cannot describe a position within a media item - [InlineData(-0.5)] // a fractional negative offset is rejected the same way + [InlineData(-1)] // A negative offset cannot describe a position within a media item. + [InlineData(-0.5)] // A fractional negative offset is rejected the same way. public void Validate_WhenPositionKindIsTimeOffsetAndOffsetIsNegative_ShouldHaveValidationError(double timeOffsetInSeconds) { // Arrange @@ -199,9 +199,9 @@ public class StopConsumptionCommandValidatorTests } [Theory] - [InlineData(double.NaN)] // not a number is not a position - [InlineData(double.PositiveInfinity)] // an infinite offset is not a position - [InlineData(double.NegativeInfinity)] // a negative infinite offset is not a position either + [InlineData(double.NaN)] // Not a number is not a position. + [InlineData(double.PositiveInfinity)] // An infinite offset is not a position. + [InlineData(double.NegativeInfinity)] // A negative infinite offset is not a position either. public void Validate_WhenPositionKindIsTimeOffsetAndOffsetIsNotFinite_ShouldHaveValidationError(double timeOffsetInSeconds) { // Arrange @@ -340,8 +340,8 @@ public class StopConsumptionCommandValidatorTests } [Theory] - [InlineData(-0.1)] // a fraction below zero is not a fraction of the media item - [InlineData(1.1)] // a fraction above one is not a fraction of the media item + [InlineData(-0.1)] // A fraction below zero is not a fraction of the media item. + [InlineData(1.1)] // A fraction above one is not a fraction of the media item. public void Validate_WhenProgressFractionIsOutsideItsRange_ShouldHaveValidationError(double progressFraction) { // Arrange @@ -355,9 +355,9 @@ public class StopConsumptionCommandValidatorTests } [Theory] - [InlineData(double.NaN)] // not a number is not a fraction - [InlineData(double.PositiveInfinity)] // an infinite fraction is not a fraction - [InlineData(double.NegativeInfinity)] // a negative infinite fraction is not a fraction + [InlineData(double.NaN)] // Not a number is not a fraction. + [InlineData(double.PositiveInfinity)] // An infinite fraction is not a fraction. + [InlineData(double.NegativeInfinity)] // A negative infinite fraction is not a fraction. public void Validate_WhenProgressFractionIsNotFinite_ShouldHaveValidationError(double progressFraction) { // Arrange @@ -371,9 +371,9 @@ public class StopConsumptionCommandValidatorTests } [Theory] - [InlineData(0)] // the start of the media item is a valid fraction - [InlineData(0.5)] // a fraction in between the boundaries is valid - [InlineData(1)] // the end of the media item is a valid fraction + [InlineData(0)] // The start of the media item is a valid fraction. + [InlineData(0.5)] // A fraction in between the boundaries is valid. + [InlineData(1)] // The end of the media item is a valid fraction. public void Validate_WhenProgressFractionIsWithinItsRange_ShouldNotHaveValidationError(double progressFraction) { // Arrange @@ -400,8 +400,8 @@ public class StopConsumptionCommandValidatorTests } [Theory] - [InlineData(-1)] // a negative duration cannot describe consumed time - [InlineData(-0.5)] // a fractional negative duration is rejected the same way + [InlineData(-1)] // A negative duration cannot describe consumed time. + [InlineData(-0.5)] // A fractional negative duration is rejected the same way. public void Validate_WhenConsumedDurationIsNegative_ShouldHaveValidationError(double consumedDurationInSeconds) { // Arrange @@ -415,9 +415,9 @@ public class StopConsumptionCommandValidatorTests } [Theory] - [InlineData(double.NaN)] // not a number is not a duration - [InlineData(double.PositiveInfinity)] // an infinite duration is not a duration - [InlineData(double.NegativeInfinity)] // a negative infinite duration is not a duration + [InlineData(double.NaN)] // Not a number is not a duration. + [InlineData(double.PositiveInfinity)] // An infinite duration is not a duration. + [InlineData(double.NegativeInfinity)] // A negative infinite duration is not a duration. public void Validate_WhenConsumedDurationIsNotFinite_ShouldHaveValidationError(double consumedDurationInSeconds) { // Arrange @@ -444,8 +444,8 @@ public class StopConsumptionCommandValidatorTests } [Theory] - [InlineData(0)] // a session that consumed no time is valid - [InlineData(2_678_400)] // exactly the maximum accepted duration is valid + [InlineData(0)] // A session that consumed no time is valid. + [InlineData(2_678_400)] // Exactly the maximum accepted duration is valid. public void Validate_WhenConsumedDurationIsWithinItsRange_ShouldNotHaveValidationError(double consumedDurationInSeconds) { // Arrange @@ -486,8 +486,8 @@ public class StopConsumptionCommandValidatorTests } [Theory] - [InlineData(0)] // no pages read is still a valid count - [InlineData(42)] // a positive count is valid + [InlineData(0)] // No pages read is still a valid count. + [InlineData(42)] // A positive count is valid. public void Validate_WhenConsecutivePagesReadIsNotNegative_ShouldNotHaveValidationError(int consecutivePagesRead) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsQueryValidatorTests.cs index b4db7bb4..7b359318 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetAllUsersConsumptionStatistics/GetAllUsersConsumptionStatisticsQueryValidatorTests.cs @@ -35,10 +35,10 @@ public class GetAllUsersConsumptionStatisticsQueryValidatorTests } [Theory] - [InlineData("")] // the library Id is empty - [InlineData(" ")] // the library Id is whitespace only - [InlineData("not-a-guid")] // the library Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the library Id is the empty Guid + [InlineData("")] // The library Id is empty. + [InlineData(" ")] // The library Id is whitespace only. + [InlineData("not-a-guid")] // The library Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The library Id is the empty Guid. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string libraryId) { // Arrange @@ -104,10 +104,10 @@ public class GetAllUsersConsumptionStatisticsQueryValidatorTests } [Theory] - [InlineData(nameof(MediaKind.MusicTrack))] // a kind supported by the current catalogues - [InlineData(nameof(MediaKind.Book))] // another kind supported by the current catalogues - [InlineData(nameof(MediaKind.Movie))] // a kind without a catalogue, still a defined kind - [InlineData(nameof(MediaKind.Photo))] // a kind that every session counts for, still a defined kind + [InlineData(nameof(MediaKind.MusicTrack))] // A kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Book))] // Another kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Movie))] // A kind without a catalogue, still a defined kind. + [InlineData(nameof(MediaKind.Photo))] // A kind that every session counts for, still a defined kind. public void Validate_WhenMediaKindIsDefined_ShouldNotHaveValidationError(string mediaKind) { // Arrange @@ -180,9 +180,9 @@ public class GetAllUsersConsumptionStatisticsQueryValidatorTests } [Theory] - [InlineData("")] // an empty bound - [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("")] // An empty bound. + [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 void Validate_WhenADateRangeBoundIsNotAValidDate_ShouldHaveValidationError(string invalidBound) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetConsumptionRecord/GetConsumptionRecordQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetConsumptionRecord/GetConsumptionRecordQueryValidatorTests.cs index f5ac17bc..4323b35b 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetConsumptionRecord/GetConsumptionRecordQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetConsumptionRecord/GetConsumptionRecordQueryValidatorTests.cs @@ -33,10 +33,10 @@ public class GetConsumptionRecordQueryValidatorTests } [Theory] - [InlineData("")] // the consumption record Id is empty - [InlineData(" ")] // the consumption record Id is whitespace only - [InlineData("not-a-guid")] // the consumption record Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the consumption record Id is the empty Guid + [InlineData("")] // The consumption record Id is empty. + [InlineData(" ")] // The consumption record Id is whitespace only. + [InlineData("not-a-guid")] // The consumption record Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The consumption record Id is the empty Guid. public void Validate_WhenConsumptionRecordIdIsEmptyOrInvalid_ShouldHaveValidationError(string consumptionRecordId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetConsumptionStatistics/GetConsumptionStatisticsQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetConsumptionStatistics/GetConsumptionStatisticsQueryValidatorTests.cs index a4121212..43fd7b71 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetConsumptionStatistics/GetConsumptionStatisticsQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetConsumptionStatistics/GetConsumptionStatisticsQueryValidatorTests.cs @@ -35,10 +35,10 @@ public class GetConsumptionStatisticsQueryValidatorTests } [Theory] - [InlineData("")] // the target user Id is empty - [InlineData(" ")] // the target user Id is whitespace only - [InlineData("not-a-guid")] // the target user Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the target user Id is the empty Guid + [InlineData("")] // The target user Id is empty. + [InlineData(" ")] // The target user Id is whitespace only. + [InlineData("not-a-guid")] // The target user Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The target user Id is the empty Guid. public void Validate_WhenTargetUserIdIsEmptyOrInvalid_ShouldHaveValidationError(string targetUserId) { // Arrange @@ -78,10 +78,10 @@ public class GetConsumptionStatisticsQueryValidatorTests } [Theory] - [InlineData("")] // the library Id is empty - [InlineData(" ")] // the library Id is whitespace only - [InlineData("not-a-guid")] // the library Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the library Id is the empty Guid + [InlineData("")] // The library Id is empty. + [InlineData(" ")] // The library Id is whitespace only. + [InlineData("not-a-guid")] // The library Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The library Id is the empty Guid. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string libraryId) { // Arrange @@ -147,10 +147,10 @@ public class GetConsumptionStatisticsQueryValidatorTests } [Theory] - [InlineData(nameof(MediaKind.MusicTrack))] // a kind supported by the current catalogues - [InlineData(nameof(MediaKind.Book))] // another kind supported by the current catalogues - [InlineData(nameof(MediaKind.Movie))] // a kind without a catalogue, still a defined kind - [InlineData(nameof(MediaKind.Photo))] // a kind that every session counts for, still a defined kind + [InlineData(nameof(MediaKind.MusicTrack))] // A kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Book))] // Another kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Movie))] // A kind without a catalogue, still a defined kind. + [InlineData(nameof(MediaKind.Photo))] // A kind that every session counts for, still a defined kind. public void Validate_WhenMediaKindIsDefined_ShouldNotHaveValidationError(string mediaKind) { // Arrange @@ -223,9 +223,9 @@ public class GetConsumptionStatisticsQueryValidatorTests } [Theory] - [InlineData("")] // an empty bound - [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("")] // An empty bound. + [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 void Validate_WhenADateRangeBoundIsNotAValidDate_ShouldHaveValidationError(string invalidBound) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetGenreConsumption/GetGenreConsumptionQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetGenreConsumption/GetGenreConsumptionQueryValidatorTests.cs index 17363bf7..812c96f3 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetGenreConsumption/GetGenreConsumptionQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetGenreConsumption/GetGenreConsumptionQueryValidatorTests.cs @@ -36,10 +36,10 @@ public class GetGenreConsumptionQueryValidatorTests } [Theory] - [InlineData("")] // the target user Id is empty - [InlineData(" ")] // the target user Id is whitespace only - [InlineData("not-a-guid")] // the target user Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the target user Id is the empty Guid + [InlineData("")] // The target user Id is empty. + [InlineData(" ")] // The target user Id is whitespace only. + [InlineData("not-a-guid")] // The target user Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The target user Id is the empty Guid. public void Validate_WhenTargetUserIdIsEmptyOrInvalid_ShouldHaveValidationError(string targetUserId) { // Arrange @@ -79,10 +79,10 @@ public class GetGenreConsumptionQueryValidatorTests } [Theory] - [InlineData("")] // the library Id is empty - [InlineData(" ")] // the library Id is whitespace only - [InlineData("not-a-guid")] // the library Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the library Id is the empty Guid + [InlineData("")] // The library Id is empty. + [InlineData(" ")] // The library Id is whitespace only. + [InlineData("not-a-guid")] // The library Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The library Id is the empty Guid. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string libraryId) { // Arrange @@ -122,11 +122,11 @@ public class GetGenreConsumptionQueryValidatorTests } [Theory] - [InlineData("")] // the media kind is empty - [InlineData(" ")] // the media kind is whitespace only - [InlineData("not-a-media-kind")] // the media kind is not a member name - [InlineData("999")] // the media kind is numeric, which must not be accepted as a member name - [InlineData("None")] // None is not a valid media kind for a consumption record + [InlineData("")] // The media kind is empty. + [InlineData(" ")] // The media kind is whitespace only. + [InlineData("not-a-media-kind")] // The media kind is not a member name. + [InlineData("999")] // The media kind is numeric, which must not be accepted as a member name. + [InlineData("None")] // None is not a valid media kind for a consumption record. public void Validate_WhenMediaKindIsInvalid_ShouldHaveValidationError(string mediaKind) { // Arrange @@ -140,11 +140,11 @@ public class GetGenreConsumptionQueryValidatorTests } [Theory] - [InlineData(nameof(MediaKind.MusicTrack))] // a kind supported by the current catalogues - [InlineData(nameof(MediaKind.Book))] // another kind supported by the current catalogues - [InlineData(nameof(MediaKind.Movie))] // a kind without a catalogue, still a defined kind - [InlineData(nameof(MediaKind.Photo))] // a kind that every session counts for, still a defined kind - [InlineData("musicTrack")] // member names are matched case-insensitively + [InlineData(nameof(MediaKind.MusicTrack))] // A kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Book))] // Another kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Movie))] // A kind without a catalogue, still a defined kind. + [InlineData(nameof(MediaKind.Photo))] // A kind that every session counts for, still a defined kind. + [InlineData("musicTrack")] // Member names are matched case-insensitively. public void Validate_WhenMediaKindIsDefined_ShouldNotHaveValidationError(string mediaKind) { // Arrange @@ -158,8 +158,8 @@ public class GetGenreConsumptionQueryValidatorTests } [Theory] - [InlineData("not-a-date")] // the start is not a date - [InlineData("2026-13-01T00:00:00Z")] // the start is a date with an out of range month + [InlineData("not-a-date")] // The start is not a date. + [InlineData("2026-13-01T00:00:00Z")] // The start is a date with an out of range month. public void Validate_WhenFromUtcIsMalformed_ShouldHaveValidationError(string fromUtc) { // Arrange @@ -175,8 +175,8 @@ public class GetGenreConsumptionQueryValidatorTests } [Theory] - [InlineData("not-a-date")] // the end is not a date - [InlineData("2026-13-01T00:00:00Z")] // the end is a date with an out of range month + [InlineData("not-a-date")] // The end is not a date. + [InlineData("2026-13-01T00:00:00Z")] // The end is a date with an out of range month. public void Validate_WhenToUtcIsMalformed_ShouldHaveValidationError(string toUtc) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetMostConsumed/GetMostConsumedQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetMostConsumed/GetMostConsumedQueryValidatorTests.cs index dfefa1f6..ffa2d9bd 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetMostConsumed/GetMostConsumedQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetMostConsumed/GetMostConsumedQueryValidatorTests.cs @@ -35,10 +35,10 @@ public class GetMostConsumedQueryValidatorTests } [Theory] - [InlineData("")] // the target user Id is empty - [InlineData(" ")] // the target user Id is whitespace only - [InlineData("not-a-guid")] // the target user Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the target user Id is the empty Guid + [InlineData("")] // The target user Id is empty. + [InlineData(" ")] // The target user Id is whitespace only. + [InlineData("not-a-guid")] // The target user Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The target user Id is the empty Guid. public void Validate_WhenTargetUserIdIsEmptyOrInvalid_ShouldHaveValidationError(string targetUserId) { // Arrange @@ -78,10 +78,10 @@ public class GetMostConsumedQueryValidatorTests } [Theory] - [InlineData("")] // the library Id is empty - [InlineData(" ")] // the library Id is whitespace only - [InlineData("not-a-guid")] // the library Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the library Id is the empty Guid + [InlineData("")] // The library Id is empty. + [InlineData(" ")] // The library Id is whitespace only. + [InlineData("not-a-guid")] // The library Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The library Id is the empty Guid. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string libraryId) { // Arrange @@ -147,10 +147,10 @@ public class GetMostConsumedQueryValidatorTests } [Theory] - [InlineData(nameof(MediaKind.MusicTrack))] // a kind supported by the current catalogues - [InlineData(nameof(MediaKind.Book))] // another kind supported by the current catalogues - [InlineData(nameof(MediaKind.Movie))] // a kind without a catalogue, still a defined kind - [InlineData(nameof(MediaKind.Photo))] // a kind that every session counts for, still a defined kind + [InlineData(nameof(MediaKind.MusicTrack))] // A kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Book))] // Another kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Movie))] // A kind without a catalogue, still a defined kind. + [InlineData(nameof(MediaKind.Photo))] // A kind that every session counts for, still a defined kind. public void Validate_WhenMediaKindIsDefined_ShouldNotHaveValidationError(string mediaKind) { // Arrange @@ -223,9 +223,9 @@ public class GetMostConsumedQueryValidatorTests } [Theory] - [InlineData("")] // an empty bound - [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("")] // An empty bound. + [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 void Validate_WhenADateRangeBoundIsNotAValidDate_ShouldHaveValidationError(string invalidBound) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetRecentlyConsumed/GetRecentlyConsumedQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetRecentlyConsumed/GetRecentlyConsumedQueryValidatorTests.cs index bcf67531..af1de650 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetRecentlyConsumed/GetRecentlyConsumedQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetRecentlyConsumed/GetRecentlyConsumedQueryValidatorTests.cs @@ -35,10 +35,10 @@ public class GetRecentlyConsumedQueryValidatorTests } [Theory] - [InlineData("")] // the target user Id is empty - [InlineData(" ")] // the target user Id is whitespace only - [InlineData("not-a-guid")] // the target user Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the target user Id is the empty Guid + [InlineData("")] // The target user Id is empty. + [InlineData(" ")] // The target user Id is whitespace only. + [InlineData("not-a-guid")] // The target user Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The target user Id is the empty Guid. public void Validate_WhenTargetUserIdIsEmptyOrInvalid_ShouldHaveValidationError(string targetUserId) { // Arrange @@ -78,10 +78,10 @@ public class GetRecentlyConsumedQueryValidatorTests } [Theory] - [InlineData("")] // the library Id is empty - [InlineData(" ")] // the library Id is whitespace only - [InlineData("not-a-guid")] // the library Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the library Id is the empty Guid + [InlineData("")] // The library Id is empty. + [InlineData(" ")] // The library Id is whitespace only. + [InlineData("not-a-guid")] // The library Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The library Id is the empty Guid. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string libraryId) { // Arrange @@ -147,10 +147,10 @@ public class GetRecentlyConsumedQueryValidatorTests } [Theory] - [InlineData(nameof(MediaKind.MusicTrack))] // a kind supported by the current catalogues - [InlineData(nameof(MediaKind.Book))] // another kind supported by the current catalogues - [InlineData(nameof(MediaKind.Movie))] // a kind without a catalogue, still a defined kind - [InlineData(nameof(MediaKind.Photo))] // a kind that every session counts for, still a defined kind + [InlineData(nameof(MediaKind.MusicTrack))] // A kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Book))] // Another kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Movie))] // A kind without a catalogue, still a defined kind. + [InlineData(nameof(MediaKind.Photo))] // A kind that every session counts for, still a defined kind. public void Validate_WhenMediaKindIsDefined_ShouldNotHaveValidationError(string mediaKind) { // Arrange @@ -223,9 +223,9 @@ public class GetRecentlyConsumedQueryValidatorTests } [Theory] - [InlineData("")] // an empty bound - [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("")] // An empty bound. + [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 void Validate_WhenADateRangeBoundIsNotAValidDate_ShouldHaveValidationError(string invalidBound) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetResumePoint/GetResumePointQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetResumePoint/GetResumePointQueryValidatorTests.cs index 9616d88a..90db01e7 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetResumePoint/GetResumePointQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetResumePoint/GetResumePointQueryValidatorTests.cs @@ -34,11 +34,11 @@ public class GetResumePointQueryValidatorTests } [Theory] - [InlineData("")] // the media kind is empty - [InlineData(" ")] // the media kind is whitespace only - [InlineData("not-a-media-kind")] // the media kind is not the name of a defined kind - [InlineData("99999")] // a numeric value that is not the name of a defined kind - [InlineData("1")] // a numeric value that parses to the defined MusicTrack member, which the old Enum.TryParse and Enum.IsDefined logic accepted + [InlineData("")] // The media kind is empty. + [InlineData(" ")] // The media kind is whitespace only. + [InlineData("not-a-media-kind")] // The media kind is not the name of a defined kind. + [InlineData("99999")] // A numeric value that is not the name of a defined kind. + [InlineData("1")] // A numeric value that parses to the defined MusicTrack member, which the old Enum.TryParse and Enum.IsDefined logic accepted. public void Validate_WhenMediaKindIsNotTheNameOfADefinedKind_ShouldHaveValidationError(string mediaKind) { // Arrange @@ -52,10 +52,10 @@ public class GetResumePointQueryValidatorTests } [Theory] - [InlineData(nameof(MediaKind.MusicTrack))] // a kind supported by the current catalogues - [InlineData(nameof(MediaKind.Book))] // another kind supported by the current catalogues - [InlineData(nameof(MediaKind.Movie))] // a kind without a catalogue, still a defined kind - [InlineData(nameof(MediaKind.Photo))] // a kind that cannot be resumed, still a defined kind + [InlineData(nameof(MediaKind.MusicTrack))] // A kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Book))] // Another kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Movie))] // A kind without a catalogue, still a defined kind. + [InlineData(nameof(MediaKind.Photo))] // A kind that cannot be resumed, still a defined kind. public void Validate_WhenMediaKindIsTheNameOfADefinedKind_ShouldNotHaveValidationError(string mediaKind) { // Arrange @@ -69,9 +69,9 @@ public class GetResumePointQueryValidatorTests } [Theory] - [InlineData("musictrack")] // the name of a defined kind, in lower case - [InlineData("MUSICTRACK")] // the name of a defined kind, in upper case - [InlineData("musicTrack")] // the name of a defined kind, in mixed case + [InlineData("musictrack")] // The name of a defined kind, in lower case. + [InlineData("MUSICTRACK")] // The name of a defined kind, in upper case. + [InlineData("musicTrack")] // The name of a defined kind, in mixed case. public void Validate_WhenMediaKindIsTheNameOfADefinedKindInAnotherCase_ShouldNotHaveValidationError(string mediaKind) { // Arrange @@ -98,10 +98,10 @@ public class GetResumePointQueryValidatorTests } [Theory] - [InlineData("")] // the media item Id is empty - [InlineData(" ")] // the media item Id is whitespace only - [InlineData("not-a-guid")] // the media item Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the media item Id is the empty Guid + [InlineData("")] // The media item Id is empty. + [InlineData(" ")] // The media item Id is whitespace only. + [InlineData("not-a-guid")] // The media item Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The media item Id is the empty Guid. public void Validate_WhenMediaItemIdIsEmptyOrInvalid_ShouldHaveValidationError(string mediaItemId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetTagConsumption/GetTagConsumptionQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetTagConsumption/GetTagConsumptionQueryValidatorTests.cs index 3a55ef5f..276eea5f 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetTagConsumption/GetTagConsumptionQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaConsumption/Queries/GetTagConsumption/GetTagConsumptionQueryValidatorTests.cs @@ -35,10 +35,10 @@ public class GetTagConsumptionQueryValidatorTests } [Theory] - [InlineData("")] // the target user Id is empty - [InlineData(" ")] // the target user Id is whitespace only - [InlineData("not-a-guid")] // the target user Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the target user Id is the empty Guid + [InlineData("")] // The target user Id is empty. + [InlineData(" ")] // The target user Id is whitespace only. + [InlineData("not-a-guid")] // The target user Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The target user Id is the empty Guid. public void Validate_WhenTargetUserIdIsEmptyOrInvalid_ShouldHaveValidationError(string targetUserId) { // Arrange @@ -78,10 +78,10 @@ public class GetTagConsumptionQueryValidatorTests } [Theory] - [InlineData("")] // the library Id is empty - [InlineData(" ")] // the library Id is whitespace only - [InlineData("not-a-guid")] // the library Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the library Id is the empty Guid + [InlineData("")] // The library Id is empty. + [InlineData(" ")] // The library Id is whitespace only. + [InlineData("not-a-guid")] // The library Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The library Id is the empty Guid. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string libraryId) { // Arrange @@ -147,10 +147,10 @@ public class GetTagConsumptionQueryValidatorTests } [Theory] - [InlineData(nameof(MediaKind.MusicTrack))] // a kind supported by the current catalogues - [InlineData(nameof(MediaKind.Book))] // another kind supported by the current catalogues - [InlineData(nameof(MediaKind.Movie))] // a kind without a catalogue, still a defined kind - [InlineData(nameof(MediaKind.Photo))] // a kind that every session counts for, still a defined kind + [InlineData(nameof(MediaKind.MusicTrack))] // A kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Book))] // Another kind supported by the current catalogues. + [InlineData(nameof(MediaKind.Movie))] // A kind without a catalogue, still a defined kind. + [InlineData(nameof(MediaKind.Photo))] // A kind that every session counts for, still a defined kind. public void Validate_WhenMediaKindIsDefined_ShouldNotHaveValidationError(string mediaKind) { // Arrange @@ -223,9 +223,9 @@ public class GetTagConsumptionQueryValidatorTests } [Theory] - [InlineData("")] // an empty bound - [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("")] // An empty bound. + [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 void Validate_WhenADateRangeBoundIsNotAValidDate_ShouldHaveValidationError(string invalidBound) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/AddAlbum/AddAlbumCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/AddAlbum/AddAlbumCommandValidatorTests.cs index 89f88b2b..e85fbaed 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/AddAlbum/AddAlbumCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/AddAlbum/AddAlbumCommandValidatorTests.cs @@ -44,11 +44,11 @@ public class AddAlbumCommandValidatorTests private readonly IsrcDtoFixture _isrcDtoFixture = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -62,11 +62,11 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange @@ -106,8 +106,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData("")] // empty title - [InlineData(" ")] // whitespace title, which the not empty rule rejects + [InlineData("")] // Empty title. + [InlineData(" ")] // Whitespace title, which the not empty rule rejects. public void Validate_WhenTitleIsEmpty_ShouldHaveValidationError(string title) { // Arrange @@ -304,8 +304,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid total discs value - [InlineData(-1)] // a negative total discs value is not valid + [InlineData(0)] // Zero is not a valid total discs value. + [InlineData(-1)] // A negative total discs value is not valid. public void Validate_WhenTotalDiscsIsNotPositive_ShouldHaveValidationError(int totalDiscs) { // Arrange @@ -345,8 +345,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid total tracks value - [InlineData(-1)] // a negative total tracks value is not valid + [InlineData(0)] // Zero is not a valid total tracks value. + [InlineData(-1)] // A negative total tracks value is not valid. public void Validate_WhenTotalTracksIsNotPositive_ShouldHaveValidationError(int totalTracks) { // Arrange @@ -1001,9 +1001,9 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData("123")] // too short to be a barcode - [InlineData("abcdefghijkl")] // not numeric - [InlineData("12345678901234")] // too long to be a barcode + [InlineData("123")] // Too short to be a barcode. + [InlineData("abcdefghijkl")] // Not numeric. + [InlineData("12345678901234")] // Too long to be a barcode. public void Validate_WhenBarcodeHasInvalidFormat_ShouldHaveValidationError(string barcode) { // Arrange @@ -1017,8 +1017,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData("123456789012")] // 12 digit barcode - [InlineData("1234567890123")] // 13 digit barcode + [InlineData("123456789012")] // 12 digit barcode. + [InlineData("1234567890123")] // 13 digit barcode. public void Validate_WhenBarcodeIsValid_ShouldNotHaveValidationError(string barcode) { // Arrange @@ -1181,8 +1181,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid rating value - [InlineData(-1)] // a negative rating value is not valid + [InlineData(0)] // Zero is not a valid rating value. + [InlineData(-1)] // A negative rating value is not valid. public void Validate_WhenRatingValueIsNotPositive_ShouldHaveValidationError(decimal value) { // Arrange @@ -1222,8 +1222,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid maximum rating value - [InlineData(-1)] // a negative maximum rating value is not valid + [InlineData(0)] // Zero is not a valid maximum rating value. + [InlineData(-1)] // A negative maximum rating value is not valid. public void Validate_WhenRatingMaxValueIsNotPositive_ShouldHaveValidationError(decimal maxValue) { // Arrange @@ -1319,8 +1319,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData("")] // empty path - [InlineData(" ")] // whitespace path, which the not empty rule rejects + [InlineData("")] // Empty path. + [InlineData(" ")] // Whitespace path, which the not empty rule rejects. public void Validate_WhenTrackPathIsEmpty_ShouldHaveValidationError(string path) { // Arrange @@ -1817,8 +1817,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid track number - [InlineData(-1)] // a negative track number is not valid + [InlineData(0)] // Zero is not a valid track number. + [InlineData(-1)] // A negative track number is not valid. public void Validate_WhenTrackNumberIsNotPositive_ShouldHaveValidationError(int trackNumber) { // Arrange @@ -1845,8 +1845,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid disc number - [InlineData(-1)] // a negative disc number is not valid + [InlineData(0)] // Zero is not a valid disc number. + [InlineData(-1)] // A negative disc number is not valid. public void Validate_WhenDiscNumberIsNotPositive_ShouldHaveValidationError(int discNumber) { // Arrange @@ -1964,8 +1964,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid tempo - [InlineData(-1)] // a negative tempo is not valid + [InlineData(0)] // Zero is not a valid tempo. + [InlineData(-1)] // A negative tempo is not valid. public void Validate_WhenBpmIsNotPositive_ShouldHaveValidationError(int bpm) { // Arrange @@ -2148,8 +2148,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid rating value - [InlineData(-1)] // a negative rating value is not valid + [InlineData(0)] // Zero is not a valid rating value. + [InlineData(-1)] // A negative rating value is not valid. public void Validate_WhenTrackRatingValueIsNotPositive_ShouldHaveValidationError(decimal value) { // Arrange @@ -2176,8 +2176,8 @@ public class AddAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid maximum rating value - [InlineData(-1)] // a negative maximum rating value is not valid + [InlineData(0)] // Zero is not a valid maximum rating value. + [InlineData(-1)] // A negative maximum rating value is not valid. public void Validate_WhenTrackRatingMaxValueIsNotPositive_ShouldHaveValidationError(decimal maxValue) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandValidatorTests.cs index 6cb7ab58..19e2ff22 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandValidatorTests.cs @@ -21,11 +21,11 @@ public class DeleteAlbumCommandValidatorTests private readonly DeleteAlbumCommandValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class DeleteAlbumCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange @@ -57,11 +57,11 @@ public class DeleteAlbumCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveValidationError(string? albumId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/RestoreAlbum/RestoreAlbumCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/RestoreAlbum/RestoreAlbumCommandValidatorTests.cs index 1e0d6b37..2a931435 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/RestoreAlbum/RestoreAlbumCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/RestoreAlbum/RestoreAlbumCommandValidatorTests.cs @@ -21,11 +21,11 @@ public class RestoreAlbumCommandValidatorTests private readonly RestoreAlbumCommandValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class RestoreAlbumCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange @@ -57,11 +57,11 @@ public class RestoreAlbumCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveValidationError(string? albumId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbum/UpdateAlbumCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbum/UpdateAlbumCommandValidatorTests.cs index 057357a2..ec351f95 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbum/UpdateAlbumCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbum/UpdateAlbumCommandValidatorTests.cs @@ -37,11 +37,11 @@ public class UpdateAlbumCommandValidatorTests private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -55,11 +55,11 @@ public class UpdateAlbumCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange @@ -73,11 +73,11 @@ public class UpdateAlbumCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveValidationError(string? albumId) { // Arrange @@ -117,8 +117,8 @@ public class UpdateAlbumCommandValidatorTests } [Theory] - [InlineData("")] // empty title - [InlineData(" ")] // whitespace title, which the not empty rule rejects + [InlineData("")] // Empty title. + [InlineData(" ")] // Whitespace title, which the not empty rule rejects. public void Validate_WhenTitleIsEmpty_ShouldHaveValidationError(string title) { // Arrange @@ -315,8 +315,8 @@ public class UpdateAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid total discs value - [InlineData(-1)] // a negative total discs value is not valid + [InlineData(0)] // Zero is not a valid total discs value. + [InlineData(-1)] // A negative total discs value is not valid. public void Validate_WhenTotalDiscsIsNotPositive_ShouldHaveValidationError(int totalDiscs) { // Arrange @@ -356,8 +356,8 @@ public class UpdateAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid total tracks value - [InlineData(-1)] // a negative total tracks value is not valid + [InlineData(0)] // Zero is not a valid total tracks value. + [InlineData(-1)] // A negative total tracks value is not valid. public void Validate_WhenTotalTracksIsNotPositive_ShouldHaveValidationError(int totalTracks) { // Arrange @@ -1012,9 +1012,9 @@ public class UpdateAlbumCommandValidatorTests } [Theory] - [InlineData("123")] // too short to be a barcode - [InlineData("abcdefghijkl")] // not numeric - [InlineData("12345678901234")] // too long to be a barcode + [InlineData("123")] // Too short to be a barcode. + [InlineData("abcdefghijkl")] // Not numeric. + [InlineData("12345678901234")] // Too long to be a barcode. public void Validate_WhenBarcodeHasInvalidFormat_ShouldHaveValidationError(string barcode) { // Arrange @@ -1028,8 +1028,8 @@ public class UpdateAlbumCommandValidatorTests } [Theory] - [InlineData("123456789012")] // 12 digit barcode - [InlineData("1234567890123")] // 13 digit barcode + [InlineData("123456789012")] // 12 digit barcode. + [InlineData("1234567890123")] // 13 digit barcode. public void Validate_WhenBarcodeIsValid_ShouldNotHaveValidationError(string barcode) { // Arrange @@ -1192,8 +1192,8 @@ public class UpdateAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid rating value - [InlineData(-1)] // a negative rating value is not valid + [InlineData(0)] // Zero is not a valid rating value. + [InlineData(-1)] // A negative rating value is not valid. public void Validate_WhenRatingValueIsNotPositive_ShouldHaveValidationError(decimal value) { // Arrange @@ -1233,8 +1233,8 @@ public class UpdateAlbumCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid maximum rating value - [InlineData(-1)] // a negative maximum rating value is not valid + [InlineData(0)] // Zero is not a valid maximum rating value. + [InlineData(-1)] // A negative maximum rating value is not valid. public void Validate_WhenRatingMaxValueIsNotPositive_ShouldHaveValidationError(decimal maxValue) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandlerTests.cs index bb61e4c6..7bfe08b5 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandlerTests.cs @@ -547,9 +547,9 @@ public class UpdateAlbumCoverCommandHandlerTests } [Theory] - [InlineData(null)] // no file name at all - [InlineData("")] // empty file name - [InlineData(" ")] // whitespace file name + [InlineData(null)] // No file name at all. + [InlineData("")] // Empty file name. + [InlineData(" ")] // Whitespace file name. public async Task HandleAsync_WhenExistingCoverPathIsEmpty_ShouldNotDeletePreviousArtwork(string? existingCoverPath) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryValidatorTests.cs index dfc95f02..94ce2c26 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryValidatorTests.cs @@ -21,11 +21,11 @@ public class GetAlbumQueryValidatorTests private readonly GetAlbumQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class GetAlbumQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange @@ -57,11 +57,11 @@ public class GetAlbumQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveValidationError(string? albumId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbumTracks/GetAlbumTracksQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbumTracks/GetAlbumTracksQueryValidatorTests.cs index 0f54fe27..c588f296 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbumTracks/GetAlbumTracksQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbumTracks/GetAlbumTracksQueryValidatorTests.cs @@ -21,11 +21,11 @@ public class GetAlbumTracksQueryValidatorTests private readonly GetAlbumTracksQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class GetAlbumTracksQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange @@ -57,11 +57,11 @@ public class GetAlbumTracksQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveValidationError(string? albumId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbumTracksLite/GetAlbumTracksLiteQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbumTracksLite/GetAlbumTracksLiteQueryValidatorTests.cs index 2532021e..1eb8b8a5 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbumTracksLite/GetAlbumTracksLiteQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbumTracksLite/GetAlbumTracksLiteQueryValidatorTests.cs @@ -21,11 +21,11 @@ public class GetAlbumTracksLiteQueryValidatorTests private readonly GetAlbumTracksLiteQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class GetAlbumTracksLiteQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange @@ -57,11 +57,11 @@ public class GetAlbumTracksLiteQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveValidationError(string? albumId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetDeletedAlbums/GetDeletedAlbumsQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetDeletedAlbums/GetDeletedAlbumsQueryValidatorTests.cs index d7c2a8de..504abba6 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetDeletedAlbums/GetDeletedAlbumsQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetDeletedAlbums/GetDeletedAlbumsQueryValidatorTests.cs @@ -21,11 +21,11 @@ public class GetDeletedAlbumsQueryValidatorTests private readonly GetDeletedAlbumsQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/AddArtist/AddArtistCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/AddArtist/AddArtistCommandValidatorTests.cs index c642bbba..65833bdc 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/AddArtist/AddArtistCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/AddArtist/AddArtistCommandValidatorTests.cs @@ -46,11 +46,11 @@ public class AddArtistCommandValidatorTests private readonly IsrcDtoFixture _isrcDtoFixture = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -77,8 +77,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData("")] // empty name - [InlineData(" ")] // whitespace name, which the not empty rule rejects + [InlineData("")] // Empty name. + [InlineData(" ")] // Whitespace name, which the not empty rule rejects. public void Validate_WhenNameIsEmpty_ShouldHaveValidationError(string name) { // Arrange @@ -290,8 +290,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData("")] // empty title - [InlineData(" ")] // whitespace title, which the not empty rule rejects + [InlineData("")] // Empty title. + [InlineData(" ")] // Whitespace title, which the not empty rule rejects. public void Validate_WhenAlbumTitleIsEmpty_ShouldHaveValidationError(string title) { // Arrange @@ -436,8 +436,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid total discs value - [InlineData(-1)] // a negative total discs value is not valid + [InlineData(0)] // Zero is not a valid total discs value. + [InlineData(-1)] // A negative total discs value is not valid. public void Validate_WhenAlbumTotalDiscsIsNotPositive_ShouldHaveValidationError(int totalDiscs) { // Arrange @@ -477,8 +477,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid total tracks value - [InlineData(-1)] // a negative total tracks value is not valid + [InlineData(0)] // Zero is not a valid total tracks value. + [InlineData(-1)] // A negative total tracks value is not valid. public void Validate_WhenAlbumTotalTracksIsNotPositive_ShouldHaveValidationError(int totalTracks) { // Arrange @@ -921,9 +921,9 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData("123")] // too short to be a barcode - [InlineData("abcdefghijkl")] // not numeric - [InlineData("12345678901234")] // too long to be a barcode + [InlineData("123")] // Too short to be a barcode. + [InlineData("abcdefghijkl")] // Not numeric. + [InlineData("12345678901234")] // Too long to be a barcode. public void Validate_WhenAlbumBarcodeHasInvalidFormat_ShouldHaveValidationError(string barcode) { // Arrange @@ -937,8 +937,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData("123456789012")] // 12 digit barcode - [InlineData("1234567890123")] // 13 digit barcode + [InlineData("123456789012")] // 12 digit barcode. + [InlineData("1234567890123")] // 13 digit barcode. public void Validate_WhenAlbumBarcodeIsValid_ShouldNotHaveValidationError(string barcode) { // Arrange @@ -1070,8 +1070,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid rating value - [InlineData(-1)] // a negative rating value is not valid + [InlineData(0)] // Zero is not a valid rating value. + [InlineData(-1)] // A negative rating value is not valid. public void Validate_WhenAlbumRatingValueIsNotPositive_ShouldHaveValidationError(decimal value) { // Arrange @@ -1111,8 +1111,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid maximum rating value - [InlineData(-1)] // a negative maximum rating value is not valid + [InlineData(0)] // Zero is not a valid maximum rating value. + [InlineData(-1)] // A negative maximum rating value is not valid. public void Validate_WhenAlbumRatingMaxValueIsNotPositive_ShouldHaveValidationError(decimal maxValue) { // Arrange @@ -1191,8 +1191,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData("")] // empty path - [InlineData(" ")] // whitespace path, which the not empty rule rejects + [InlineData("")] // Empty path. + [InlineData(" ")] // Whitespace path, which the not empty rule rejects. public void Validate_WhenTrackPathIsEmpty_ShouldHaveValidationError(string path) { // Arrange @@ -1676,8 +1676,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid track number - [InlineData(-1)] // a negative track number is not valid + [InlineData(0)] // Zero is not a valid track number. + [InlineData(-1)] // A negative track number is not valid. public void Validate_WhenTrackNumberIsNotPositive_ShouldHaveValidationError(int trackNumber) { // Arrange @@ -1691,8 +1691,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid disc number - [InlineData(-1)] // a negative disc number is not valid + [InlineData(0)] // Zero is not a valid disc number. + [InlineData(-1)] // A negative disc number is not valid. public void Validate_WhenDiscNumberIsNotPositive_ShouldHaveValidationError(int discNumber) { // Arrange @@ -1732,8 +1732,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid tempo - [InlineData(-1)] // a negative tempo is not valid + [InlineData(0)] // Zero is not a valid tempo. + [InlineData(-1)] // A negative tempo is not valid. public void Validate_WhenTrackBpmIsNotPositive_ShouldHaveValidationError(int bpm) { // Arrange @@ -1838,8 +1838,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid rating value - [InlineData(-1)] // a negative rating value is not valid + [InlineData(0)] // Zero is not a valid rating value. + [InlineData(-1)] // A negative rating value is not valid. public void Validate_WhenTrackRatingValueIsNotPositive_ShouldHaveValidationError(decimal value) { // Arrange @@ -1866,8 +1866,8 @@ public class AddArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid maximum rating value - [InlineData(-1)] // a negative maximum rating value is not valid + [InlineData(0)] // Zero is not a valid maximum rating value. + [InlineData(-1)] // A negative maximum rating value is not valid. public void Validate_WhenTrackRatingMaxValueIsNotPositive_ShouldHaveValidationError(decimal maxValue) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandValidatorTests.cs index b0c640a1..c0c94c95 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandValidatorTests.cs @@ -21,11 +21,11 @@ public class DeleteArtistCommandValidatorTests private readonly DeleteArtistCommandValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class DeleteArtistCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/RestoreArtist/RestoreArtistCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/RestoreArtist/RestoreArtistCommandValidatorTests.cs index 270fda1c..d38778d0 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/RestoreArtist/RestoreArtistCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/RestoreArtist/RestoreArtistCommandValidatorTests.cs @@ -21,11 +21,11 @@ public class RestoreArtistCommandValidatorTests private readonly RestoreArtistCommandValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class RestoreArtistCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtist/UpdateArtistCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtist/UpdateArtistCommandValidatorTests.cs index a5cd1299..d3151f53 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtist/UpdateArtistCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtist/UpdateArtistCommandValidatorTests.cs @@ -46,11 +46,11 @@ public class UpdateArtistCommandValidatorTests private readonly IsrcDtoFixture _isrcDtoFixture = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -64,11 +64,11 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange @@ -95,8 +95,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData("")] // empty name - [InlineData(" ")] // whitespace name, which the not empty rule rejects + [InlineData("")] // Empty name. + [InlineData(" ")] // Whitespace name, which the not empty rule rejects. public void Validate_WhenNameIsEmpty_ShouldHaveValidationError(string name) { // Arrange @@ -347,8 +347,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData("")] // empty title - [InlineData(" ")] // whitespace title, which the not empty rule rejects + [InlineData("")] // Empty title. + [InlineData(" ")] // Whitespace title, which the not empty rule rejects. public void Validate_WhenAlbumTitleIsEmpty_ShouldHaveValidationError(string title) { // Arrange @@ -519,8 +519,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid total discs value - [InlineData(-1)] // a negative total discs value is not valid + [InlineData(0)] // Zero is not a valid total discs value. + [InlineData(-1)] // A negative total discs value is not valid. public void Validate_WhenAlbumTotalDiscsIsNotPositive_ShouldHaveValidationError(int totalDiscs) { // Arrange @@ -547,8 +547,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid total tracks value - [InlineData(-1)] // a negative total tracks value is not valid + [InlineData(0)] // Zero is not a valid total tracks value. + [InlineData(-1)] // A negative total tracks value is not valid. public void Validate_WhenAlbumTotalTracksIsNotPositive_ShouldHaveValidationError(int totalTracks) { // Arrange @@ -1138,9 +1138,9 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData("123")] // too short to be a barcode - [InlineData("abcdefghijkl")] // not numeric - [InlineData("12345678901234")] // too long to be a barcode + [InlineData("123")] // Too short to be a barcode. + [InlineData("abcdefghijkl")] // Not numeric. + [InlineData("12345678901234")] // Too long to be a barcode. public void Validate_WhenAlbumBarcodeHasInvalidFormat_ShouldHaveValidationError(string barcode) { // Arrange @@ -1154,8 +1154,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData("123456789012")] // 12 digit barcode - [InlineData("1234567890123")] // 13 digit barcode + [InlineData("123456789012")] // 12 digit barcode. + [InlineData("1234567890123")] // 13 digit barcode. public void Validate_WhenAlbumBarcodeIsValid_ShouldNotHaveValidationError(string barcode) { // Arrange @@ -1315,8 +1315,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid rating value - [InlineData(-1)] // a negative rating value is not valid + [InlineData(0)] // Zero is not a valid rating value. + [InlineData(-1)] // A negative rating value is not valid. public void Validate_WhenAlbumRatingValueIsNotPositive_ShouldHaveValidationError(decimal value) { // Arrange @@ -1356,8 +1356,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid maximum rating value - [InlineData(-1)] // a negative maximum rating value is not valid + [InlineData(0)] // Zero is not a valid maximum rating value. + [InlineData(-1)] // A negative maximum rating value is not valid. public void Validate_WhenAlbumRatingMaxValueIsNotPositive_ShouldHaveValidationError(decimal maxValue) { // Arrange @@ -1492,8 +1492,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData("")] // empty path - [InlineData(" ")] // whitespace path, which the not empty rule rejects + [InlineData("")] // Empty path. + [InlineData(" ")] // Whitespace path, which the not empty rule rejects. public void Validate_WhenTrackPathIsEmpty_ShouldHaveValidationError(string path) { // Arrange @@ -1963,8 +1963,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid track number - [InlineData(-1)] // a negative track number is not valid + [InlineData(0)] // Zero is not a valid track number. + [InlineData(-1)] // A negative track number is not valid. public void Validate_WhenTrackNumberIsNotPositive_ShouldHaveValidationError(int trackNumber) { // Arrange @@ -1978,8 +1978,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid disc number - [InlineData(-1)] // a negative disc number is not valid + [InlineData(0)] // Zero is not a valid disc number. + [InlineData(-1)] // A negative disc number is not valid. public void Validate_WhenDiscNumberIsNotPositive_ShouldHaveValidationError(int discNumber) { // Arrange @@ -2019,8 +2019,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid tempo - [InlineData(-1)] // a negative tempo is not valid + [InlineData(0)] // Zero is not a valid tempo. + [InlineData(-1)] // A negative tempo is not valid. public void Validate_WhenTrackBpmIsNotPositive_ShouldHaveValidationError(int bpm) { // Arrange @@ -2125,8 +2125,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid rating value - [InlineData(-1)] // a negative rating value is not valid + [InlineData(0)] // Zero is not a valid rating value. + [InlineData(-1)] // A negative rating value is not valid. public void Validate_WhenTrackRatingValueIsNotPositive_ShouldHaveValidationError(decimal value) { // Arrange @@ -2153,8 +2153,8 @@ public class UpdateArtistCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid maximum rating value - [InlineData(-1)] // a negative maximum rating value is not valid + [InlineData(0)] // Zero is not a valid maximum rating value. + [InlineData(-1)] // A negative maximum rating value is not valid. public void Validate_WhenTrackRatingMaxValueIsNotPositive_ShouldHaveValidationError(decimal maxValue) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandlerTests.cs index d84221a0..3d44298f 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandlerTests.cs @@ -323,9 +323,9 @@ public class UpdateArtistCoverCommandHandlerTests } [Theory] - [InlineData(null)] // no file name at all - [InlineData("")] // empty file name - [InlineData(" ")] // whitespace file name + [InlineData(null)] // No file name at all. + [InlineData("")] // Empty file name. + [InlineData(" ")] // Whitespace file name. public async Task HandleAsync_WhenExistingCoverPathIsEmpty_ShouldNotDeletePreviousArtwork(string? existingCoverPath) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryValidatorTests.cs index edd39458..f0f48552 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryValidatorTests.cs @@ -21,11 +21,11 @@ public class GetArtistQueryValidatorTests private readonly GetArtistQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class GetArtistQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistAlbums/GetArtistAlbumsQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistAlbums/GetArtistAlbumsQueryValidatorTests.cs index 2f7316d5..0519c9e4 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistAlbums/GetArtistAlbumsQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistAlbums/GetArtistAlbumsQueryValidatorTests.cs @@ -21,11 +21,11 @@ public class GetArtistAlbumsQueryValidatorTests private readonly GetArtistAlbumsQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class GetArtistAlbumsQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistAlbumsLite/GetArtistAlbumsLiteQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistAlbumsLite/GetArtistAlbumsLiteQueryValidatorTests.cs index 7b52c0d9..6d3889ec 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistAlbumsLite/GetArtistAlbumsLiteQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistAlbumsLite/GetArtistAlbumsLiteQueryValidatorTests.cs @@ -21,11 +21,11 @@ public class GetArtistAlbumsLiteQueryValidatorTests private readonly GetArtistAlbumsLiteQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class GetArtistAlbumsLiteQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtists/GetArtistsQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtists/GetArtistsQueryValidatorTests.cs index a9f6b450..2657bdf1 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtists/GetArtistsQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtists/GetArtistsQueryValidatorTests.cs @@ -21,11 +21,11 @@ public class GetArtistsQueryValidatorTests private readonly GetArtistsQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidatorTests.cs index 3fd9bc1c..a7be45c5 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidatorTests.cs @@ -22,11 +22,11 @@ public class GetArtistsLiteQueryValidatorTests private readonly GetArtistsLiteQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -66,8 +66,8 @@ public class GetArtistsLiteQueryValidatorTests } [Theory] - [InlineData("AB")] // more than one character - [InlineData("1")] // a digit, which is not a letter, the number bucket, or the symbol bucket + [InlineData("AB")] // More than one character. + [InlineData("1")] // A digit, which is not a letter, the number bucket, or the symbol bucket. public void Validate_WhenFilterAlphaKeyIsNotASingleLetterOrSpecialKey_ShouldHaveValidationError(string filterAlphaKey) { // Arrange @@ -81,10 +81,10 @@ public class GetArtistsLiteQueryValidatorTests } [Theory] - [InlineData("Q")] // a single letter - [InlineData("q")] // a single lower case letter - [InlineData("#")] // the number bucket - [InlineData("*")] // the symbol bucket + [InlineData("Q")] // A single letter. + [InlineData("q")] // A single lower case letter. + [InlineData("#")] // The number bucket. + [InlineData("*")] // The symbol bucket. public void Validate_WhenFilterAlphaKeyIsASingleLetterOrSpecialKey_ShouldNotHaveValidationError(string filterAlphaKey) { // Arrange @@ -111,8 +111,8 @@ public class GetArtistsLiteQueryValidatorTests } [Theory] - [InlineData(LibraryItemAlphaKeys.NUMBER)] // the number bucket constant - [InlineData(LibraryItemAlphaKeys.SYMBOL)] // the symbol bucket constant + [InlineData(LibraryItemAlphaKeys.NUMBER)] // The number bucket constant. + [InlineData(LibraryItemAlphaKeys.SYMBOL)] // The symbol bucket constant. public void Validate_WhenFilterAlphaKeyIsTheSpecialConstant_ShouldNotHaveValidationError(string filterAlphaKey) { // Arrange @@ -126,58 +126,58 @@ public class GetArtistsLiteQueryValidatorTests } [Theory] - [InlineData("A")] // upper case A - [InlineData("B")] // upper case B - [InlineData("C")] // upper case C - [InlineData("D")] // upper case D - [InlineData("E")] // upper case E - [InlineData("F")] // upper case F - [InlineData("G")] // upper case G - [InlineData("H")] // upper case H - [InlineData("I")] // upper case I - [InlineData("J")] // upper case J - [InlineData("K")] // upper case K - [InlineData("L")] // upper case L - [InlineData("M")] // upper case M - [InlineData("N")] // upper case N - [InlineData("O")] // upper case O - [InlineData("P")] // upper case P - [InlineData("Q")] // upper case Q - [InlineData("R")] // upper case R - [InlineData("S")] // upper case S - [InlineData("T")] // upper case T - [InlineData("U")] // upper case U - [InlineData("V")] // upper case V - [InlineData("W")] // upper case W - [InlineData("X")] // upper case X - [InlineData("Y")] // upper case Y - [InlineData("Z")] // upper case Z - [InlineData("a")] // lower case a - [InlineData("b")] // lower case b - [InlineData("c")] // lower case c - [InlineData("d")] // lower case d - [InlineData("e")] // lower case e - [InlineData("f")] // lower case f - [InlineData("g")] // lower case g - [InlineData("h")] // lower case h - [InlineData("i")] // lower case i - [InlineData("j")] // lower case j - [InlineData("k")] // lower case k - [InlineData("l")] // lower case l - [InlineData("m")] // lower case m - [InlineData("n")] // lower case n - [InlineData("o")] // lower case o - [InlineData("p")] // lower case p - [InlineData("q")] // lower case q - [InlineData("r")] // lower case r - [InlineData("s")] // lower case s - [InlineData("t")] // lower case t - [InlineData("u")] // lower case u - [InlineData("v")] // lower case v - [InlineData("w")] // lower case w - [InlineData("x")] // lower case x - [InlineData("y")] // lower case y - [InlineData("z")] // lower case z + [InlineData("A")] // Upper case A. + [InlineData("B")] // Upper case B. + [InlineData("C")] // Upper case C. + [InlineData("D")] // Upper case D. + [InlineData("E")] // Upper case E. + [InlineData("F")] // Upper case F. + [InlineData("G")] // Upper case G. + [InlineData("H")] // Upper case H. + [InlineData("I")] // Upper case I. + [InlineData("J")] // Upper case J. + [InlineData("K")] // Upper case K. + [InlineData("L")] // Upper case L. + [InlineData("M")] // Upper case M. + [InlineData("N")] // Upper case N. + [InlineData("O")] // Upper case O. + [InlineData("P")] // Upper case P. + [InlineData("Q")] // Upper case Q. + [InlineData("R")] // Upper case R. + [InlineData("S")] // Upper case S. + [InlineData("T")] // Upper case T. + [InlineData("U")] // Upper case U. + [InlineData("V")] // Upper case V. + [InlineData("W")] // Upper case W. + [InlineData("X")] // Upper case X. + [InlineData("Y")] // Upper case Y. + [InlineData("Z")] // Upper case Z. + [InlineData("a")] // Lower case a. + [InlineData("b")] // Lower case b. + [InlineData("c")] // Lower case c. + [InlineData("d")] // Lower case d. + [InlineData("e")] // Lower case e. + [InlineData("f")] // Lower case f. + [InlineData("g")] // Lower case g. + [InlineData("h")] // Lower case h. + [InlineData("i")] // Lower case i. + [InlineData("j")] // Lower case j. + [InlineData("k")] // Lower case k. + [InlineData("l")] // Lower case l. + [InlineData("m")] // Lower case m. + [InlineData("n")] // Lower case n. + [InlineData("o")] // Lower case o. + [InlineData("p")] // Lower case p. + [InlineData("q")] // Lower case q. + [InlineData("r")] // Lower case r. + [InlineData("s")] // Lower case s. + [InlineData("t")] // Lower case t. + [InlineData("u")] // Lower case u. + [InlineData("v")] // Lower case v. + [InlineData("w")] // Lower case w. + [InlineData("x")] // Lower case x. + [InlineData("y")] // Lower case y. + [InlineData("z")] // Lower case z. public void Validate_WhenFilterAlphaKeyIsAnySingleAsciiLetter_ShouldNotHaveValidationError(string filterAlphaKey) { // Arrange @@ -191,19 +191,19 @@ public class GetArtistsLiteQueryValidatorTests } [Theory] - [InlineData("")] // empty string, which is not a single letter or a special key - [InlineData("AB")] // two letters - [InlineData("ABC")] // several letters - [InlineData("1")] // a digit, which is not a letter, a number bucket or a symbol bucket - [InlineData("9")] // another digit - [InlineData("_")] // an underscore, which is not an ASCII letter - [InlineData("é")] // a non-ASCII letter - [InlineData("#!")] // the number bucket followed by another character - [InlineData("**")] // two symbol buckets, which is not the exact symbol constant - [InlineData("#A")] // the number bucket followed by a letter - [InlineData("*A")] // the symbol bucket followed by a letter - [InlineData(" A")] // a leading space followed by a letter - [InlineData("A ")] // a letter followed by a trailing space + [InlineData("")] // Empty string, which is not a single letter or a special key. + [InlineData("AB")] // Two letters. + [InlineData("ABC")] // Several letters. + [InlineData("1")] // A digit, which is not a letter, a number bucket or a symbol bucket. + [InlineData("9")] // Another digit. + [InlineData("_")] // An underscore, which is not an ASCII letter. + [InlineData("é")] // A non-ASCII letter. + [InlineData("#!")] // The number bucket followed by another character. + [InlineData("**")] // Two symbol buckets, which is not the exact symbol constant. + [InlineData("#A")] // The number bucket followed by a letter. + [InlineData("*A")] // The symbol bucket followed by a letter. + [InlineData(" A")] // A leading space followed by a letter. + [InlineData("A ")] // A letter followed by a trailing space. public void Validate_WhenFilterAlphaKeyIsNotAValidAlphaKey_ShouldHaveValidationError(string filterAlphaKey) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetDeletedArtists/GetDeletedArtistsQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetDeletedArtists/GetDeletedArtistsQueryValidatorTests.cs index b050c8aa..de3f0416 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetDeletedArtists/GetDeletedArtistsQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetDeletedArtists/GetDeletedArtistsQueryValidatorTests.cs @@ -21,11 +21,11 @@ public class GetDeletedArtistsQueryValidatorTests private readonly GetDeletedArtistsQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackCapabilitiesParserTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackCapabilitiesParserTests.cs index 7b46ce58..9cffe579 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackCapabilitiesParserTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackCapabilitiesParserTests.cs @@ -17,12 +17,12 @@ public class PlaybackCapabilitiesParserTests private readonly PlaybackCapabilityDtoFixture _playbackCapabilityDtoFixture = new(); [Theory] - [InlineData(null)] // an absent input falls back to the default capabilities - [InlineData("")] // an empty input falls back to the default capabilities - [InlineData(" ")] // a blank input falls back to the default capabilities - [InlineData("not-a-pair")] // an input that does not name both a container and a codec falls back to the default capabilities - [InlineData("a/b/c")] // an input with more than two segments falls back to the default capabilities - [InlineData("a//b")] // an input whose container or codec is empty falls back to the default capabilities + [InlineData(null)] // An absent input falls back to the default capabilities. + [InlineData("")] // An empty input falls back to the default capabilities. + [InlineData(" ")] // A blank input falls back to the default capabilities. + [InlineData("not-a-pair")] // An input that does not name both a container and a codec falls back to the default capabilities. + [InlineData("a/b/c")] // An input with more than two segments falls back to the default capabilities. + [InlineData("a//b")] // An input whose container or codec is empty falls back to the default capabilities. public void Parse_WhenInputIsNotAValidCapabilitySet_ShouldReturnDefaultCapabilities(string? input) { // Act diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackDeliveryIdTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackDeliveryIdTests.cs index ad8a36a9..71f8ab4a 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackDeliveryIdTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackDeliveryIdTests.cs @@ -49,16 +49,16 @@ public class PlaybackDeliveryIdTests } [Theory] - [InlineData(null)] // an absent handle cannot address a delivery - [InlineData("")] // an empty handle has the wrong length - [InlineData(" ")] // a whitespace handle has the wrong length - [InlineData(" ")] // a handle made only of whitespace has the right length but is not hexadecimal - [InlineData("0123456789abcdef0123456789abcde")] // 31 characters, one short of a handle - [InlineData("0123456789abcdef0123456789abcdef0")] // 33 characters, one over a handle - [InlineData("0123456789ABCDEF0123456789ABCDEF")] // uppercase hexadecimal is not the canonical lowercase form - [InlineData("01234567-89ab-cdef-0123-456789abcdef")] // the D format of a Guid carries dashes - [InlineData("0123456789abcdef0123456789abcdeg")] // the last character is not a hexadecimal digit - [InlineData("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz")] // no character is a hexadecimal digit + [InlineData(null)] // An absent handle cannot address a delivery. + [InlineData("")] // An empty handle has the wrong length. + [InlineData(" ")] // A whitespace handle has the wrong length. + [InlineData(" ")] // A handle made only of whitespace has the right length but is not hexadecimal. + [InlineData("0123456789abcdef0123456789abcde")] // 31 characters, one short of a handle. + [InlineData("0123456789abcdef0123456789abcdef0")] // 33 characters, one over a handle. + [InlineData("0123456789ABCDEF0123456789ABCDEF")] // Uppercase hexadecimal is not the canonical lowercase form. + [InlineData("01234567-89ab-cdef-0123-456789abcdef")] // The D format of a Guid carries dashes. + [InlineData("0123456789abcdef0123456789abcdeg")] // The last character is not a hexadecimal digit. + [InlineData("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz")] // No character is a hexadecimal digit. public void IsValid_WhenValueIsNotACanonicalHandle_ShouldReturnFalse(string? value) { // Act diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/AddTrack/AddTrackCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/AddTrack/AddTrackCommandValidatorTests.cs index a2ac02de..3e3227d1 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/AddTrack/AddTrackCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/AddTrack/AddTrackCommandValidatorTests.cs @@ -1009,8 +1009,8 @@ public class AddTrackCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid track number - [InlineData(-1)] // a negative track number is not valid + [InlineData(0)] // Zero is not a valid track number. + [InlineData(-1)] // A negative track number is not valid. public void Validate_WhenTrackNumberIsNotPositive_ShouldHaveValidationError(int trackNumber) { // Arrange @@ -1037,8 +1037,8 @@ public class AddTrackCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid disc number - [InlineData(-1)] // a negative disc number is not valid + [InlineData(0)] // Zero is not a valid disc number. + [InlineData(-1)] // A negative disc number is not valid. public void Validate_WhenDiscNumberIsNotPositive_ShouldHaveValidationError(int discNumber) { // Arrange @@ -1156,8 +1156,8 @@ public class AddTrackCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid tempo - [InlineData(-1)] // a negative tempo is not valid + [InlineData(0)] // Zero is not a valid tempo. + [InlineData(-1)] // A negative tempo is not valid. public void Validate_WhenBpmIsNotPositive_ShouldHaveValidationError(int bpm) { // Arrange @@ -1355,8 +1355,8 @@ public class AddTrackCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid rating value - [InlineData(-1)] // a negative rating value is not valid + [InlineData(0)] // Zero is not a valid rating value. + [InlineData(-1)] // A negative rating value is not valid. public void Validate_WhenRatingValueIsNotPositive_ShouldHaveValidationError(decimal value) { // Arrange @@ -1383,8 +1383,8 @@ public class AddTrackCommandValidatorTests } [Theory] - [InlineData(0)] // zero is not a valid maximum rating value - [InlineData(-1)] // a negative maximum rating value is not valid + [InlineData(0)] // Zero is not a valid maximum rating value. + [InlineData(-1)] // A negative maximum rating value is not valid. public void Validate_WhenRatingMaxValueIsNotPositive_ShouldHaveValidationError(decimal maxValue) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandValidatorTests.cs index 722277b4..0ad9d0ae 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandValidatorTests.cs @@ -33,11 +33,11 @@ public class DeleteTrackCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -51,11 +51,11 @@ public class DeleteTrackCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange @@ -69,11 +69,11 @@ public class DeleteTrackCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveValidationError(string? albumId) { // Arrange @@ -87,11 +87,11 @@ public class DeleteTrackCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-track-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-track-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenTrackIdIsEmptyOrInvalid_ShouldHaveValidationError(string? trackId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/RestoreTrack/RestoreTrackCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/RestoreTrack/RestoreTrackCommandValidatorTests.cs index bf4da2e5..122a6253 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/RestoreTrack/RestoreTrackCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/RestoreTrack/RestoreTrackCommandValidatorTests.cs @@ -21,11 +21,11 @@ public class RestoreTrackCommandValidatorTests private readonly RestoreTrackCommandValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class RestoreTrackCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange @@ -57,11 +57,11 @@ public class RestoreTrackCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveValidationError(string? albumId) { // Arrange @@ -75,11 +75,11 @@ public class RestoreTrackCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-track-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-track-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenTrackIdIsEmptyOrInvalid_ShouldHaveValidationError(string? trackId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetDeletedTracks/GetDeletedTracksQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetDeletedTracks/GetDeletedTracksQueryValidatorTests.cs index 94fdc207..7c249a8a 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetDeletedTracks/GetDeletedTracksQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetDeletedTracks/GetDeletedTracksQueryValidatorTests.cs @@ -21,11 +21,11 @@ public class GetDeletedTracksQueryValidatorTests private readonly GetDeletedTracksQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetPlaybackManifest/GetPlaybackManifestQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetPlaybackManifest/GetPlaybackManifestQueryValidatorTests.cs index 7b11fd93..9f7a6446 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetPlaybackManifest/GetPlaybackManifestQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetPlaybackManifest/GetPlaybackManifestQueryValidatorTests.cs @@ -34,11 +34,11 @@ public class GetPlaybackManifestQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveLibraryIdError(string? libraryId) { // Arrange @@ -52,11 +52,11 @@ public class GetPlaybackManifestQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveArtistIdError(string? artistId) { // Arrange @@ -70,11 +70,11 @@ public class GetPlaybackManifestQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveAlbumIdError(string? albumId) { // Arrange @@ -88,11 +88,11 @@ public class GetPlaybackManifestQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-a-track-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-a-track-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenTrackIdIsEmptyOrInvalid_ShouldHaveTrackIdError(string? trackId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrack/GetTrackQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrack/GetTrackQueryValidatorTests.cs index 9d064313..b03e5b71 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrack/GetTrackQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrack/GetTrackQueryValidatorTests.cs @@ -36,11 +36,11 @@ public class GetTrackQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -54,11 +54,11 @@ public class GetTrackQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveValidationError(string? artistId) { // Arrange @@ -72,11 +72,11 @@ public class GetTrackQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveValidationError(string? albumId) { // Arrange @@ -90,11 +90,11 @@ public class GetTrackQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-track-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-track-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenTrackIdIsEmptyOrInvalid_ShouldHaveValidationError(string? trackId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackSegment/GetTrackSegmentQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackSegment/GetTrackSegmentQueryHandlerTests.cs index 916fa44d..41cd12e0 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackSegment/GetTrackSegmentQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackSegment/GetTrackSegmentQueryHandlerTests.cs @@ -191,8 +191,8 @@ public class GetTrackSegmentQueryHandlerTests public static TheoryData NonSegmentDeliveryCases => new() { - { PlaybackDeliveryShape.ByteRangeSeekable, 6 }, // a byte range delivery has no indexable segment - { PlaybackDeliveryShape.TimeAddressedSegments, 0 } // a time addressed delivery without a positive segment duration has nothing to index + { PlaybackDeliveryShape.ByteRangeSeekable, 6 }, // A byte range delivery has no indexable segment. + { PlaybackDeliveryShape.TimeAddressedSegments, 0 } // A time addressed delivery without a positive segment duration has nothing to index. }; [Theory] diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackSegment/GetTrackSegmentQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackSegment/GetTrackSegmentQueryValidatorTests.cs index 5479bd90..85973c4e 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackSegment/GetTrackSegmentQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackSegment/GetTrackSegmentQueryValidatorTests.cs @@ -36,11 +36,11 @@ public class GetTrackSegmentQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveLibraryIdError(string? libraryId) { // Arrange @@ -54,11 +54,11 @@ public class GetTrackSegmentQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveArtistIdError(string? artistId) { // Arrange @@ -72,11 +72,11 @@ public class GetTrackSegmentQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveAlbumIdError(string? albumId) { // Arrange @@ -90,11 +90,11 @@ public class GetTrackSegmentQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-a-track-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-a-track-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenTrackIdIsEmptyOrInvalid_ShouldHaveTrackIdError(string? trackId) { // Arrange @@ -108,9 +108,9 @@ public class GetTrackSegmentQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. public void Validate_WhenDeliveryIdIsEmpty_ShouldHaveDeliveryIdCannotBeEmptyError(string? deliveryId) { // Arrange @@ -124,11 +124,11 @@ public class GetTrackSegmentQueryValidatorTests } [Theory] - [InlineData("0123456789ABCDEF0123456789ABCDEF")] // uppercase hexadecimal is not the canonical lowercase handle - [InlineData("01234567-89ab-cdef-0123-456789abcdef")] // the D format of a Guid carries dashes - [InlineData("0123456789abcdef0123456789abcde")] // 31 characters, one short of a handle - [InlineData("0123456789abcdef0123456789abcdef0")] // 33 characters, one over a handle - [InlineData("0123456789abcdef0123456789abcdeg")] // the last character is not a hexadecimal digit + [InlineData("0123456789ABCDEF0123456789ABCDEF")] // Uppercase hexadecimal is not the canonical lowercase handle. + [InlineData("01234567-89ab-cdef-0123-456789abcdef")] // The D format of a Guid carries dashes. + [InlineData("0123456789abcdef0123456789abcde")] // 31 characters, one short of a handle. + [InlineData("0123456789abcdef0123456789abcdef0")] // 33 characters, one over a handle. + [InlineData("0123456789abcdef0123456789abcdeg")] // The last character is not a hexadecimal digit. public void Validate_WhenDeliveryIdShapeIsInvalid_ShouldHaveDeliveryIdIsInvalidError(string deliveryId) { // Arrange @@ -142,9 +142,9 @@ public class GetTrackSegmentQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. public void Validate_WhenSegmentIndexIsEmpty_ShouldHaveSegmentIndexCannotBeEmptyError(string? segmentIndex) { // Arrange @@ -158,10 +158,10 @@ public class GetTrackSegmentQueryValidatorTests } [Theory] - [InlineData("-1")] // a negative index does not address a segment - [InlineData("abc")] // a non-numeric index does not address a segment - [InlineData("1.5")] // a fractional index does not address a segment - [InlineData("2147483648")] // a value above the range of an integer + [InlineData("-1")] // A negative index does not address a segment. + [InlineData("abc")] // A non-numeric index does not address a segment. + [InlineData("1.5")] // A fractional index does not address a segment. + [InlineData("2147483648")] // A value above the range of an integer. public void Validate_WhenSegmentIndexIsNotANonNegativeInteger_ShouldHaveSegmentIndexMustBeValidError(string segmentIndex) { // Arrange @@ -175,8 +175,8 @@ public class GetTrackSegmentQueryValidatorTests } [Theory] - [InlineData("0")] // the first segment of the audio - [InlineData("2147483647")] // the largest index an integer can address + [InlineData("0")] // The first segment of the audio. + [InlineData("2147483647")] // The largest index an integer can address. public void Validate_WhenSegmentIndexIsANonNegativeInteger_ShouldNotHaveSegmentIndexMustBeValidError(string segmentIndex) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackStream/GetTrackStreamQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackStream/GetTrackStreamQueryValidatorTests.cs index 6337b12c..57837ff7 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackStream/GetTrackStreamQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/GetTrackStream/GetTrackStreamQueryValidatorTests.cs @@ -34,11 +34,11 @@ public class GetTrackStreamQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveLibraryIdError(string? libraryId) { // Arrange @@ -52,11 +52,11 @@ public class GetTrackStreamQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-an-artist-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-an-artist-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenArtistIdIsEmptyOrInvalid_ShouldHaveArtistIdError(string? artistId) { // Arrange @@ -70,11 +70,11 @@ public class GetTrackStreamQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-an-album-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-an-album-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenAlbumIdIsEmptyOrInvalid_ShouldHaveAlbumIdError(string? albumId) { // Arrange @@ -88,11 +88,11 @@ public class GetTrackStreamQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-a-track-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-a-track-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenTrackIdIsEmptyOrInvalid_ShouldHaveTrackIdError(string? trackId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/ShuffleTracks/ShuffleTracksQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/ShuffleTracks/ShuffleTracksQueryValidatorTests.cs index fc853079..af6364ae 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/ShuffleTracks/ShuffleTracksQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Queries/ShuffleTracks/ShuffleTracksQueryValidatorTests.cs @@ -21,8 +21,8 @@ public class ShuffleTracksQueryValidatorTests private readonly ShuffleTracksQueryValidator _validator = new(); [Theory] - [InlineData(1)] // the smallest allowed selection - [InlineData(500)] // the largest allowed selection + [InlineData(1)] // The smallest allowed selection. + [InlineData(500)] // The largest allowed selection. public void Validate_WhenQueryIsValid_ShouldNotHaveValidationError(int count) { // Arrange @@ -43,12 +43,12 @@ public class ShuffleTracksQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value - [InlineData("not-a-guid")] // non-Guid route value - [InlineData("' OR '1'='1")] // injection payload that is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value. + [InlineData("not-a-guid")] // Non-Guid route value. + [InlineData("' OR '1'='1")] // Injection payload that is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -62,9 +62,9 @@ public class ShuffleTracksQueryValidatorTests } [Theory] - [InlineData(0)] // no track is requested - [InlineData(-1)] // a negative selection size - [InlineData(-500)] // a large negative selection size + [InlineData(0)] // No track is requested. + [InlineData(-1)] // A negative selection size. + [InlineData(-500)] // A large negative selection size. public void Validate_WhenCountIsNotPositive_ShouldHaveValidationError(int count) { // Arrange @@ -79,9 +79,9 @@ public class ShuffleTracksQueryValidatorTests } [Theory] - [InlineData(501)] // one more than the documented maximum - [InlineData(1000)] // well above the documented maximum - [InlineData(int.MaxValue)] // the largest possible value + [InlineData(501)] // One more than the documented maximum. + [InlineData(1000)] // Well above the documented maximum. + [InlineData(int.MaxValue)] // The largest possible value. public void Validate_WhenCountExceedsMaximum_ShouldHaveValidationError(int count) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandValidatorTests.cs index d471c6e4..01104a89 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandValidatorTests.cs @@ -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 result = _validator.TestValidate(command); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/ScanLibraries/ScanLibrariesCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/ScanLibraries/ScanLibrariesCommandHandlerTests.cs index 026ac2fd..650dcb43 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/ScanLibraries/ScanLibrariesCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/ScanLibraries/ScanLibrariesCommandHandlerTests.cs @@ -58,7 +58,7 @@ public class ScanLibrariesCommandHandlerTests _mockDomainEventsQueue = Substitute.For(); _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()).Returns(true); _mockLibraryScanRepository.GetPastMonthScansByLibraryIdAsync(Arg.Any(), Arg.Any()) diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/ScanLibrary/ScanLibraryCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/ScanLibrary/ScanLibraryCommandHandlerTests.cs index 8398d34b..26e42c1c 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/ScanLibrary/ScanLibraryCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/ScanLibrary/ScanLibraryCommandHandlerTests.cs @@ -63,7 +63,7 @@ public class ScanLibraryCommandHandlerTests _mockValidator = Substitute.For>(); _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(_userId, Arg.Any(), Arg.Any()) .Returns(true); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandValidatorTests.cs index 0a574acf..cf524821 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandValidatorTests.cs @@ -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 result = _validator.TestValidate(command); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Deletion/BooksMediaLibraryItemDeletionStrategyTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Deletion/BooksMediaLibraryItemDeletionStrategyTests.cs index c054f80b..f57a3dd1 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Deletion/BooksMediaLibraryItemDeletionStrategyTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Deletion/BooksMediaLibraryItemDeletionStrategyTests.cs @@ -125,7 +125,7 @@ public class BooksMediaLibraryItemDeletionStrategyTests Result 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()); await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any()); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandlerTests.cs index d58fcdfa..577e5553 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandlerTests.cs @@ -76,7 +76,7 @@ public class LibraryDeletedDomainEventHandlerTests IOptions mediaSettingsOptions = Substitute.For>(); 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(), Arg.Any()) .Returns(callInfo => Result.From(string.Concat(callInfo.ArgAt(0), callInfo.ArgAt(1)))); _mockPathService.SanitizeCompositeSegment(Arg.Any(), Arg.Any()) diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibrarySavedDomainEventHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibrarySavedDomainEventHandlerTests.cs index 2a8d4282..360dc7d1 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibrarySavedDomainEventHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibrarySavedDomainEventHandlerTests.cs @@ -74,7 +74,7 @@ public class LibrarySavedDomainEventHandlerTests IOptions mediaSettingsOptions = Substitute.For>(); 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(), Arg.Any()) .Returns(callInfo => Result.From(string.Concat(callInfo.ArgAt(0), callInfo.ArgAt(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(), Arg.Any()) .Returns(callInfo => Result.From(string.Concat(callInfo.ArgAt(0), callInfo.ArgAt(1)) + '/')); string internalImagePath = $"{AppContext.BaseDirectory.TrimEnd('/')}/Media/Libraries/guid/cover.png"; diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryScanFailedDomainEventHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryScanFailedDomainEventHandlerTests.cs index 78a2461e..2855bb50 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryScanFailedDomainEventHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryScanFailedDomainEventHandlerTests.cs @@ -59,7 +59,7 @@ public class LibraryScanFailedDomainEventHandlerTests _mockMediaLibrariesScanCancellationTracker = Substitute.For(); _mockDebouncedLibraryScanProgressNotifier = Substitute.For(); - // 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(), Arg.Any()) .Returns(Result.Updated); _mockLibraryScanSnapshotRepository.RollbackSnapshotForScanAsync(Arg.Any(), Arg.Any(), Arg.Any()) diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryScanFinishedDomainEventHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryScanFinishedDomainEventHandlerTests.cs index 317bac60..a1d9592e 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryScanFinishedDomainEventHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryScanFinishedDomainEventHandlerTests.cs @@ -53,7 +53,7 @@ public class LibraryScanFinishedDomainEventHandlerTests _mockMediaLibrariesScanCancellationTracker = Substitute.For(); _mockDebouncedLibraryScanProgressNotifier = Substitute.For(); - // default stubs: the library scan update succeeds + // Default stubs: the library scan update succeeds. _mockLibraryScanRepository.UpdateAsync(Arg.Any(), Arg.Any()) .Returns(Result.Updated); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetEnabledLibraries/GetEnabledLibrariesQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetEnabledLibraries/GetEnabledLibrariesQueryHandlerTests.cs index 4106c121..43959de3 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetEnabledLibraries/GetEnabledLibrariesQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetEnabledLibraries/GetEnabledLibrariesQueryHandlerTests.cs @@ -48,7 +48,7 @@ public class GetEnabledLibrariesQueryHandlerTests _mockCurrentUserService = Substitute.For(); _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()).Returns(true); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibraries/GetLibrariesQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibraries/GetLibrariesQueryHandlerTests.cs index 6f07c006..1abf0bcf 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibraries/GetLibrariesQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibraries/GetLibrariesQueryHandlerTests.cs @@ -52,7 +52,7 @@ public class GetLibrariesQueryHandlerTests _mockCurrentUserService = Substitute.For(); _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()).Returns(true); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryHandlerTests.cs index e0036c14..e9cc74bb 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibrary/GetLibraryQueryHandlerTests.cs @@ -54,7 +54,7 @@ public class GetLibraryQueryHandlerTests _mockValidator = Substitute.For>(); _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(_userId, Arg.Any(), Arg.Any()) .Returns(true); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibraryScanProgress/GetLibraryScanProgressQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibraryScanProgress/GetLibraryScanProgressQueryHandlerTests.cs index 986e8dde..2b3792cb 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibraryScanProgress/GetLibraryScanProgressQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Queries/GetLibraryScanProgress/GetLibraryScanProgressQueryHandlerTests.cs @@ -62,7 +62,7 @@ public class GetLibraryScanProgressQueryHandlerTests _mockValidator = Substitute.For>(); _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(_userId, Arg.Any(), Arg.Any()) .Returns(true); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/DeleteBook/DeleteBookCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/DeleteBook/DeleteBookCommandValidatorTests.cs index 6defc36d..5a77a29d 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/DeleteBook/DeleteBookCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/DeleteBook/DeleteBookCommandValidatorTests.cs @@ -21,11 +21,11 @@ public class DeleteBookCommandValidatorTests private readonly DeleteBookCommandValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class DeleteBookCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-book-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-book-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenBookIdIsEmptyOrInvalid_ShouldHaveValidationError(string? bookId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/RestoreBook/RestoreBookCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/RestoreBook/RestoreBookCommandValidatorTests.cs index fae33925..3e36319e 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/RestoreBook/RestoreBookCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Commands/RestoreBook/RestoreBookCommandValidatorTests.cs @@ -21,11 +21,11 @@ public class RestoreBookCommandValidatorTests private readonly RestoreBookCommandValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -39,11 +39,11 @@ public class RestoreBookCommandValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-book-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-book-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenBookIdIsEmptyOrInvalid_ShouldHaveValidationError(string? bookId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBook/GetBookQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBook/GetBookQueryValidatorTests.cs index d757aa21..098ec736 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBook/GetBookQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBook/GetBookQueryValidatorTests.cs @@ -34,10 +34,10 @@ public class GetBookQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -51,10 +51,10 @@ public class GetBookQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData("not-a-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData("not-a-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenBookIdIsEmptyOrInvalid_ShouldHaveValidationError(string? bookId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooks/GetBooksQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooks/GetBooksQueryHandlerTests.cs index ebf73404..020c9e29 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooks/GetBooksQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooks/GetBooksQueryHandlerTests.cs @@ -59,7 +59,7 @@ public class GetBooksQueryHandlerTests _mockValidator = Substitute.For>(); _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(_userId, Arg.Any(), Arg.Any()) .Returns(true); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooksLite/GetBooksLiteQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooksLite/GetBooksLiteQueryHandlerTests.cs index f179f30b..78628ec1 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooksLite/GetBooksLiteQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetBooksLite/GetBooksLiteQueryHandlerTests.cs @@ -59,7 +59,7 @@ public class GetBooksLiteQueryHandlerTests _mockValidator = Substitute.For>(); _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(_userId, Arg.Any(), Arg.Any()) .Returns(true); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetDeletedBooks/GetDeletedBooksQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetDeletedBooks/GetDeletedBooksQueryValidatorTests.cs index de83df09..3607a188 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetDeletedBooks/GetDeletedBooksQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Queries/GetDeletedBooks/GetDeletedBooksQueryValidatorTests.cs @@ -21,11 +21,11 @@ public class GetDeletedBooksQueryValidatorTests private readonly GetDeletedBooksQueryValidator _validator = new(); [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData(" ")] // whitespace route value, which both the not empty rule and the format rule reject - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData(" ")] // Whitespace route value, which both the not empty rule and the format rule reject. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingAvailability/GetReadingAvailabilityQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingAvailability/GetReadingAvailabilityQueryValidatorTests.cs index c272fccc..a46d987c 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingAvailability/GetReadingAvailabilityQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingAvailability/GetReadingAvailabilityQueryValidatorTests.cs @@ -34,10 +34,10 @@ public class GetReadingAvailabilityQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -51,10 +51,10 @@ public class GetReadingAvailabilityQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData("not-a-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData("not-a-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenBookIdIsEmptyOrInvalid_ShouldHaveValidationError(string? bookId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingManifest/GetReadingManifestQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingManifest/GetReadingManifestQueryValidatorTests.cs index 4434a44e..a147bf57 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingManifest/GetReadingManifestQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingManifest/GetReadingManifestQueryValidatorTests.cs @@ -34,10 +34,10 @@ public class GetReadingManifestQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -51,10 +51,10 @@ public class GetReadingManifestQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData("not-a-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData("not-a-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenBookIdIsEmptyOrInvalid_ShouldHaveValidationError(string? bookId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingResource/GetReadingResourceQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingResource/GetReadingResourceQueryHandlerTests.cs index 51f16a84..49fd5833 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingResource/GetReadingResourceQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingResource/GetReadingResourceQueryHandlerTests.cs @@ -73,7 +73,7 @@ public class GetReadingResourceQueryHandlerTests _mockValidator = Substitute.For>(); _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(_userId, Arg.Any(), Arg.Any()) .Returns(true); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingResource/GetReadingResourceQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingResource/GetReadingResourceQueryValidatorTests.cs index d2101616..541ade06 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingResource/GetReadingResourceQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingResource/GetReadingResourceQueryValidatorTests.cs @@ -35,10 +35,10 @@ public class GetReadingResourceQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -52,10 +52,10 @@ public class GetReadingResourceQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData("not-a-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData("not-a-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenBookIdIsEmptyOrInvalid_ShouldHaveValidationError(string? bookId) { // Arrange @@ -69,8 +69,8 @@ public class GetReadingResourceQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. public void Validate_WhenResourceKeyIsEmpty_ShouldHaveValidationError(string? resourceKey) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingSection/GetReadingSectionQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingSection/GetReadingSectionQueryHandlerTests.cs index 5def93e7..c14ac249 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingSection/GetReadingSectionQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingSection/GetReadingSectionQueryHandlerTests.cs @@ -73,7 +73,7 @@ public class GetReadingSectionQueryHandlerTests _mockValidator = Substitute.For>(); _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(_userId, Arg.Any(), Arg.Any()) .Returns(true); @@ -132,8 +132,8 @@ public class GetReadingSectionQueryHandlerTests } [Theory] - [InlineData(true)] // the user chose to preserve the styles of the books - [InlineData(false)] // the user chose to strip the styles of the books + [InlineData(true)] // The user chose to preserve the styles of the books. + [InlineData(false)] // The user chose to strip the styles of the books. public async Task HandleAsync_WhenUserHasPreserveBookStylesSetting_ShouldPassItToTheService(bool shouldPreserveBookStyles) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingSection/GetReadingSectionQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingSection/GetReadingSectionQueryValidatorTests.cs index d6d1f5db..38a15f83 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingSection/GetReadingSectionQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Books/Reading/Queries/GetReadingSection/GetReadingSectionQueryValidatorTests.cs @@ -35,10 +35,10 @@ public class GetReadingSectionQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData("not-a-library-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData("not-a-library-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenLibraryIdIsEmptyOrInvalid_ShouldHaveValidationError(string? libraryId) { // Arrange @@ -52,10 +52,10 @@ public class GetReadingSectionQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value - [InlineData("not-a-guid")] // non-Guid route value - [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. + [InlineData("not-a-guid")] // Non-Guid route value. + [InlineData("00000000-0000-0000-0000-000000000000")] // Empty Guid route value. public void Validate_WhenBookIdIsEmptyOrInvalid_ShouldHaveValidationError(string? bookId) { // Arrange @@ -69,8 +69,8 @@ public class GetReadingSectionQueryValidatorTests } [Theory] - [InlineData(null)] // missing route value - [InlineData("")] // empty route value + [InlineData(null)] // Missing route value. + [InlineData("")] // Empty route value. public void Validate_WhenLocationRefIsEmpty_ShouldHaveValidationError(string? locationRef) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistEntries/AddPlaylistEntriesCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistEntries/AddPlaylistEntriesCommandValidatorTests.cs index 7dbbad45..0d574494 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistEntries/AddPlaylistEntriesCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistEntries/AddPlaylistEntriesCommandValidatorTests.cs @@ -34,10 +34,10 @@ public class AddPlaylistEntriesCommandValidatorTests } [Theory] - [InlineData("")] // an empty identifier - [InlineData(" ")] // a white-space only identifier - [InlineData("not-a-guid")] // an identifier that cannot be parsed - [InlineData("00000000-0000-0000-0000-000000000000")] // the empty Guid, which is never a valid playlist + [InlineData("")] // An empty identifier. + [InlineData(" ")] // A white-space only identifier. + [InlineData("not-a-guid")] // An identifier that cannot be parsed. + [InlineData("00000000-0000-0000-0000-000000000000")] // The empty Guid, which is never a valid playlist. public void Validate_WhenPlaylistIdIsNotAValidIdentifier_ShouldHaveValidationError(string playlistId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistEntry/AddPlaylistEntryCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistEntry/AddPlaylistEntryCommandValidatorTests.cs index 5b57c57d..99aec735 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistEntry/AddPlaylistEntryCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistEntry/AddPlaylistEntryCommandValidatorTests.cs @@ -34,10 +34,10 @@ public class AddPlaylistEntryCommandValidatorTests } [Theory] - [InlineData("")] // an empty identifier - [InlineData(" ")] // a white-space only identifier - [InlineData("not-a-guid")] // an identifier that cannot be parsed - [InlineData("00000000-0000-0000-0000-000000000000")] // the empty Guid, which is never a valid playlist + [InlineData("")] // An empty identifier. + [InlineData(" ")] // A white-space only identifier. + [InlineData("not-a-guid")] // An identifier that cannot be parsed. + [InlineData("00000000-0000-0000-0000-000000000000")] // The empty Guid, which is never a valid playlist. public void Validate_WhenPlaylistIdIsNotAValidIdentifier_ShouldHaveValidationError(string playlistId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistScopeEntries/AddPlaylistScopeEntriesCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistScopeEntries/AddPlaylistScopeEntriesCommandValidatorTests.cs index 71970305..94fbdb4b 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistScopeEntries/AddPlaylistScopeEntriesCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/AddPlaylistScopeEntries/AddPlaylistScopeEntriesCommandValidatorTests.cs @@ -34,10 +34,10 @@ public class AddPlaylistScopeEntriesCommandValidatorTests } [Theory] - [InlineData("")] // an empty identifier - [InlineData(" ")] // a white-space only identifier - [InlineData("not-a-guid")] // an identifier that cannot be parsed - [InlineData("00000000-0000-0000-0000-000000000000")] // the empty Guid, which is never a valid playlist + [InlineData("")] // An empty identifier. + [InlineData(" ")] // A white-space only identifier. + [InlineData("not-a-guid")] // An identifier that cannot be parsed. + [InlineData("00000000-0000-0000-0000-000000000000")] // The empty Guid, which is never a valid playlist. public void Validate_WhenPlaylistIdIsNotAValidIdentifier_ShouldHaveValidationError(string playlistId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/DeletePlaylist/DeletePlaylistCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/DeletePlaylist/DeletePlaylistCommandValidatorTests.cs index ab612daa..8203e936 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/DeletePlaylist/DeletePlaylistCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/DeletePlaylist/DeletePlaylistCommandValidatorTests.cs @@ -33,10 +33,10 @@ public class DeletePlaylistCommandValidatorTests } [Theory] - [InlineData("")] // an empty identifier - [InlineData(" ")] // a white-space only identifier - [InlineData("not-a-guid")] // an identifier that cannot be parsed - [InlineData("00000000-0000-0000-0000-000000000000")] // the empty Guid, which is never a valid playlist + [InlineData("")] // An empty identifier. + [InlineData(" ")] // A white-space only identifier. + [InlineData("not-a-guid")] // An identifier that cannot be parsed. + [InlineData("00000000-0000-0000-0000-000000000000")] // The empty Guid, which is never a valid playlist. public void Validate_WhenPlaylistIdIsNotAValidIdentifier_ShouldHaveValidationError(string playlistId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/MovePlaylistEntry/MovePlaylistEntryCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/MovePlaylistEntry/MovePlaylistEntryCommandValidatorTests.cs index c40228ce..d51ae84e 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/MovePlaylistEntry/MovePlaylistEntryCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/MovePlaylistEntry/MovePlaylistEntryCommandValidatorTests.cs @@ -33,10 +33,10 @@ public class MovePlaylistEntryCommandValidatorTests } [Theory] - [InlineData("")] // an empty identifier - [InlineData(" ")] // a white-space only identifier - [InlineData("not-a-guid")] // an identifier that cannot be parsed - [InlineData("00000000-0000-0000-0000-000000000000")] // the empty Guid, which is never a valid playlist + [InlineData("")] // An empty identifier. + [InlineData(" ")] // A white-space only identifier. + [InlineData("not-a-guid")] // An identifier that cannot be parsed. + [InlineData("00000000-0000-0000-0000-000000000000")] // The empty Guid, which is never a valid playlist. public void Validate_WhenPlaylistIdIsNotAValidIdentifier_ShouldHaveValidationError(string playlistId) { // Arrange @@ -63,10 +63,10 @@ public class MovePlaylistEntryCommandValidatorTests } [Theory] - [InlineData("")] // an empty identifier - [InlineData(" ")] // a white-space only identifier - [InlineData("not-a-guid")] // an identifier that cannot be parsed - [InlineData("00000000-0000-0000-0000-000000000000")] // the empty Guid, which is never a valid entry + [InlineData("")] // An empty identifier. + [InlineData(" ")] // A white-space only identifier. + [InlineData("not-a-guid")] // An identifier that cannot be parsed. + [InlineData("00000000-0000-0000-0000-000000000000")] // The empty Guid, which is never a valid entry. public void Validate_WhenPlaylistEntryIdIsNotAValidIdentifier_ShouldHaveValidationError(string playlistEntryId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/RemovePlaylistEntry/RemovePlaylistEntryCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/RemovePlaylistEntry/RemovePlaylistEntryCommandValidatorTests.cs index 2a25a58f..d57ff297 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/RemovePlaylistEntry/RemovePlaylistEntryCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/RemovePlaylistEntry/RemovePlaylistEntryCommandValidatorTests.cs @@ -33,10 +33,10 @@ public class RemovePlaylistEntryCommandValidatorTests } [Theory] - [InlineData("")] // an empty identifier - [InlineData(" ")] // a white-space only identifier - [InlineData("not-a-guid")] // an identifier that cannot be parsed - [InlineData("00000000-0000-0000-0000-000000000000")] // the empty Guid, which is never a valid playlist + [InlineData("")] // An empty identifier. + [InlineData(" ")] // A white-space only identifier. + [InlineData("not-a-guid")] // An identifier that cannot be parsed. + [InlineData("00000000-0000-0000-0000-000000000000")] // The empty Guid, which is never a valid playlist. public void Validate_WhenPlaylistIdIsNotAValidIdentifier_ShouldHaveValidationError(string playlistId) { // Arrange @@ -63,10 +63,10 @@ public class RemovePlaylistEntryCommandValidatorTests } [Theory] - [InlineData("")] // an empty identifier - [InlineData(" ")] // a white-space only identifier - [InlineData("not-a-guid")] // an identifier that cannot be parsed - [InlineData("00000000-0000-0000-0000-000000000000")] // the empty Guid, which is never a valid entry + [InlineData("")] // An empty identifier. + [InlineData(" ")] // A white-space only identifier. + [InlineData("not-a-guid")] // An identifier that cannot be parsed. + [InlineData("00000000-0000-0000-0000-000000000000")] // The empty Guid, which is never a valid entry. public void Validate_WhenPlaylistEntryIdIsNotAValidIdentifier_ShouldHaveValidationError(string playlistEntryId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/UpdatePlaylist/UpdatePlaylistCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/UpdatePlaylist/UpdatePlaylistCommandValidatorTests.cs index 0def9d6b..6c1f86dd 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/UpdatePlaylist/UpdatePlaylistCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Commands/UpdatePlaylist/UpdatePlaylistCommandValidatorTests.cs @@ -35,10 +35,10 @@ public class UpdatePlaylistCommandValidatorTests } [Theory] - [InlineData("")] // an empty identifier - [InlineData(" ")] // a white-space only identifier - [InlineData("not-a-guid")] // an identifier that cannot be parsed - [InlineData("00000000-0000-0000-0000-000000000000")] // the empty Guid, which is never a valid playlist + [InlineData("")] // An empty identifier. + [InlineData(" ")] // A white-space only identifier. + [InlineData("not-a-guid")] // An identifier that cannot be parsed. + [InlineData("00000000-0000-0000-0000-000000000000")] // The empty Guid, which is never a valid playlist. public void Validate_WhenPlaylistIdIsNotAValidIdentifier_ShouldHaveValidationError(string playlistId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Queries/GetPlaylist/GetPlaylistQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Queries/GetPlaylist/GetPlaylistQueryValidatorTests.cs index 46703a4f..8672543f 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Queries/GetPlaylist/GetPlaylistQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Playlists/Queries/GetPlaylist/GetPlaylistQueryValidatorTests.cs @@ -34,10 +34,10 @@ public class GetPlaylistQueryValidatorTests } [Theory] - [InlineData("")] // the playlist Id is empty - [InlineData(" ")] // the playlist Id is whitespace only - [InlineData("not-a-guid")] // the playlist Id is not a Guid - [InlineData("00000000-0000-0000-0000-000000000000")] // the playlist Id is the empty Guid + [InlineData("")] // The playlist Id is empty. + [InlineData(" ")] // The playlist Id is whitespace only. + [InlineData("not-a-guid")] // The playlist Id is not a Guid. + [InlineData("00000000-0000-0000-0000-000000000000")] // The playlist Id is the empty Guid. public void Validate_WhenPlaylistIdIsEmptyOrInvalid_ShouldHaveValidationError(string playlistId) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Queries/GetLibraryArtworkProviders/GetLibraryArtworkProvidersQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Queries/GetLibraryArtworkProviders/GetLibraryArtworkProvidersQueryHandlerTests.cs index 01fc4170..b37cbe5c 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Queries/GetLibraryArtworkProviders/GetLibraryArtworkProvidersQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Queries/GetLibraryArtworkProviders/GetLibraryArtworkProvidersQueryHandlerTests.cs @@ -61,7 +61,7 @@ public class GetLibraryArtworkProvidersQueryHandlerTests _mockValidator = Substitute.For>(); _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(_userId, Arg.Any(), Arg.Any()) .Returns(true); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Queries/GetLibraryMetadataProviders/GetLibraryMetadataProvidersQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Queries/GetLibraryMetadataProviders/GetLibraryMetadataProvidersQueryHandlerTests.cs index 3bd9b074..7a8b9035 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Queries/GetLibraryMetadataProviders/GetLibraryMetadataProvidersQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Plugins/Queries/GetLibraryMetadataProviders/GetLibraryMetadataProvidersQueryHandlerTests.cs @@ -61,7 +61,7 @@ public class GetLibraryMetadataProvidersQueryHandlerTests _mockValidator = Substitute.For>(); _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(_userId, Arg.Any(), Arg.Any()) .Returns(true); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/AddScheduledJob/AddScheduledJobCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/AddScheduledJob/AddScheduledJobCommandValidatorTests.cs index cf088601..fe33d8c1 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/AddScheduledJob/AddScheduledJobCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/AddScheduledJob/AddScheduledJobCommandValidatorTests.cs @@ -21,9 +21,9 @@ public class AddScheduledJobCommandValidatorTests private readonly AddScheduledJobCommandFixture _addScheduledJobCommandFixture = new(); [Theory] - [InlineData(null)] // null name - [InlineData("")] // empty name - [InlineData(" ")] // whitespace name + [InlineData(null)] // Null name. + [InlineData("")] // Empty name. + [InlineData(" ")] // Whitespace name. public void Validate_WhenNameIsNullOrWhitespace_ShouldHaveValidationError(string? name) { // Arrange @@ -89,8 +89,8 @@ public class AddScheduledJobCommandValidatorTests } [Theory] - [InlineData(0)] // interval of zero - [InlineData(-1)] // negative interval + [InlineData(0)] // Interval of zero. + [InlineData(-1)] // Negative interval. public void Validate_WhenIntervalScheduleHasNonPositiveInterval_ShouldHaveValidationError(int intervalMinutes) { // Arrange @@ -132,8 +132,8 @@ public class AddScheduledJobCommandValidatorTests } [Theory] - [InlineData(-1)] // hour below the allowed range - [InlineData(24)] // hour above the allowed range + [InlineData(-1)] // Hour below the allowed range. + [InlineData(24)] // Hour above the allowed range. public void Validate_WhenDailyScheduleHasOutOfRangeHour_ShouldHaveValidationError(int hour) { // Arrange @@ -150,8 +150,8 @@ public class AddScheduledJobCommandValidatorTests } [Theory] - [InlineData(-1)] // minute below the allowed range - [InlineData(60)] // minute above the allowed range + [InlineData(-1)] // Minute below the allowed range. + [InlineData(60)] // Minute above the allowed range. public void Validate_WhenDailyScheduleHasOutOfRangeMinute_ShouldHaveValidationError(int minute) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidatorTests.cs index f81c2ec3..f7be3f43 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidatorTests.cs @@ -20,9 +20,9 @@ public class UpdateSchedulerDisplayPreferencesCommandValidatorTests private readonly UpdateSchedulerDisplayPreferencesCommandFixture _updateSchedulerDisplayPreferencesCommandFixture = new(); [Theory] - [InlineData(0)] // display time span of zero - [InlineData(-1)] // negative display time span - [InlineData(-100)] // negative display time span far from zero + [InlineData(0)] // Display time span of zero. + [InlineData(-1)] // Negative display time span. + [InlineData(-100)] // Negative display time span far from zero. public void Validate_WhenDisplayTimeSpanIsNotPositive_ShouldHaveValidationError(int displayTimeSpan) { // Arrange @@ -36,9 +36,9 @@ public class UpdateSchedulerDisplayPreferencesCommandValidatorTests } [Theory] - [InlineData(1)] // minimal positive display time span - [InlineData(10)] // default display time span - [InlineData(1440)] // a day expressed in minutes + [InlineData(1)] // Minimal positive display time span. + [InlineData(10)] // Default display time span. + [InlineData(1440)] // A day expressed in minutes. public void Validate_WhenDisplayTimeSpanIsPositive_ShouldNotHaveValidationError(int displayTimeSpan) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Events/ScheduledJobExecutionCompletedDomainEventHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Events/ScheduledJobExecutionCompletedDomainEventHandlerTests.cs index f09c034a..bde02766 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Events/ScheduledJobExecutionCompletedDomainEventHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Events/ScheduledJobExecutionCompletedDomainEventHandlerTests.cs @@ -62,8 +62,8 @@ public class ScheduledJobExecutionCompletedDomainEventHandlerTests } [Theory] - [InlineData(true, ScheduledJobStatus.Active)] // a cycle run returns the scheduled job to its active status - [InlineData(false, ScheduledJobStatus.Completed)] // a one time execution completes the scheduled job + [InlineData(true, ScheduledJobStatus.Active)] // A cycle run returns the scheduled job to its active status. + [InlineData(false, ScheduledJobStatus.Completed)] // A one time execution completes the scheduled job. public async Task HandleAsync_WhenScheduledJobAndExecutionExist_ShouldUpdateBothAndNotify(bool isCycleRun, ScheduledJobStatus expectedStatus) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/ChangePassword/ChangePasswordCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/ChangePassword/ChangePasswordCommandValidatorTests.cs index c38a7a64..87a65885 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/ChangePassword/ChangePasswordCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/ChangePassword/ChangePasswordCommandValidatorTests.cs @@ -202,12 +202,12 @@ public class ChangePasswordCommandValidatorTests } [Theory] - [InlineData("password123")] // Missing uppercase and special character - [InlineData("PASSWORD123")] // Missing special character - [InlineData("Password123")] // Missing special character - [InlineData("Password!@#")] // Missing number - [InlineData("Pass1!")] // Too short - [InlineData("password")] // Missing uppercase, number, and special character + [InlineData("password123")] // Missing uppercase and special character. + [InlineData("PASSWORD123")] // Missing special character. + [InlineData("Password123")] // Missing special character. + [InlineData("Password!@#")] // Missing number. + [InlineData("Pass1!")] // Too short. + [InlineData("password")] // Missing uppercase, number, and special character. public void Validate_WhenCurrentPasswordDoesNotMatchPattern_ShouldHaveValidationError(string password) { // Arrange @@ -222,12 +222,12 @@ public class ChangePasswordCommandValidatorTests } [Theory] - [InlineData("password123")] // Missing uppercase and special character - [InlineData("PASSWORD123")] // Missing special character - [InlineData("Password123")] // Missing special character - [InlineData("Password!@#")] // Missing number - [InlineData("Pass1!")] // Too short - [InlineData("password")] // Missing uppercase, number, and special character + [InlineData("password123")] // Missing uppercase and special character. + [InlineData("PASSWORD123")] // Missing special character. + [InlineData("Password123")] // Missing special character. + [InlineData("Password!@#")] // Missing number. + [InlineData("Pass1!")] // Too short. + [InlineData("password")] // Missing uppercase, number, and special character. public void Validate_WhenNewPasswordDoesNotMatchPattern_ShouldHaveValidationError(string password) { // Arrange @@ -242,10 +242,10 @@ public class ChangePasswordCommandValidatorTests } [Theory] - [InlineData("Password1!")] // Valid password - [InlineData("Complex1@Password")] // Valid password - [InlineData("MyP@ssw0rd")] // Valid password - [InlineData("Abcd123!@#")] // Valid password + [InlineData("Password1!")] // Valid password. + [InlineData("Complex1@Password")] // Valid password. + [InlineData("MyP@ssw0rd")] // Valid password. + [InlineData("Abcd123!@#")] // Valid password. public void Validate_WhenPasswordsMatchPattern_ShouldNotHaveValidationError(string password) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandValidatorTests.cs index 408a7781..b29014b6 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/RecoverPassword/RecoverPasswordCommandValidatorTests.cs @@ -104,12 +104,12 @@ public class RecoverPasswordCommandValidatorTests } [Theory] - [InlineData("12345")] // Too short - [InlineData("1234567")] // Too long - [InlineData("abcdef")] // Contains letters - [InlineData("12345a")] // Contains letters - [InlineData("12.345")] // Contains special characters - [InlineData("12 345")] // Contains whitespace + [InlineData("12345")] // Too short. + [InlineData("1234567")] // Too long. + [InlineData("abcdef")] // Contains letters. + [InlineData("12345a")] // Contains letters. + [InlineData("12.345")] // Contains special characters. + [InlineData("12 345")] // Contains whitespace. public void Validate_WhenTotpCodeIsInvalid_ShouldHaveValidationError(string totpCode) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/RegisterUser/RegisterUserCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/RegisterUser/RegisterUserCommandValidatorTests.cs index 659b8e55..1d177ba9 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/RegisterUser/RegisterUserCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Commands/RegisterUser/RegisterUserCommandValidatorTests.cs @@ -160,12 +160,12 @@ public class RegisterUserCommandValidatorTests } [Theory] - [InlineData("password123")] // missing uppercase and special character - [InlineData("PASSWORD123")] // missing special character - [InlineData("Password123")] // missing special character - [InlineData("Password!@#")] // missing number - [InlineData("Pass1!")] // too short - [InlineData("password")] // missing uppercase, number, and special character + [InlineData("password123")] // Missing uppercase and special character. + [InlineData("PASSWORD123")] // Missing special character. + [InlineData("Password123")] // Missing special character. + [InlineData("Password!@#")] // Missing number. + [InlineData("Pass1!")] // Too short. + [InlineData("password")] // Missing uppercase, number, and special character. public void Validate_WhenPasswordDoesNotMatchPattern_ShouldHaveValidationError(string password) { // Arrange @@ -180,10 +180,10 @@ public class RegisterUserCommandValidatorTests } [Theory] - [InlineData("Password1!")] // valid password - [InlineData("Complex1@Password")] // valid password - [InlineData("MyP@ssw0rd")] // valid password - [InlineData("Abcd123!@#")] // valid password + [InlineData("Password1!")] // Valid password. + [InlineData("Complex1@Password")] // Valid password. + [InlineData("MyP@ssw0rd")] // Valid password. + [InlineData("Abcd123!@#")] // Valid password. public void Validate_WhenPasswordMatchesPattern_ShouldNotHaveValidationError(string password) { // Arrange @@ -219,9 +219,9 @@ public class RegisterUserCommandValidatorTests } [Theory] - [InlineData("a")] // too short - [InlineData("ab")] // too short - [InlineData("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")] // too long (256 chars) + [InlineData("a")] // Too short. + [InlineData("ab")] // Too short. + [InlineData("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")] // Too long (256 chars). public void Validate_WhenUsernameHasInvalidLength_ShouldHaveValidationError(string username) { // Arrange @@ -236,16 +236,16 @@ public class RegisterUserCommandValidatorTests } [Theory] - [InlineData(".username")] // starts with special character - [InlineData("username.")] // ends with special character - [InlineData("_username")] // starts with special character - [InlineData("username_")] // ends with special character - [InlineData("-username")] // starts with special character - [InlineData("username-")] // ends with special character - [InlineData("user name")] // contains space - [InlineData("user@name")] // contains invalid special char - [InlineData("user#name")] // contains invalid special char - [InlineData("user$name")] // contains invalid special char + [InlineData(".username")] // Starts with special character. + [InlineData("username.")] // Ends with special character. + [InlineData("_username")] // Starts with special character. + [InlineData("username_")] // Ends with special character. + [InlineData("-username")] // Starts with special character. + [InlineData("username-")] // Ends with special character. + [InlineData("user name")] // Contains space. + [InlineData("user@name")] // Contains invalid special char. + [InlineData("user#name")] // Contains invalid special char. + [InlineData("user$name")] // Contains invalid special char. public void Validate_WhenUsernameHasInvalidFormat_ShouldHaveValidationError(string username) { // Arrange @@ -260,13 +260,13 @@ public class RegisterUserCommandValidatorTests } [Theory] - [InlineData("user123")] // basic alphanumeric - [InlineData("user.name")] // with dot - [InlineData("user_name")] // with underscore - [InlineData("user-name")] // with hyphen - [InlineData("User.Name123")] // mixed case with special chars and numbers - [InlineData("a1b")] // minimum length - [InlineData("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")] // maximum length (255 chars) + [InlineData("user123")] // Basic alphanumeric. + [InlineData("user.name")] // With dot. + [InlineData("user_name")] // With underscore. + [InlineData("user-name")] // With hyphen. + [InlineData("User.Name123")] // Mixed case with special chars and numbers. + [InlineData("a1b")] // Minimum length. + [InlineData("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")] // Maximum length (255 chars). public void Validate_WhenUsernameHasValidFormat_ShouldNotHaveValidationError(string username) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryHandlerTests.cs index 963570f9..49135732 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryHandlerTests.cs @@ -193,7 +193,7 @@ public class LoginUserQueryHandlerTests UserEntity user = _userEntityFixture.Create(); user.Password = Uri.EscapeDataString(hashedPassword); user.TempPassword = Uri.EscapeDataString(hashedTempPassword); - user.TempPasswordCreated = DateTime.UtcNow.AddMinutes(-16); // Expired (more than 15 minutes old) + user.TempPasswordCreated = DateTime.UtcNow.AddMinutes(-16); // Expired (more than 15 minutes old). LoginUserQuery query = _loginUserQueryFixture.Create(user.Username, password); @@ -229,18 +229,18 @@ public class LoginUserQueryHandlerTests UserEntity user = _userEntityFixture.Create(); user.Password = Uri.EscapeDataString(hashedPassword); user.TempPassword = Uri.EscapeDataString(hashedTempPassword); - // Set temp password created time to 10 minutes ago (still valid) + // Set temp password created time to 10 minutes ago (still valid). user.TempPasswordCreated = DateTime.UtcNow.AddMinutes(-10); - user.TotpSecret = null; // Ensure no TOTP validation is needed + user.TotpSecret = null; // Ensure no TOTP validation is needed. LoginUserQuery query = _loginUserQueryFixture.Create(user.Username, password); _mockUserRepository.GetByUsernameAsync(user.Username, Arg.Any()) .Returns(Result.From(user)); _mockHashService.CheckStringAgainstHash(password, hashedPassword) - .Returns(false); // Regular password check fails + .Returns(false); // Regular password check fails. _mockHashService.CheckStringAgainstHash(password, hashedTempPassword) - .Returns(true); // Temp password check succeeds + .Returns(true); // Temp password check succeeds. _mockJwtTokenGenerator.GenerateToken(user.Id.ToString(), user.Username) .Returns(jwtToken); @@ -344,16 +344,16 @@ public class LoginUserQueryHandlerTests UserEntity user = _userEntityFixture.Create(); user.Password = Uri.EscapeDataString(hashedPassword); user.TempPassword = Uri.EscapeDataString(hashedTempPassword); - user.TempPasswordCreated = DateTime.UtcNow.AddMinutes(-10); // Valid timeframe + user.TempPasswordCreated = DateTime.UtcNow.AddMinutes(-10); // Valid timeframe. LoginUserQuery query = _loginUserQueryFixture.Create(user.Username, password); _mockUserRepository.GetByUsernameAsync(user.Username, Arg.Any()) .Returns(Result.From(user)); _mockHashService.CheckStringAgainstHash(password, hashedPassword) - .Returns(false); // Regular password check fails + .Returns(false); // Regular password check fails. _mockHashService.CheckStringAgainstHash(password, hashedTempPassword) - .Returns(false); // Temp password check also fails + .Returns(false); // Temp password check also fails. // Act Result result = await _sut.HandleAsync(query, CancellationToken.None); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryValidatorTests.cs index 5597ea95..71aa2a71 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authentication/Queries/LoginUser/LoginUserQueryValidatorTests.cs @@ -104,12 +104,12 @@ public class LoginUserQueryValidatorTests } [Theory] - [InlineData("password123")] // Missing uppercase and special character - [InlineData("PASSWORD123")] // Missing special character - [InlineData("Password123")] // Missing special character - [InlineData("Password!@#")] // Missing number - [InlineData("Pass1!")] // Too short - [InlineData("password")] // Missing uppercase, number, and special character + [InlineData("password123")] // Missing uppercase and special character. + [InlineData("PASSWORD123")] // Missing special character. + [InlineData("Password123")] // Missing special character. + [InlineData("Password!@#")] // Missing number. + [InlineData("Pass1!")] // Too short. + [InlineData("password")] // Missing uppercase, number, and special character. public void Validate_WhenPasswordDoesNotMatchPattern_ShouldHaveValidationError(string password) { // Arrange @@ -124,10 +124,10 @@ public class LoginUserQueryValidatorTests } [Theory] - [InlineData("Password1!")] // Valid password - [InlineData("Complex1@Password")] // Valid password - [InlineData("MyP@ssw0rd")] // Valid password - [InlineData("Abcd123!@#")] // Valid password + [InlineData("Password1!")] // Valid password. + [InlineData("Complex1@Password")] // Valid password. + [InlineData("MyP@ssw0rd")] // Valid password. + [InlineData("Abcd123!@#")] // Valid password. public void Validate_WhenPasswordMatchesPattern_ShouldNotHaveValidationError(string password) { // Arrange @@ -142,12 +142,12 @@ public class LoginUserQueryValidatorTests } [Theory] - [InlineData("12345")] // Too short - [InlineData("1234567")] // Too long - [InlineData("abcdef")] // Contains letters - [InlineData("12345a")] // Contains letters - [InlineData("12.345")] // Contains special characters - [InlineData("12 345")] // Contains whitespace + [InlineData("12345")] // Too short. + [InlineData("1234567")] // Too long. + [InlineData("abcdef")] // Contains letters. + [InlineData("12345a")] // Contains letters. + [InlineData("12.345")] // Contains special characters. + [InlineData("12 345")] // Contains whitespace. public void Validate_WhenTotpCodeIsInvalid_ShouldHaveValidationError(string totpCode) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidatorTests.cs index a3fe4cf6..13dde851 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidatorTests.cs @@ -34,9 +34,9 @@ public class UpdatePlaybackStateCommandValidatorTests } [Theory] - [InlineData(-0.01)] // just below the minimum - [InlineData(-1.0)] // well below the minimum - [InlineData(double.MinValue)] // far below the minimum + [InlineData(-0.01)] // Just below the minimum. + [InlineData(-1.0)] // Well below the minimum. + [InlineData(double.MinValue)] // Far below the minimum. public void Validate_WhenVolumeIsBelowZero_ShouldHaveRangeError(double volume) { // Arrange @@ -50,9 +50,9 @@ public class UpdatePlaybackStateCommandValidatorTests } [Theory] - [InlineData(1.01)] // just above the maximum - [InlineData(2.0)] // well above the maximum - [InlineData(double.MaxValue)] // far above the maximum + [InlineData(1.01)] // Just above the maximum. + [InlineData(2.0)] // Well above the maximum. + [InlineData(double.MaxValue)] // Far above the maximum. public void Validate_WhenVolumeIsAboveOne_ShouldHaveRangeError(double volume) { // Arrange @@ -66,9 +66,9 @@ public class UpdatePlaybackStateCommandValidatorTests } [Theory] - [InlineData(0.0)] // the minimum - [InlineData(0.5)] // a middle value - [InlineData(1.0)] // the maximum + [InlineData(0.0)] // The minimum. + [InlineData(0.5)] // A middle value. + [InlineData(1.0)] // The maximum. public void Validate_WhenVolumeIsInRange_ShouldNotHaveRangeError(double volume) { // Arrange diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidatorTests.cs index bb45fa81..293f9e35 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidatorTests.cs @@ -170,8 +170,8 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(999)] // a value that is not a defined member of the enumeration - [InlineData(-1)] // a negative value that is not a defined member of the enumeration + [InlineData(999)] // A value that is not a defined member of the enumeration. + [InlineData(-1)] // A negative value that is not a defined member of the enumeration. public void Validate_WhenVuMeterOrientationIsNotDefined_ShouldHaveValidationError(int vuMeterOrientationValue) { // Arrange @@ -201,10 +201,10 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(0)] // below the minimum - [InlineData(-1)] // negative - [InlineData(129)] // above the maximum - [InlineData(int.MaxValue)] // far above the maximum + [InlineData(0)] // Below the minimum. + [InlineData(-1)] // Negative. + [InlineData(129)] // Above the maximum. + [InlineData(int.MaxValue)] // Far above the maximum. public void Validate_WhenVuMeterSegmentCountIsOutOfRange_ShouldHaveValidationError(int vuMeterSegmentCount) { // Arrange @@ -218,9 +218,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(1)] // the minimum - [InlineData(64)] // a middle value - [InlineData(128)] // the maximum + [InlineData(1)] // The minimum. + [InlineData(64)] // A middle value. + [InlineData(128)] // The maximum. public void Validate_WhenVuMeterSegmentCountIsInRange_ShouldNotHaveValidationError(int vuMeterSegmentCount) { // Arrange @@ -234,9 +234,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(-1)] // below the minimum - [InlineData(33)] // above the maximum - [InlineData(int.MinValue)] // far below the minimum + [InlineData(-1)] // Below the minimum. + [InlineData(33)] // Above the maximum. + [InlineData(int.MinValue)] // Far below the minimum. public void Validate_WhenVuMeterSegmentGapIsOutOfRange_ShouldHaveValidationError(int vuMeterSegmentGap) { // Arrange @@ -250,9 +250,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(0)] // the minimum - [InlineData(16)] // a middle value - [InlineData(32)] // the maximum + [InlineData(0)] // The minimum. + [InlineData(16)] // A middle value. + [InlineData(32)] // The maximum. public void Validate_WhenVuMeterSegmentGapIsInRange_ShouldNotHaveValidationError(int vuMeterSegmentGap) { // Arrange @@ -266,9 +266,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(-0.01)] // just below the minimum - [InlineData(1.01)] // just above the maximum - [InlineData(double.MinValue)] // far below the minimum + [InlineData(-0.01)] // Just below the minimum. + [InlineData(1.01)] // Just above the maximum. + [InlineData(double.MinValue)] // Far below the minimum. public void Validate_WhenVuMeterMediumThresholdIsOutOfRange_ShouldHaveValidationError(double vuMeterMediumThreshold) { // Arrange @@ -284,9 +284,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(0.0)] // the minimum - [InlineData(0.5)] // a middle value - [InlineData(1.0)] // the maximum + [InlineData(0.0)] // The minimum. + [InlineData(0.5)] // A middle value. + [InlineData(1.0)] // The maximum. public void Validate_WhenVuMeterMediumThresholdIsInRange_ShouldNotHaveValidationError(double vuMeterMediumThreshold) { // Arrange @@ -302,9 +302,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(-0.01)] // just below the minimum - [InlineData(1.01)] // just above the maximum - [InlineData(double.MaxValue)] // far above the maximum + [InlineData(-0.01)] // Just below the minimum. + [InlineData(1.01)] // Just above the maximum. + [InlineData(double.MaxValue)] // Far above the maximum. public void Validate_WhenVuMeterHighThresholdIsOutOfRange_ShouldHaveValidationError(double vuMeterHighThreshold) { // Arrange @@ -365,8 +365,8 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(0.5, 0.5)] // the thresholds are equal - [InlineData(0.4, 0.9)] // the high threshold is greater than the medium one + [InlineData(0.5, 0.5)] // The thresholds are equal. + [InlineData(0.4, 0.9)] // The high threshold is greater than the medium one. public void Validate_WhenVuMeterHighThresholdIsGreaterThanOrEqualToMediumThreshold_ShouldNotHaveValidationError( double vuMeterMediumThreshold, double vuMeterHighThreshold) @@ -399,9 +399,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(-1)] // below the minimum - [InlineData(10001)] // above the maximum - [InlineData(int.MinValue)] // far below the minimum + [InlineData(-1)] // Below the minimum. + [InlineData(10001)] // Above the maximum. + [InlineData(int.MinValue)] // Far below the minimum. public void Validate_WhenVuMeterPeakHoldDurationIsOutOfRange_ShouldHaveValidationError(int vuMeterPeakHoldDurationInMilliseconds) { // Arrange @@ -416,9 +416,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(0)] // the minimum - [InlineData(650)] // a middle value - [InlineData(10000)] // the maximum + [InlineData(0)] // The minimum. + [InlineData(650)] // A middle value. + [InlineData(10000)] // The maximum. public void Validate_WhenVuMeterPeakHoldDurationIsInRange_ShouldNotHaveValidationError(int vuMeterPeakHoldDurationInMilliseconds) { // Arrange @@ -433,9 +433,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(-0.01)] // just below the minimum - [InlineData(100.01)] // just above the maximum - [InlineData(double.MinValue)] // far below the minimum + [InlineData(-0.01)] // Just below the minimum. + [InlineData(100.01)] // Just above the maximum. + [InlineData(double.MinValue)] // Far below the minimum. public void Validate_WhenVuMeterReleasePerSecondIsOutOfRange_ShouldHaveValidationError(double vuMeterReleasePerSecond) { // Arrange @@ -450,9 +450,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(0.0)] // the minimum - [InlineData(3.0)] // a middle value - [InlineData(100.0)] // the maximum + [InlineData(0.0)] // The minimum. + [InlineData(3.0)] // A middle value. + [InlineData(100.0)] // The maximum. public void Validate_WhenVuMeterReleasePerSecondIsInRange_ShouldNotHaveValidationError(double vuMeterReleasePerSecond) { // Arrange @@ -467,9 +467,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(-0.01)] // just below the minimum - [InlineData(100.01)] // just above the maximum - [InlineData(double.MaxValue)] // far above the maximum + [InlineData(-0.01)] // Just below the minimum. + [InlineData(100.01)] // Just above the maximum. + [InlineData(double.MaxValue)] // Far above the maximum. public void Validate_WhenVuMeterPeakReleasePerSecondIsOutOfRange_ShouldHaveValidationError(double vuMeterPeakReleasePerSecond) { // Arrange @@ -484,9 +484,9 @@ public class UpdateUserSettingsCommandValidatorTests } [Theory] - [InlineData(0.0)] // the minimum - [InlineData(0.65)] // a middle value - [InlineData(100.0)] // the maximum + [InlineData(0.0)] // The minimum. + [InlineData(0.65)] // A middle value. + [InlineData(100.0)] // The maximum. public void Validate_WhenVuMeterPeakReleasePerSecondIsInRange_ShouldNotHaveValidationError(double vuMeterPeakReleasePerSecond) { // Arrange diff --git a/tests/UnitTests/Lumina.Contracts.UnitTests/DTO/Common/Pagination/PaginationDataDtoTests.cs b/tests/UnitTests/Lumina.Contracts.UnitTests/DTO/Common/Pagination/PaginationDataDtoTests.cs index 96a10c88..d8ecacd8 100644 --- a/tests/UnitTests/Lumina.Contracts.UnitTests/DTO/Common/Pagination/PaginationDataDtoTests.cs +++ b/tests/UnitTests/Lumina.Contracts.UnitTests/DTO/Common/Pagination/PaginationDataDtoTests.cs @@ -41,8 +41,8 @@ public class PaginationDataDtoTests } [Theory] - [InlineData(0)] // zero is below the minimum - [InlineData(-5)] // negative values are below the minimum + [InlineData(0)] // Zero is below the minimum. + [InlineData(-5)] // Negative values are below the minimum. public void CurrentPage_WhenSettingValueBelowOne_ShouldClampToOne(int value) { // Arrange @@ -56,8 +56,8 @@ public class PaginationDataDtoTests } [Theory] - [InlineData(0)] // zero is below the minimum - [InlineData(-10)] // negative values are below the minimum + [InlineData(0)] // Zero is below the minimum. + [InlineData(-10)] // Negative values are below the minimum. public void PerPage_WhenSettingValueBelowOne_ShouldClampToOne(int value) { // Arrange diff --git a/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/MediaConsumption/DeleteConsumptionItemHistoryRequestTests.cs b/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/MediaConsumption/DeleteConsumptionItemHistoryRequestTests.cs index 26d9bc41..e202d1c3 100644 --- a/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/MediaConsumption/DeleteConsumptionItemHistoryRequestTests.cs +++ b/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/MediaConsumption/DeleteConsumptionItemHistoryRequestTests.cs @@ -64,10 +64,10 @@ public class DeleteConsumptionItemHistoryRequestTests } [Theory] - [InlineData("None")] // None is not a valid media kind for a consumption record - [InlineData("999")] // a numeric value that is not a member name - [InlineData("not-a-media-kind")] // a textual value that is not a member name - [InlineData("")] // an empty media kind + [InlineData("None")] // None is not a valid media kind for a consumption record. + [InlineData("999")] // A numeric value that is not a member name. + [InlineData("not-a-media-kind")] // A textual value that is not a member name. + [InlineData("")] // An empty media kind. public void Constructor_WhenMediaKindIsInvalid_ShouldPreserveItForTheValidator(string mediaKind) { // Act diff --git a/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/MediaConsumption/GetGenreConsumptionRequestTests.cs b/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/MediaConsumption/GetGenreConsumptionRequestTests.cs index bbba6ad3..fade8b64 100644 --- a/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/MediaConsumption/GetGenreConsumptionRequestTests.cs +++ b/tests/UnitTests/Lumina.Contracts.UnitTests/Requests/MediaConsumption/GetGenreConsumptionRequestTests.cs @@ -122,9 +122,9 @@ public class GetGenreConsumptionRequestTests } [Theory] - [InlineData("999")] // a numeric value that is not a member name - [InlineData("not-a-media-kind")] // a textual value that is not a member name - [InlineData("")] // an empty media kind + [InlineData("999")] // A numeric value that is not a member name. + [InlineData("not-a-media-kind")] // A textual value that is not a member name. + [InlineData("")] // An empty media kind. public void Constructor_WhenMediaKindIsInvalid_ShouldPreserveItForTheValidator(string mediaKind) { // Act @@ -152,8 +152,8 @@ public class GetGenreConsumptionRequestTests } [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 void Constructor_WhenDateBoundsAreMalformed_ShouldPreserveThemForTheValidator(string malformedBound) { // Act diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Configuration/LibraryScanConfigurationTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Configuration/LibraryScanConfigurationTests.cs index 4ec8f45e..d326a796 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Configuration/LibraryScanConfigurationTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Configuration/LibraryScanConfigurationTests.cs @@ -79,7 +79,7 @@ public class LibraryScanConfigurationTests public void Configure_WhenApplied_ShouldConfigureDescendingIndexOnLibraryIdStatusAndCreatedOnUtc() { // Arrange - // the read-optimized runtime model does not store the index sort order, so the design-time model is inspected instead + // The read-optimized runtime model does not store the index sort order, so the design-time model is inspected instead. IDesignTimeModel designTimeModel = _context.GetService(); IEntityType entityType = designTimeModel.Model.FindEntityType(typeof(LibraryScanEntity))!; diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/DependencyInjection/DataAccessLayerServicesTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/DependencyInjection/DataAccessLayerServicesTests.cs index 5c9f6491..f4918d72 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/DependencyInjection/DataAccessLayerServicesTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/DependencyInjection/DataAccessLayerServicesTests.cs @@ -25,7 +25,7 @@ public class DataAccessLayerServicesTests { // Arrange ServiceCollection services = new(); - string basePath = Path.GetTempPath(); // use a real existing path + string basePath = Path.GetTempPath(); // Use a real existing path. // Act DataAccessLayerServices.AddDataAccessLayerServices(services); diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Persistence/EditableValuesCopierTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Persistence/EditableValuesCopierTests.cs index 094bf835..e514bd68 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Persistence/EditableValuesCopierTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Persistence/EditableValuesCopierTests.cs @@ -102,8 +102,8 @@ public class EditableValuesCopierTests } [Theory] - [InlineData(false)] // the incoming entity carries a different, non-empty key - [InlineData(true)] // the incoming entity carries an unset key + [InlineData(false)] // The incoming entity carries a different, non-empty key. + [InlineData(true)] // The incoming entity carries an unset key. public async Task CopyEditableValues_WhenTheIncomingKeyDoesNotMatchTheTrackedOne_ShouldPreserveTheTrackedIdentity(bool useUnsetKey) { // Arrange diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Setup/TestDateTimeProvider.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Setup/TestDateTimeProvider.cs index b348a348..9f62d29f 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Setup/TestDateTimeProvider.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Common/Setup/TestDateTimeProvider.cs @@ -7,7 +7,7 @@ using System.Diagnostics.CodeAnalysis; namespace Lumina.DataAccess.UnitTests.Common.Setup; /// -/// Service for time related concerns +/// Service for time related concerns. /// [ExcludeFromCodeCoverage] public class TestDateTimeProvider : IDateTimeProvider diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/PermissionRepositoryTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/PermissionRepositoryTests.cs index cf473916..3834513e 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/PermissionRepositoryTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/PermissionRepositoryTests.cs @@ -52,7 +52,7 @@ public class PermissionRepositoryTests Assert.False(result.IsFailure); Assert.Equal(Result.Created, result.Value); - // check if the permission was added to the context's ChangeTracker + // Check if the permission was added to the context's ChangeTracker. EntityEntry? addedPermission = _mockContext.ChangeTracker.Entries() .FirstOrDefault(e => e.State == EntityState.Added && e.Entity.Id == permissionModel.Id); Assert.NotNull(addedPermission); diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/RolePermissionRepositoryTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/RolePermissionRepositoryTests.cs index 76186782..17819e0a 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/RolePermissionRepositoryTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/RolePermissionRepositoryTests.cs @@ -47,7 +47,7 @@ public class RolePermissionRepositoryTests Assert.False(result.IsFailure); Assert.Equal(Result.Created, result.Value); - // check if the role permission was added to the context's ChangeTracker + // Check if the role permission was added to the context's ChangeTracker. EntityEntry? addedRolePermission = _mockContext.ChangeTracker.Entries() .FirstOrDefault(e => e.State == EntityState.Added && e.Entity.Id == rolePermissionModel.Id); Assert.NotNull(addedRolePermission); diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/RoleRepositoryTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/RoleRepositoryTests.cs index dae2e9d2..184a8b66 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/RoleRepositoryTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Authorization/RoleRepositoryTests.cs @@ -53,7 +53,7 @@ public class RoleRepositoryTests Assert.False(result.IsFailure); Assert.Equal(Result.Created, result.Value); - // Check if the role was added to the context's ChangeTracker + // Check if the role was added to the context's ChangeTracker. EntityEntry? addedRole = _mockContext.ChangeTracker.Entries() .FirstOrDefault(e => e.State == EntityState.Added && e.Entity.Id == role.Id); Assert.NotNull(addedRole); diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs index 7675753f..8d994acb 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs @@ -806,14 +806,14 @@ public class ArtistRepositoryTests } [Theory] - [InlineData("website", SortOrder.Ascending)] // the website field, ascending - [InlineData("website", SortOrder.Descending)] // the website field, descending - [InlineData("musicbrainzartistid", SortOrder.Ascending)] // the MusicBrainz artist Id field, ascending - [InlineData("musicbrainzartistid", SortOrder.Descending)] // the MusicBrainz artist Id field, descending - [InlineData("createdonutc", SortOrder.Ascending)] // the creation timestamp field, ascending - [InlineData("createdonutc", SortOrder.Descending)] // the creation timestamp field, descending - [InlineData("updatedonutc", SortOrder.Ascending)] // the update timestamp field, ascending - [InlineData("updatedonutc", SortOrder.Descending)] // the update timestamp field, descending + [InlineData("website", SortOrder.Ascending)] // The website field, ascending. + [InlineData("website", SortOrder.Descending)] // The website field, descending. + [InlineData("musicbrainzartistid", SortOrder.Ascending)] // The MusicBrainz artist Id field, ascending. + [InlineData("musicbrainzartistid", SortOrder.Descending)] // The MusicBrainz artist Id field, descending. + [InlineData("createdonutc", SortOrder.Ascending)] // The creation timestamp field, ascending. + [InlineData("createdonutc", SortOrder.Descending)] // The creation timestamp field, descending. + [InlineData("updatedonutc", SortOrder.Ascending)] // The update timestamp field, ascending. + [InlineData("updatedonutc", SortOrder.Descending)] // The update timestamp field, descending. public async Task GetAllAsync_WhenSortedByField_ShouldOrderByFieldThenById(string sortBy, SortOrder sortOrder) { // Arrange diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Users/UserRepositoryTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Users/UserRepositoryTests.cs index b261db64..e62d2892 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Users/UserRepositoryTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/Users/UserRepositoryTests.cs @@ -147,7 +147,7 @@ public class UserRepositoryTests _mockContext.Users.Add(existingUser); await _mockContext.SaveChangesAsync(); - // Create updated user with same Id but different properties + // Create updated user with same Id but different properties. UserEntity updatedUser = _userEntityFixture.Create(id: existingUser.Id, username: existingUser.Username, password: "NewPassword123"); updatedUser.TempPassword = "TempPass456"; updatedUser.TotpSecret = "NewSecret"; diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Seed/DataSeedServiceTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Seed/DataSeedServiceTests.cs index 93e95a95..d4757f4b 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Seed/DataSeedServiceTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Seed/DataSeedServiceTests.cs @@ -403,7 +403,7 @@ public class DataSeedServiceTests Guid userId = Guid.NewGuid(); RoleEntity adminRole = _roleEntityFixture.Create(roleName: "Admin"); UserEntity adminUser = _userEntityFixture.Create(); - // Use the adminUser.Id instead of the randomly generated userId + // Use the adminUser.Id instead of the randomly generated userId. userId = adminUser.Id; IRoleRepository mockRoleRepository = Substitute.For(); diff --git a/tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/Favorites/FavoriteMediaKindTests.cs b/tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/Favorites/FavoriteMediaKindTests.cs index 0fa29a78..291a0ac6 100644 --- a/tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/Favorites/FavoriteMediaKindTests.cs +++ b/tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/Favorites/FavoriteMediaKindTests.cs @@ -37,8 +37,8 @@ public class FavoriteMediaKindTests nameof(FavoriteMediaKind.MusicAlbum), nameof(FavoriteMediaKind.MusicTrack), nameof(FavoriteMediaKind.Book), - nameof(FavoriteMediaKind.Video), // planned: video libraries are not catalogued yet - nameof(FavoriteMediaKind.Photo) // planned: photo libraries are not catalogued yet + nameof(FavoriteMediaKind.Video), // Planned: video libraries are not catalogued yet. + nameof(FavoriteMediaKind.Photo) // Planned: photo libraries are not catalogued yet. ]; Assert.Equal(expectedNames, names); } @@ -57,8 +57,8 @@ public class FavoriteMediaKindTests FavoriteMediaKind.MusicAlbum, FavoriteMediaKind.MusicTrack, FavoriteMediaKind.Book, - FavoriteMediaKind.Video, // planned: video libraries are not catalogued yet - FavoriteMediaKind.Photo // planned: photo libraries are not catalogued yet + FavoriteMediaKind.Video, // Planned: video libraries are not catalogued yet. + FavoriteMediaKind.Photo // Planned: photo libraries are not catalogued yet. ]; int[] expectedUnderlyingValues = [0, 1, 2, 3, 4, 5, 6]; Assert.Equal(expectedValues, values); diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/GenreTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/GenreTests.cs index f5d69694..303490d1 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/GenreTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/GenreTests.cs @@ -29,10 +29,10 @@ public class GenreTests } [Theory] - [InlineData(" Science FICTION ", "science fiction")] // ASCII mixed case with surrounding whitespace - [InlineData("ÉLECTRO", "électro")] // non-ASCII Latin uppercase - [InlineData("ЖАНР", "жанр")] // non-Latin uppercase - [InlineData(" indie ", "indie")] // surrounding whitespace + [InlineData(" Science FICTION ", "science fiction")] // ASCII mixed case with surrounding whitespace. + [InlineData("ÉLECTRO", "électro")] // Non-ASCII Latin uppercase. + [InlineData("ЖАНР", "жанр")] // Non-Latin uppercase. + [InlineData(" indie ", "indie")] // Surrounding whitespace. public void Create_WhenNameHasMixedCaseOrSurroundingWhitespace_ShouldNormalizeIt(string name, string expectedName) { // Act @@ -70,9 +70,9 @@ public class GenreTests } [Theory] - [InlineData(null)] // null name - [InlineData("")] // empty name - [InlineData(" ")] // whitespace name + [InlineData(null)] // Null name. + [InlineData("")] // Empty name. + [InlineData(" ")] // Whitespace name. public void Create_WhenNameIsNullOrWhitespace_ShouldReturnError(string? name) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/MoodTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/MoodTests.cs index daf3c9c3..a489e1b1 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/MoodTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/MoodTests.cs @@ -28,9 +28,9 @@ public class MoodTests } [Theory] - [InlineData(null)] // null mood name - [InlineData("")] // empty mood name - [InlineData(" ")] // whitespace mood name + [InlineData(null)] // Null mood name. + [InlineData("")] // Empty mood name. + [InlineData(" ")] // Whitespace mood name. public void Create_WhenNameIsNullOrWhitespace_ShouldReturnError(string? name) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/TagTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/TagTests.cs index 24533310..70f6a930 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/TagTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Common/ValueObjects/Metadata/TagTests.cs @@ -29,10 +29,10 @@ public class TagTests } [Theory] - [InlineData(" BeStSeLLeR ", "bestseller")] // ASCII mixed case with surrounding whitespace - [InlineData("ÉLECTRO", "électro")] // non-ASCII Latin uppercase - [InlineData("ЖАНР", "жанр")] // non-Latin uppercase - [InlineData(" indie ", "indie")] // surrounding whitespace + [InlineData(" BeStSeLLeR ", "bestseller")] // ASCII mixed case with surrounding whitespace. + [InlineData("ÉLECTRO", "électro")] // Non-ASCII Latin uppercase. + [InlineData("ЖАНР", "жанр")] // Non-Latin uppercase. + [InlineData(" indie ", "indie")] // Surrounding whitespace. public void Create_WhenNameHasMixedCaseOrSurroundingWhitespace_ShouldNormalizeIt(string name, string expectedName) { // Act @@ -70,9 +70,9 @@ public class TagTests } [Theory] - [InlineData(null)] // null name - [InlineData("")] // empty name - [InlineData(" ")] // whitespace name + [InlineData(null)] // Null name. + [InlineData("")] // Empty name. + [InlineData(" ")] // Whitespace name. public void Create_WhenNameIsNullOrWhitespace_ShouldReturnError(string? name) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/Common/ValueObjects/AudioRatingTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/Common/ValueObjects/AudioRatingTests.cs index 6b61e746..142aac0b 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/Common/ValueObjects/AudioRatingTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/Common/ValueObjects/AudioRatingTests.cs @@ -44,8 +44,8 @@ public class AudioRatingTests } [Theory] - [InlineData(-1)] // negative value - [InlineData(-0.5)] // negative fractional value + [InlineData(-1)] // Negative value. + [InlineData(-0.5)] // Negative fractional value. public void Create_WhenValueIsNegative_ShouldReturnError(double value) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ArtistTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ArtistTests.cs index f3ec3dc2..7d0da4c7 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ArtistTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ArtistTests.cs @@ -190,9 +190,9 @@ public class ArtistTests } [Theory] - [InlineData(null)] // null name - [InlineData("")] // empty name - [InlineData(" ")] // whitespace name + [InlineData(null)] // Null name. + [InlineData("")] // Empty name. + [InlineData(" ")] // Whitespace name. public void Create_WhenNameIsNullOrWhitespace_ShouldReturnArtistNameCannotBeEmptyError(string? name) { // Act @@ -311,9 +311,9 @@ public class ArtistTests } [Theory] - [InlineData(null)] // null name - [InlineData("")] // empty name - [InlineData(" ")] // whitespace name + [InlineData(null)] // Null name. + [InlineData("")] // Empty name. + [InlineData(" ")] // Whitespace name. public void CreateWithId_WhenNameIsNullOrWhitespace_ShouldReturnArtistNameCannotBeEmptyError(string? name) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/AlbumTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/AlbumTests.cs index 8f27b8dc..eebc0b9e 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/AlbumTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/AlbumTests.cs @@ -351,7 +351,7 @@ public class AlbumTests Assert.Equal(releaseArtistId, album.MusicBrainzReleaseArtistId); Assert.True(album.UpdatedOnUtc.HasValue); Assert.True(album.UpdatedOnUtc.Value >= beforeUpdate); - // the tracks are not part of the details update + // The tracks are not part of the details update. Assert.Equal(originalTracks, album.Tracks); } diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/TrackTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/TrackTests.cs index 7c7d26d8..6b9da471 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/TrackTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/TrackTests.cs @@ -123,7 +123,7 @@ public class TrackTests track.UpdateMoods([secondMood]); // Assert - // the second call replaces the first set, it is not appended to it + // The second call replaces the first set, it is not appended to it. Mood storedMood = Assert.Single(track.Moods); Assert.Equal(secondMood, storedMood); Assert.DoesNotContain(firstMood, track.Moods); @@ -142,7 +142,7 @@ public class TrackTests track.UpdateIsrcs([secondIsrc]); // Assert - // the second call replaces the first set, it is not appended to it + // The second call replaces the first set, it is not appended to it. Isrc storedIsrc = Assert.Single(track.Isrcs); Assert.Equal(secondIsrc, storedIsrc); Assert.DoesNotContain(firstIsrc, track.Isrcs); @@ -161,7 +161,7 @@ public class TrackTests track.UpdateContributors([secondContributor]); // Assert - // the second call replaces the first set, it is not appended to it + // The second call replaces the first set, it is not appended to it. MusicMediaContributor storedContributor = Assert.Single(track.Contributors); Assert.Equal(secondContributor, storedContributor); Assert.DoesNotContain(firstContributor, track.Contributors); @@ -180,7 +180,7 @@ public class TrackTests track.UpdateRatings([secondRating]); // Assert - // the second call replaces the first set, it is not appended to it + // The second call replaces the first set, it is not appended to it. AudioRating storedRating = Assert.Single(track.Ratings); Assert.Equal(secondRating, storedRating); } diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/BarcodeTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/BarcodeTests.cs index 67f805f8..0b7f11ec 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/BarcodeTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/BarcodeTests.cs @@ -50,9 +50,9 @@ public class BarcodeTests } [Theory] - [InlineData(null)] // null barcode value - [InlineData("")] // empty barcode value - [InlineData(" ")] // whitespace barcode value + [InlineData(null)] // Null barcode value. + [InlineData("")] // Empty barcode value. + [InlineData(" ")] // Whitespace barcode value. public void Create_WhenValueIsNullOrWhitespace_ShouldReturnBarcodeValueCannotBeEmptyError(string? value) { // Act @@ -64,11 +64,11 @@ public class BarcodeTests } [Theory] - [InlineData("12345678901")] // eleven digits, one too few - [InlineData("12345678901234")] // fourteen digits, one too many - [InlineData("12345678901A")] // contains a letter - [InlineData("1234-56789012")] // contains a separator - [InlineData("1234567890.2")] // contains a decimal separator + [InlineData("12345678901")] // Eleven digits, one too few. + [InlineData("12345678901234")] // Fourteen digits, one too many. + [InlineData("12345678901A")] // Contains a letter. + [InlineData("1234-56789012")] // Contains a separator. + [InlineData("1234567890.2")] // Contains a decimal separator. public void Create_WhenValueHasInvalidFormat_ShouldReturnInvalidFormatForBarcodeError(string value) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/IsrcTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/IsrcTests.cs index f2211c54..e0f6b819 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/IsrcTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/IsrcTests.cs @@ -39,9 +39,9 @@ public class IsrcTests } [Theory] - [InlineData(null)] // null ISRC value - [InlineData("")] // empty ISRC value - [InlineData(" ")] // whitespace ISRC value + [InlineData(null)] // Null ISRC value. + [InlineData("")] // Empty ISRC value. + [InlineData(" ")] // Whitespace ISRC value. public void Create_WhenValueIsNullOrWhitespace_ShouldReturnError(string? value) { // Act @@ -53,11 +53,11 @@ public class IsrcTests } [Theory] - [InlineData("USRC1760783")] // too short - [InlineData("USRC176078399")] // too long - [InlineData("1SRC17607839")] // country code does not start with two letters - [InlineData("USRC1760783X")] // designation segment is not purely numeric - [InlineData("USRC-7607839")] // contains an invalid character + [InlineData("USRC1760783")] // Too short. + [InlineData("USRC176078399")] // Too long. + [InlineData("1SRC17607839")] // Country code does not start with two letters. + [InlineData("USRC1760783X")] // Designation segment is not purely numeric. + [InlineData("USRC-7607839")] // Contains an invalid character. public void Create_WhenValueHasInvalidFormat_ShouldReturnError(string value) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicAreaTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicAreaTests.cs index 1dadf494..bf30061b 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicAreaTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicAreaTests.cs @@ -61,9 +61,9 @@ public class MusicAreaTests } [Theory] - [InlineData(null)] // null area name - [InlineData("")] // empty area name - [InlineData(" ")] // whitespace area name + [InlineData(null)] // Null area name. + [InlineData("")] // Empty area name. + [InlineData(" ")] // Whitespace area name. public void Create_WhenNameIsNullOrWhitespace_ShouldReturnError(string? name) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicArtistAliasTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicArtistAliasTests.cs index 9e84ec84..9c169f4a 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicArtistAliasTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicArtistAliasTests.cs @@ -67,9 +67,9 @@ public class MusicArtistAliasTests } [Theory] - [InlineData(null)] // null alias name - [InlineData("")] // empty alias name - [InlineData(" ")] // whitespace alias name + [InlineData(null)] // Null alias name. + [InlineData("")] // Empty alias name. + [InlineData(" ")] // Whitespace alias name. public void Create_WhenNameIsNullOrWhitespace_ShouldReturnError(string? name) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicWorkTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicWorkTests.cs index 020214b7..99b75109 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicWorkTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ValueObjects/MusicWorkTests.cs @@ -63,9 +63,9 @@ public class MusicWorkTests } [Theory] - [InlineData(null)] // null work title - [InlineData("")] // empty work title - [InlineData(" ")] // whitespace work title + [InlineData(null)] // Null work title. + [InlineData("")] // Empty work title. + [InlineData(" ")] // Whitespace work title. public void Create_WhenTitleIsNullOrWhitespace_ShouldReturnError(string? title) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FavoriteBoundedContext/FavoriteAggregate/FavoriteTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FavoriteBoundedContext/FavoriteAggregate/FavoriteTests.cs index 393f2a5e..6b324d15 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FavoriteBoundedContext/FavoriteAggregate/FavoriteTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FavoriteBoundedContext/FavoriteAggregate/FavoriteTests.cs @@ -29,10 +29,10 @@ public class FavoriteTests private readonly MediaItemIdFixture _mediaItemIdFixture = new(); [Theory] - [InlineData(FavoriteMediaKind.MusicArtist)] // an artist of a music library - [InlineData(FavoriteMediaKind.MusicAlbum)] // an album of a music library - [InlineData(FavoriteMediaKind.MusicTrack)] // a track of a music library - [InlineData(FavoriteMediaKind.Book)] // a book of a book library + [InlineData(FavoriteMediaKind.MusicArtist)] // An artist of a music library. + [InlineData(FavoriteMediaKind.MusicAlbum)] // An album of a music library. + [InlineData(FavoriteMediaKind.MusicTrack)] // A track of a music library. + [InlineData(FavoriteMediaKind.Book)] // A book of a book library. public void Create_WhenMediaKindIsSupported_ShouldCreateFavoriteAndRaiseSingleAddedEvent(FavoriteMediaKind mediaKind) { // Arrange @@ -80,10 +80,10 @@ public class FavoriteTests } [Theory] - [InlineData(FavoriteMediaKind.None)] // the default value, which is not a kind that can be favorited - [InlineData(FavoriteMediaKind.Video)] // a planned kind: video libraries are not catalogued yet - [InlineData(FavoriteMediaKind.Photo)] // a planned kind: photo libraries are not catalogued yet - [InlineData((FavoriteMediaKind)999)] // a value outside the declared enumeration members + [InlineData(FavoriteMediaKind.None)] // The default value, which is not a kind that can be favorited. + [InlineData(FavoriteMediaKind.Video)] // A planned kind: video libraries are not catalogued yet. + [InlineData(FavoriteMediaKind.Photo)] // A planned kind: photo libraries are not catalogued yet. + [InlineData((FavoriteMediaKind)999)] // A value outside the declared enumeration members. public void Create_WhenMediaKindIsNotSupported_ShouldReturnErrorAndProduceNoFavorite(FavoriteMediaKind mediaKind) { // Act @@ -97,9 +97,9 @@ public class FavoriteTests } [Theory] - [InlineData(FavoriteMediaKind.MusicAlbum)] // a supported kind that was stored with an update - [InlineData(FavoriteMediaKind.None)] // the default value, preserved as it was recorded - [InlineData(FavoriteMediaKind.Video)] // a planned kind, stored as it was recorded, whatever its support today + [InlineData(FavoriteMediaKind.MusicAlbum)] // A supported kind that was stored with an update. + [InlineData(FavoriteMediaKind.None)] // The default value, preserved as it was recorded. + [InlineData(FavoriteMediaKind.Video)] // A planned kind, stored as it was recorded, whatever its support today. public void Create_WhenRehydratingWithUpdatedOnUtc_ShouldPreserveAllDataAndRaiseNoEvents(FavoriteMediaKind mediaKind) { // Arrange @@ -216,15 +216,15 @@ public class FavoriteTests } [Theory] - [InlineData(FavoriteMediaKind.None, false)] // the default value, which is not a kind that can be favorited - [InlineData(FavoriteMediaKind.MusicArtist, true)] // an artist of a music library can be favorited - [InlineData(FavoriteMediaKind.MusicAlbum, true)] // an album of a music library can be favorited - [InlineData(FavoriteMediaKind.MusicTrack, true)] // a track of a music library can be favorited - [InlineData(FavoriteMediaKind.Book, true)] // a book of a book library can be favorited - [InlineData(FavoriteMediaKind.Video, false)] // a planned kind: video libraries are not catalogued yet - [InlineData(FavoriteMediaKind.Photo, false)] // a planned kind: photo libraries are not catalogued yet - [InlineData((FavoriteMediaKind)999, false)] // a value outside the declared enumeration members - [InlineData((FavoriteMediaKind)(-1), false)] // a value below the declared enumeration members + [InlineData(FavoriteMediaKind.None, false)] // The default value, which is not a kind that can be favorited. + [InlineData(FavoriteMediaKind.MusicArtist, true)] // An artist of a music library can be favorited. + [InlineData(FavoriteMediaKind.MusicAlbum, true)] // An album of a music library can be favorited. + [InlineData(FavoriteMediaKind.MusicTrack, true)] // A track of a music library can be favorited. + [InlineData(FavoriteMediaKind.Book, true)] // A book of a book library can be favorited. + [InlineData(FavoriteMediaKind.Video, false)] // A planned kind: video libraries are not catalogued yet. + [InlineData(FavoriteMediaKind.Photo, false)] // A planned kind: photo libraries are not catalogued yet. + [InlineData((FavoriteMediaKind)999, false)] // A value outside the declared enumeration members. + [InlineData((FavoriteMediaKind)(-1), false)] // A value below the declared enumeration members. public void IsSupported_WhenCalled_ShouldOnlySupportCataloguedMediaKinds(FavoriteMediaKind mediaKind, bool expectedIsSupported) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderServiceTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderServiceTests.cs index 2e912756..62d4eedd 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderServiceTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DirectoryProviderServiceTests.cs @@ -608,7 +608,7 @@ public class DirectoryProviderServiceTests bool overrideExisting = true; - // ensure all relevant directories exist + // Ensure all relevant directories exist. _mockFileSystem.Directory.Exists(_pathSource).Returns(true); _mockFileSystem.Directory.Exists(_pathSourceSubDir).Returns(true); _mockFileSystem.Directory.Exists(_pathDestination).Returns(false); @@ -632,13 +632,13 @@ public class DirectoryProviderServiceTests sourceDirectoryInfo.GetDirectories().Returns([mockSubDir]); _mockFileSystem.DirectoryInfo.New(_pathSource).Returns(sourceDirectoryInfo); - // mock subdirectory info + // Mock subdirectory info. IDirectoryInfo subDirInfo = Substitute.For(); subDirInfo.GetFiles().Returns([]); subDirInfo.GetDirectories().Returns([]); _mockFileSystem.DirectoryInfo.New(_pathSourceSubDir).Returns(subDirInfo); - // mock the Path.Combine method for all necessary cases + // Mock the Path.Combine method for all necessary cases. _mockFileSystem.Path.Combine(Arg.Any(), Arg.Any()) .Returns(callInfo => Path.Combine(callInfo.ArgAt(0), callInfo.ArgAt(1))); diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DriveServiceTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DriveServiceTests.cs index f5e78cc9..4fd3f84e 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DriveServiceTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/DriveServiceTests.cs @@ -62,7 +62,7 @@ public class DriveServiceTests [ CreateMockDriveInfo("C:\\", true), CreateMockDriveInfo("D:\\", true), - CreateMockDriveInfo("E:\\", false) // Not ready + CreateMockDriveInfo("E:\\", false) // Not ready. ]; _mockFileSystem.DriveInfo.GetDrives().Returns(mockDrives); @@ -71,7 +71,7 @@ public class DriveServiceTests // Assert Assert.False(result.IsFailure); - Assert.Equal(2, result.Value.Count()); // Only ready drives + Assert.Equal(2, result.Value.Count()); // Only ready drives. Assert.All(result.Value, item => Assert.IsType(item)); Assert.Equal(["C:\\", "D:\\"], result.Value.Select(d => d.Name)); } @@ -84,7 +84,7 @@ public class DriveServiceTests IDriveInfo[] mockDrives = [ CreateMockDriveInfo("C:\\", true), - CreateMockDriveInfo("", true) // drive whose name cannot be turned into a valid path + CreateMockDriveInfo("", true) // Drive whose name cannot be turned into a valid path. ]; _mockFileSystem.DriveInfo.GetDrives().Returns(mockDrives); diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileTypeServiceTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileTypeServiceTests.cs index dcc32308..dcc44e71 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileTypeServiceTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/FileTypeServiceTests.cs @@ -84,7 +84,7 @@ public class FileTypeServiceTests { // Arrange FileSystemPathId pathId = _fileSystemPathIdFixture.Create(@"C:\test.jpg"); - byte[] fileContent = [1, 2, 3]; // Less than BUFFER_SIZE + byte[] fileContent = [1, 2, 3]; // Less than BUFFER_SIZE. SetupMockFileSystem(pathId, fileContent); sut = new FileTypeService(_mockFileSystem, _mockFileSystemPermissionsService); @@ -124,7 +124,7 @@ public class FileTypeServiceTests // Arrange FileSystemPathId pathId = _fileSystemPathIdFixture.Create(@"C:\test.tga"); byte[] tgaHeader = new byte[18]; - tgaHeader[2] = 2; // Set image type to 2 (uncompressed true-color image) + tgaHeader[2] = 2; // Set image type to 2 (uncompressed true-color image). byte[] fileContent = [.. tgaHeader, .. Enumerable.Repeat(0, 100)]; SetupMockFileSystem(pathId, fileContent); diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/PathServiceTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/PathServiceTests.cs index 01aeff31..02f7694b 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/PathServiceTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/PathServiceTests.cs @@ -347,7 +347,7 @@ public class PathServiceTests // Arrange string validPath = @"C:\ValidPath\SubDir"; FileSystemPathId pathId = _fileSystemPathIdFixture.Create(validPath); - List expectedSegments = _pathSegmentFixture.CreateMany(2); // Assuming parent path has 2 segments + List expectedSegments = _pathSegmentFixture.CreateMany(2); // Assuming parent path has 2 segments. _mockPathStrategy.GoUpOneLevel(pathId).Returns(Result.From(expectedSegments.AsEnumerable())); // Act @@ -463,7 +463,7 @@ public class PathServiceTests // Act char[] result = _sut.GetInvalidPathCharsForPlatform(); - result[0] = 'X'; // Attempt to modify the returned array + result[0] = 'X'; // Attempt to modify the returned array. // Assert char[] secondResult = _sut.GetInvalidPathCharsForPlatform(); @@ -627,7 +627,7 @@ public class PathServiceTests public void SanitizeSegment_WithForwardSlash_ShouldReturnInvalidPath() { // Arrange - // the forward slash is not an invalid character for a segment on Unix-like platforms, so only the path service can reject it + // The forward slash is not an invalid character for a segment on Unix-like platforms, so only the path service can reject it. _mockPathStrategy.GetInvalidPathSegmentCharsForPlatform().Returns(['\0']); // Act @@ -642,7 +642,7 @@ public class PathServiceTests public void SanitizeSegment_WithBackslash_ShouldReturnInvalidPath() { // Arrange - // the backslash is not an invalid character for a segment on Windows platforms, so only the path service can reject it + // The backslash is not an invalid character for a segment on Windows platforms, so only the path service can reject it. _mockPathStrategy.GetInvalidPathSegmentCharsForPlatform().Returns(['<', '>', '"', '|', '?', '*', ':']); // Act @@ -654,10 +654,10 @@ public class PathServiceTests } [Theory] - [InlineData("../..")] // parent directory escape - [InlineData("a/../b")] // embedded parent directory escape - [InlineData("..\\..")] // Windows parent directory escape - [InlineData("a\\..\\b")] // embedded Windows parent directory escape + [InlineData("../..")] // Parent directory escape. + [InlineData("a/../b")] // Embedded parent directory escape. + [InlineData("..\\..")] // Windows parent directory escape. + [InlineData("a\\..\\b")] // Embedded Windows parent directory escape. public void SanitizeSegment_WithPathTraversal_ShouldReturnInvalidPath(string name) { // Arrange @@ -675,7 +675,7 @@ public class PathServiceTests public void SanitizeSegment_WithAColon_WhenTheColonIsValidForThePlatform_ShouldKeepTheColon() { // Arrange - // the colon is not an invalid character for a segment on Unix-like platforms, so it must be preserved + // The colon is not an invalid character for a segment on Unix-like platforms, so it must be preserved. _mockPathStrategy.GetInvalidPathSegmentCharsForPlatform().Returns(['\0']); // Act @@ -690,7 +690,7 @@ public class PathServiceTests public void SanitizeSegment_WithAColon_WhenTheColonIsInvalidForThePlatform_ShouldReplaceItWithASpace() { // Arrange - // the colon is an invalid character for a segment on Windows platforms, so it must be replaced + // The colon is an invalid character for a segment on Windows platforms, so it must be replaced. _mockPathStrategy.GetInvalidPathSegmentCharsForPlatform().Returns(['<', '>', '"', '|', '?', '*', ':']); // Act @@ -866,8 +866,8 @@ public class PathServiceTests } [Theory] - [InlineData('\\', @"C:\Music\Queen\Bohemian Rhapsody.mp3", "Bohemian Rhapsody.mp3")] // Windows separated path - [InlineData('/', "/music/queen/bohemian-rhapsody.mp3", "bohemian-rhapsody.mp3")] // Unix separated path + [InlineData('\\', @"C:\Music\Queen\Bohemian Rhapsody.mp3", "Bohemian Rhapsody.mp3")] // Windows separated path. + [InlineData('/', "/music/queen/bohemian-rhapsody.mp3", "bohemian-rhapsody.mp3")] // Unix separated path. public void GetFileName_WhenPathHasDirectories_ShouldReturnTheLastSegment(char separator, string path, string expectedFileName) { // Arrange @@ -881,8 +881,8 @@ public class PathServiceTests } [Theory] - [InlineData('\\')] // Windows separated path - [InlineData('/')] // Unix separated path + [InlineData('\\')] // Windows separated path. + [InlineData('/')] // Unix separated path. public void GetFileName_WhenPathHasNoDirectory_ShouldReturnThePath(char separator) { // Arrange @@ -908,8 +908,8 @@ public class PathServiceTests } [Theory] - [InlineData('\\', @"C:\Music\Queen\Bohemian Rhapsody.mp3", "Bohemian Rhapsody")] // Windows separated path - [InlineData('/', "/music/queen/bohemian-rhapsody.mp3", "bohemian-rhapsody")] // Unix separated path + [InlineData('\\', @"C:\Music\Queen\Bohemian Rhapsody.mp3", "Bohemian Rhapsody")] // Windows separated path. + [InlineData('/', "/music/queen/bohemian-rhapsody.mp3", "bohemian-rhapsody")] // Unix separated path. public void GetFileNameWithoutExtension_WhenPathHasDirectories_ShouldReturnTheFileNameWithoutItsExtension(char separator, string path, string expectedFileName) { // Arrange @@ -923,8 +923,8 @@ public class PathServiceTests } [Theory] - [InlineData('\\')] // Windows separated path - [InlineData('/')] // Unix separated path + [InlineData('\\')] // Windows separated path. + [InlineData('/')] // Unix separated path. public void GetFileNameWithoutExtension_WhenFileNameHasNoExtension_ShouldReturnTheFileName(char separator) { // Arrange diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/ThumbnailServiceTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/ThumbnailServiceTests.cs index fbf57350..8a98fec3 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/ThumbnailServiceTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Services/ThumbnailServiceTests.cs @@ -47,7 +47,7 @@ public class ThumbnailServiceTests int quality = 80; FileSystemPathId pathId = _fileSystemPathIdFixture.Create(path); - // Create a small valid JPEG image + // Create a small valid JPEG image. byte[] imageBytes; using (Image image = new(10, 10)) { @@ -170,12 +170,12 @@ public class ThumbnailServiceTests } [Theory] - [InlineData(ImageType.JPEG2000)] // resolution adjustment switch branch for JPEG2000 - [InlineData(ImageType.JPEG_CANON)] // resolution adjustment switch branch for Canon JPEG - [InlineData(ImageType.JPEG_UNKNOWN)] // resolution adjustment switch branch for unknown JPEG - [InlineData(ImageType.TIFF)] // resolution adjustment switch branch for TIFF - [InlineData(ImageType.WEBP)] // resolution adjustment switch branch for WEBP - [InlineData(ImageType.TGA)] // resolution adjustment switch branch for TGA + [InlineData(ImageType.JPEG2000)] // Resolution adjustment switch branch for JPEG2000. + [InlineData(ImageType.JPEG_CANON)] // Resolution adjustment switch branch for Canon JPEG. + [InlineData(ImageType.JPEG_UNKNOWN)] // Resolution adjustment switch branch for unknown JPEG. + [InlineData(ImageType.TIFF)] // Resolution adjustment switch branch for TIFF. + [InlineData(ImageType.WEBP)] // Resolution adjustment switch branch for WEBP. + [InlineData(ImageType.TGA)] // Resolution adjustment switch branch for TGA. public async Task GetThumbnailAsync_WithAdditionalSupportedImageTypes_ShouldReturnAdjustedThumbnail(ImageType imageType) { // Arrange @@ -204,11 +204,11 @@ public class ThumbnailServiceTests } [Theory] - [InlineData(ImageType.SVG)] // SVG is not resized, original bytes are returned - [InlineData(ImageType.PICT)] // PICT is not resized, original bytes are returned - [InlineData(ImageType.ICO)] // ICO is not resized, original bytes are returned - [InlineData(ImageType.PSD)] // PSD is not resized, original bytes are returned - [InlineData(ImageType.AVIF)] // AVIF is not resized, original bytes are returned + [InlineData(ImageType.SVG)] // SVG is not resized, original bytes are returned. + [InlineData(ImageType.PICT)] // PICT is not resized, original bytes are returned. + [InlineData(ImageType.ICO)] // ICO is not resized, original bytes are returned. + [InlineData(ImageType.PSD)] // PSD is not resized, original bytes are returned. + [InlineData(ImageType.AVIF)] // AVIF is not resized, original bytes are returned. public async Task GetThumbnailAsync_WithUnsupportedNonNoneImageType_ShouldReturnOriginalBytes(ImageType imageType) { // Arrange diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Path/UnixPathStrategyTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Path/UnixPathStrategyTests.cs index d28c8c98..d279ef50 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Path/UnixPathStrategyTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Path/UnixPathStrategyTests.cs @@ -598,10 +598,10 @@ public class UnixPathStrategyTests } [Theory] - [InlineData("/media/books", "/media/books/book.epub")] // direct child - [InlineData("/media", "/media/books/book.epub")] // nested descendant - [InlineData("/media/books/", "/media/books/book.epub")] // trailing separator on the parent - [InlineData("/media/books", "/media/books/sub/../book.epub")] // relative segments that stay inside + [InlineData("/media/books", "/media/books/book.epub")] // Direct child. + [InlineData("/media", "/media/books/book.epub")] // Nested descendant. + [InlineData("/media/books/", "/media/books/book.epub")] // Trailing separator on the parent. + [InlineData("/media/books", "/media/books/sub/../book.epub")] // Relative segments that stay inside. public void IsPathWithin_WithContainedPaths_ShouldReturnTrue(string parentPath, string path) { // Arrange @@ -616,12 +616,12 @@ public class UnixPathStrategyTests } [Theory] - [InlineData("/media/books", "/media/book.epub")] // sibling directory - [InlineData("/media/books", "/Media/Books/book.epub")] // Unix paths are case-sensitive - [InlineData("/media/books", "/media/other/book.epub")] // sibling directory - [InlineData("/media/books", "/media/books/../other/book.epub")] // relative segment that escapes the parent - [InlineData("/media/books", "/etc/passwd")] // unrelated location - [InlineData("/media", "/media")] // the parent itself is not inside itself + [InlineData("/media/books", "/media/book.epub")] // Sibling directory. + [InlineData("/media/books", "/Media/Books/book.epub")] // Unix paths are case-sensitive. + [InlineData("/media/books", "/media/other/book.epub")] // Sibling directory. + [InlineData("/media/books", "/media/books/../other/book.epub")] // Relative segment that escapes the parent. + [InlineData("/media/books", "/etc/passwd")] // Unrelated location. + [InlineData("/media", "/media")] // The parent itself is not inside itself. public void IsPathWithin_WithPathsOutsideTheParent_ShouldReturnFalse(string parentPath, string path) { // Arrange diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Path/WindowsPathStrategyTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Path/WindowsPathStrategyTests.cs index 9b555d83..c1f838bf 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Path/WindowsPathStrategyTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Path/WindowsPathStrategyTests.cs @@ -813,11 +813,11 @@ public class WindowsPathStrategyTests } [Theory] - [InlineData(@"C:\Media\Books", @"C:\Media\Books\book.epub")] // direct child - [InlineData(@"C:\Media", @"C:\Media\Books\book.epub")] // nested descendant - [InlineData(@"C:\Media\Books\", @"C:\Media\Books\book.epub")] // trailing separator on the parent - [InlineData(@"C:\Media\Books", @"c:\media\books\book.epub")] // Windows paths are case-insensitive - [InlineData(@"C:\Media\Books", @"C:\Media\Books\Sub\..\book.epub")] // relative segments that stay inside + [InlineData(@"C:\Media\Books", @"C:\Media\Books\book.epub")] // Direct child. + [InlineData(@"C:\Media", @"C:\Media\Books\book.epub")] // Nested descendant. + [InlineData(@"C:\Media\Books\", @"C:\Media\Books\book.epub")] // Trailing separator on the parent. + [InlineData(@"C:\Media\Books", @"c:\media\books\book.epub")] // Windows paths are case-insensitive. + [InlineData(@"C:\Media\Books", @"C:\Media\Books\Sub\..\book.epub")] // Relative segments that stay inside. public void IsPathWithin_WithContainedPaths_ShouldReturnTrue(string parentPath, string path) { // Arrange @@ -832,13 +832,13 @@ public class WindowsPathStrategyTests } [Theory] - [InlineData(@"C:\Media\Books", @"C:\Media\book.epub")] // sibling directory - [InlineData(@"C:\Media\Books", @"D:\Media\Books\book.epub")] // different drive - [InlineData(@"C:\Media\Books", @"C:\Media\BookShelf\book.epub")] // a sibling whose name shares the prefix - [InlineData(@"C:\Media\Books", @"C:\Media\Other\book.epub")] // sibling directory - [InlineData(@"C:\Media\Books", @"C:\Media\Books\..\Other\book.epub")] // relative segment that escapes the parent - [InlineData(@"C:\Media\Books", @"C:\Windows\System32\config\SAM")] // unrelated location - [InlineData(@"C:\Media", @"C:\Media")] // the parent itself is not inside itself + [InlineData(@"C:\Media\Books", @"C:\Media\book.epub")] // Sibling directory. + [InlineData(@"C:\Media\Books", @"D:\Media\Books\book.epub")] // Different drive. + [InlineData(@"C:\Media\Books", @"C:\Media\BookShelf\book.epub")] // A sibling whose name shares the prefix. + [InlineData(@"C:\Media\Books", @"C:\Media\Other\book.epub")] // Sibling directory. + [InlineData(@"C:\Media\Books", @"C:\Media\Books\..\Other\book.epub")] // Relative segment that escapes the parent. + [InlineData(@"C:\Media\Books", @"C:\Windows\System32\config\SAM")] // Unrelated location. + [InlineData(@"C:\Media", @"C:\Media")] // The parent itself is not inside itself. public void IsPathWithin_WithPathsOutsideTheParent_ShouldReturnFalse(string parentPath, string path) { // Arrange diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Platform/PlatformContextManagerTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Platform/PlatformContextManagerTests.cs index be42d503..2ef5af11 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Platform/PlatformContextManagerTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/FileSystemManagementBoundedContext/FileSystemManagementAggregate/Strategies/Platform/PlatformContextManagerTests.cs @@ -104,7 +104,7 @@ public class PlatformContextManagerTests public void SetCurrentPlatform_WhenUnsupportedPlatform_ShouldThrowArgumentException() { // Arrange - PlatformType unsupportedPlatform = (PlatformType)999; // An unsupported platform type + PlatformType unsupportedPlatform = (PlatformType)999; // An unsupported platform type. IOperatingSystemInfo mockOsInfo = Substitute.For(); sut = new(_mockPlatformContextFactory, mockOsInfo); diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/LibraryTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/LibraryTests.cs index 32f879d2..82c0a68e 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/LibraryTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/LibraryTests.cs @@ -179,9 +179,9 @@ public class LibraryTests } [Theory] - [InlineData(null)] // null content location - [InlineData("")] // empty content location - [InlineData(" ")] // whitespace content location + [InlineData(null)] // Null content location. + [InlineData("")] // Empty content location. + [InlineData(" ")] // Whitespace content location. public void Create_WhenContentLocationIsInvalid_ShouldReturnError(string? contentLocation) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryConsumptionSettingsTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryConsumptionSettingsTests.cs index 637fd2c8..81e5387b 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryConsumptionSettingsTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryConsumptionSettingsTests.cs @@ -177,42 +177,42 @@ public class LibraryConsumptionSettingsTests } [Theory] - [InlineData(LibraryType.Book, true, 100)] // written content - [InlineData(LibraryType.EBook, true, 100)] // written content - [InlineData(LibraryType.ComicBook, true, 100)] // written content - [InlineData(LibraryType.Magazine, true, 100)] // written content - [InlineData(LibraryType.Newspaper, true, 100)] // written content - [InlineData(LibraryType.Manga, true, 100)] // written content - [InlineData(LibraryType.GraphicNovel, true, 100)] // written content - [InlineData(LibraryType.AcademicPaper, true, 100)] // written content - [InlineData(LibraryType.SheetMusic, true, 100)] // written content - [InlineData(LibraryType.TvShow, true, 90)] // video - [InlineData(LibraryType.Movie, true, 90)] // video - [InlineData(LibraryType.Documentary, true, 90)] // video - [InlineData(LibraryType.Anime, true, 90)] // video - [InlineData(LibraryType.ConcertVideo, true, 90)] // video - [InlineData(LibraryType.TutorialVideo, true, 90)] // video - [InlineData(LibraryType.HomeVideo, true, 90)] // video - [InlineData(LibraryType.YouTubeVideo, true, 90)] // video - [InlineData(LibraryType.MusicVideo, true, 90)] // video - [InlineData(LibraryType.LiveRecordingVideo, true, 90)] // video - [InlineData(LibraryType.InterviewVideo, true, 90)] // video - [InlineData(LibraryType.CoverSongVideo, true, 90)] // video - [InlineData(LibraryType.Audiobook, true, 95)] // audiobooks and podcasts - [InlineData(LibraryType.PodcastAudio, true, 95)] // audiobooks and podcasts - [InlineData(LibraryType.PodcastVideo, true, 95)] // audiobooks and podcasts - [InlineData(LibraryType.Music, false, null)] // music audio and photos - [InlineData(LibraryType.Remix, false, null)] // music audio and photos - [InlineData(LibraryType.SoundEffect, false, null)] // music audio and photos - [InlineData(LibraryType.LiveRecordingAudio, false, null)] // music audio and photos - [InlineData(LibraryType.InterviewAudio, false, null)] // music audio and photos - [InlineData(LibraryType.CoverSongAudio, false, null)] // music audio and photos - [InlineData(LibraryType.Photo, false, null)] // music audio and photos - [InlineData(LibraryType.Playlist, false, null)] // library types that are not media libraries - [InlineData(LibraryType.Collection, false, null)] // library types that are not media libraries - [InlineData(LibraryType.Subtitles, false, null)] // library types that are not media libraries - [InlineData(LibraryType.Lyrics, false, null)] // library types that are not media libraries - [InlineData(LibraryType.Other, false, null)] // library types that are not media libraries + [InlineData(LibraryType.Book, true, 100)] // Written content. + [InlineData(LibraryType.EBook, true, 100)] // Written content. + [InlineData(LibraryType.ComicBook, true, 100)] // Written content. + [InlineData(LibraryType.Magazine, true, 100)] // Written content. + [InlineData(LibraryType.Newspaper, true, 100)] // Written content. + [InlineData(LibraryType.Manga, true, 100)] // Written content. + [InlineData(LibraryType.GraphicNovel, true, 100)] // Written content. + [InlineData(LibraryType.AcademicPaper, true, 100)] // Written content. + [InlineData(LibraryType.SheetMusic, true, 100)] // Written content. + [InlineData(LibraryType.TvShow, true, 90)] // Video. + [InlineData(LibraryType.Movie, true, 90)] // Video. + [InlineData(LibraryType.Documentary, true, 90)] // Video. + [InlineData(LibraryType.Anime, true, 90)] // Video. + [InlineData(LibraryType.ConcertVideo, true, 90)] // Video. + [InlineData(LibraryType.TutorialVideo, true, 90)] // Video. + [InlineData(LibraryType.HomeVideo, true, 90)] // Video. + [InlineData(LibraryType.YouTubeVideo, true, 90)] // Video. + [InlineData(LibraryType.MusicVideo, true, 90)] // Video. + [InlineData(LibraryType.LiveRecordingVideo, true, 90)] // Video. + [InlineData(LibraryType.InterviewVideo, true, 90)] // Video. + [InlineData(LibraryType.CoverSongVideo, true, 90)] // Video. + [InlineData(LibraryType.Audiobook, true, 95)] // Audiobooks and podcasts. + [InlineData(LibraryType.PodcastAudio, true, 95)] // Audiobooks and podcasts. + [InlineData(LibraryType.PodcastVideo, true, 95)] // Audiobooks and podcasts. + [InlineData(LibraryType.Music, false, null)] // Music audio and photos. + [InlineData(LibraryType.Remix, false, null)] // Music audio and photos. + [InlineData(LibraryType.SoundEffect, false, null)] // Music audio and photos. + [InlineData(LibraryType.LiveRecordingAudio, false, null)] // Music audio and photos. + [InlineData(LibraryType.InterviewAudio, false, null)] // Music audio and photos. + [InlineData(LibraryType.CoverSongAudio, false, null)] // Music audio and photos. + [InlineData(LibraryType.Photo, false, null)] // Music audio and photos. + [InlineData(LibraryType.Playlist, false, null)] // Library types that are not media libraries. + [InlineData(LibraryType.Collection, false, null)] // Library types that are not media libraries. + [InlineData(LibraryType.Subtitles, false, null)] // Library types that are not media libraries. + [InlineData(LibraryType.Lyrics, false, null)] // Library types that are not media libraries. + [InlineData(LibraryType.Other, false, null)] // Library types that are not media libraries. public void CreateDefault_WhenLibraryTypeIsKnown_ShouldReturnTheTypeDefaults( LibraryType libraryType, bool expectedShouldTrackConsumptionProgress, @@ -244,15 +244,15 @@ public class LibraryConsumptionSettingsTests } [Theory] - [InlineData(MediaKind.None, false, null)] // no media kind - [InlineData(MediaKind.MusicTrack, false, null)] // music tracks - [InlineData(MediaKind.PodcastEpisode, true, 95)] // audiobooks and podcast episodes - [InlineData(MediaKind.Audiobook, true, 95)] // audiobooks and podcast episodes - [InlineData(MediaKind.Movie, true, 90)] // video - [InlineData(MediaKind.TvEpisode, true, 90)] // video - [InlineData(MediaKind.Book, true, 100)] // written content - [InlineData(MediaKind.Photo, false, null)] // photos - [InlineData(MediaKind.Video, true, 90)] // video + [InlineData(MediaKind.None, false, null)] // No media kind. + [InlineData(MediaKind.MusicTrack, false, null)] // Music tracks. + [InlineData(MediaKind.PodcastEpisode, true, 95)] // Audiobooks and podcast episodes. + [InlineData(MediaKind.Audiobook, true, 95)] // Audiobooks and podcast episodes. + [InlineData(MediaKind.Movie, true, 90)] // Video. + [InlineData(MediaKind.TvEpisode, true, 90)] // Video. + [InlineData(MediaKind.Book, true, 100)] // Written content. + [InlineData(MediaKind.Photo, false, null)] // Photos. + [InlineData(MediaKind.Video, true, 90)] // Video. public void CreateDefault_WhenMediaKindIsKnown_ShouldReturnTheKindDefaults( MediaKind mediaKind, bool expectedShouldTrackConsumptionProgress, diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryPathPartTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryPathPartTests.cs index 0617d1bd..38a66eca 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryPathPartTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryAggregate/ValueObjects/LibraryPathPartTests.cs @@ -41,9 +41,9 @@ public class LibraryPathPartTests } [Theory] - [InlineData(null)] // the representation is absent - [InlineData("")] // the representation is empty - [InlineData(" ")] // the representation is whitespace + [InlineData(null)] // The representation is absent. + [InlineData("")] // The representation is empty. + [InlineData(" ")] // The representation is whitespace. public void Create_WhenKindIsNotSeparatorAndRepresentationIsEmpty_ShouldReturnLiteralCannotBeEmptyError(string? representation) { // Act @@ -78,8 +78,8 @@ public class LibraryPathPartTests } [Theory] - [InlineData("no placeholder")] // the mask carries no value placeholder - [InlineData("{0} {0}")] // the mask carries more than one value placeholder + [InlineData("no placeholder")] // The mask carries no value placeholder. + [InlineData("{0} {0}")] // The mask carries more than one value placeholder. public void Create_WhenTypedPartDoesNotContainExactlyOnePlaceholder_ShouldReturnError(string representation) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Services/PathTemplate/LibraryPathTemplateServiceTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Services/PathTemplate/LibraryPathTemplateServiceTests.cs index 4e125f6a..ca9392e9 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Services/PathTemplate/LibraryPathTemplateServiceTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/Services/PathTemplate/LibraryPathTemplateServiceTests.cs @@ -219,8 +219,8 @@ public class LibraryPathTemplateServiceTests } [Theory] - [InlineData("")] // the relative path is empty - [InlineData(" ")] // the relative path is whitespace + [InlineData("")] // The relative path is empty. + [InlineData(" ")] // The relative path is whitespace. public void Parse_WhenRelativePathIsEmpty_ShouldReturnNull(string relativePath) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/ValueObjects/MediaLibraryScanJobProgressTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/ValueObjects/MediaLibraryScanJobProgressTests.cs index e9abdbf2..598132f5 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/ValueObjects/MediaLibraryScanJobProgressTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/LibraryManagementBoundedContext/LibraryScanAggregate/ValueObjects/MediaLibraryScanJobProgressTests.cs @@ -76,9 +76,9 @@ public class MediaLibraryScanJobProgressTests } [Theory] - [InlineData(null)] // null current operation - [InlineData("")] // empty current operation - [InlineData(" ")] // whitespace current operation + [InlineData(null)] // Null current operation. + [InlineData("")] // Empty current operation. + [InlineData(" ")] // Whitespace current operation. public void Create_WhenCurrentOperationIsEmpty_ShouldReturnError(string? currentOperation) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/EverySessionConsumptionRuleTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/EverySessionConsumptionRuleTests.cs index 0307024e..6eeeeb19 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/EverySessionConsumptionRuleTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/EverySessionConsumptionRuleTests.cs @@ -27,9 +27,9 @@ public class EverySessionConsumptionRuleTests } [Theory] - [InlineData(ConsumptionStatus.InProgress)] // a session that is still running - [InlineData(ConsumptionStatus.Completed)] // a session that reached its completion - [InlineData(ConsumptionStatus.Stopped)] // a session that ended before completion + [InlineData(ConsumptionStatus.InProgress)] // A session that is still running. + [InlineData(ConsumptionStatus.Completed)] // A session that reached its completion. + [InlineData(ConsumptionStatus.Stopped)] // A session that ended before completion. public void Counts_WhenSessionHasZeroDurationAndZeroPages_ShouldReturnTrue(ConsumptionStatus status) { // Act @@ -40,9 +40,9 @@ public class EverySessionConsumptionRuleTests } [Theory] - [InlineData(ConsumptionStatus.InProgress)] // a session that is still running - [InlineData(ConsumptionStatus.Completed)] // a session that reached its completion - [InlineData(ConsumptionStatus.Stopped)] // a session that ended before completion + [InlineData(ConsumptionStatus.InProgress)] // A session that is still running. + [InlineData(ConsumptionStatus.Completed)] // A session that reached its completion. + [InlineData(ConsumptionStatus.Stopped)] // A session that ended before completion. public void Counts_WhenSessionHasLargeDurationAndLargePageCount_ShouldReturnTrue(ConsumptionStatus status) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/MediaConsumptionRuleTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/MediaConsumptionRuleTests.cs index cbcf6a30..3a9137f9 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/MediaConsumptionRuleTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/MediaConsumptionRuleTests.cs @@ -17,14 +17,14 @@ namespace Lumina.Domain.UnitTests.Core.BoundedContexts.MediaConsumptionBoundedCo public class MediaConsumptionRuleTests { [Theory] - [InlineData(MediaKind.MusicTrack, typeof(MusicTrackConsumptionRule))] // duration based rule of a music track - [InlineData(MediaKind.PodcastEpisode, typeof(PodcastEpisodeConsumptionRule))] // duration based rule of a podcast episode - [InlineData(MediaKind.Audiobook, typeof(AudiobookConsumptionRule))] // duration based rule of an audiobook - [InlineData(MediaKind.Movie, typeof(MovieConsumptionRule))] // duration based rule of a movie - [InlineData(MediaKind.TvEpisode, typeof(TvEpisodeConsumptionRule))] // duration based rule of a TV episode - [InlineData(MediaKind.Book, typeof(BookConsumptionRule))] // page based rule of a book - [InlineData(MediaKind.Photo, typeof(PhotoConsumptionRule))] // every session rule of a photo - [InlineData(MediaKind.Video, typeof(VideoConsumptionRule))] // duration based rule of a video + [InlineData(MediaKind.MusicTrack, typeof(MusicTrackConsumptionRule))] // Duration based rule of a music track. + [InlineData(MediaKind.PodcastEpisode, typeof(PodcastEpisodeConsumptionRule))] // Duration based rule of a podcast episode. + [InlineData(MediaKind.Audiobook, typeof(AudiobookConsumptionRule))] // Duration based rule of an audiobook. + [InlineData(MediaKind.Movie, typeof(MovieConsumptionRule))] // Duration based rule of a movie. + [InlineData(MediaKind.TvEpisode, typeof(TvEpisodeConsumptionRule))] // Duration based rule of a TV episode. + [InlineData(MediaKind.Book, typeof(BookConsumptionRule))] // Page based rule of a book. + [InlineData(MediaKind.Photo, typeof(PhotoConsumptionRule))] // Every session rule of a photo. + [InlineData(MediaKind.Video, typeof(VideoConsumptionRule))] // Duration based rule of a video. public void For_WhenMediaKindHasARule_ShouldReturnTheRuleOfThatKind(MediaKind mediaKind, Type expectedType) { // Act @@ -37,8 +37,8 @@ public class MediaConsumptionRuleTests } [Theory] - [InlineData(MediaKind.None)] // the default value, which is not a valid kind for a media item - [InlineData((MediaKind)999)] // a value outside the declared enumeration members + [InlineData(MediaKind.None)] // The default value, which is not a valid kind for a media item. + [InlineData((MediaKind)999)] // A value outside the declared enumeration members. public void For_WhenMediaKindHasNoRule_ShouldReturnNoValue(MediaKind mediaKind) { // Act @@ -63,8 +63,8 @@ public class MediaConsumptionRuleTests } [Theory] - [InlineData(MediaKind.Movie)] // a duration based rule that resumes from a time offset - [InlineData(MediaKind.Book)] // a page based rule that resumes from a location + [InlineData(MediaKind.Movie)] // A duration based rule that resumes from a time offset. + [InlineData(MediaKind.Book)] // A page based rule that resumes from a location. public void CanResume_WhenRuleHasAPositionKind_ShouldReturnTrue(MediaKind mediaKind) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/MediaPositionTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/MediaPositionTests.cs index 8d1e2a1c..5dcbc7e6 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/MediaPositionTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/Common/ValueObjects/MediaPositionTests.cs @@ -59,7 +59,7 @@ public class MediaPositionTests MediaPosition position = MediaPosition.CreateTimeOffset(negativeTimeOffset); // Assert - // the value object does not validate the sign of the offset, the reported value is stored as given + // The value object does not validate the sign of the offset, the reported value is stored as given. Assert.Equal(TimeSpan.FromMinutes(-1), position.TimeOffset.Value); } @@ -70,7 +70,7 @@ public class MediaPositionTests MediaPosition position = MediaPosition.CreateLocation(string.Empty); // Assert - // the value object does not validate the content of the location, the reported value is stored as given + // The value object does not validate the content of the location, the reported value is stored as given. Assert.True(position.Location.HasValue); Assert.Equal(string.Empty, position.Location.Value); } diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/MediaConsumptionRecordAggregate/MediaConsumptionRecordTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/MediaConsumptionRecordAggregate/MediaConsumptionRecordTests.cs index 5ec2688f..d5a89237 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/MediaConsumptionRecordAggregate/MediaConsumptionRecordTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/MediaConsumptionRecordAggregate/MediaConsumptionRecordTests.cs @@ -111,8 +111,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.None)] // the default value, which is not a valid kind for a media item - [InlineData((MediaKind)999)] // a value outside the declared enumeration members + [InlineData(MediaKind.None)] // The default value, which is not a valid kind for a media item. + [InlineData((MediaKind)999)] // A value outside the declared enumeration members. public void Start_WhenMediaKindIsUnsupported_ShouldReturnUnsupportedMediaKindError(MediaKind mediaKind) { // Act @@ -130,11 +130,11 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(double.NaN)] // a value that is not a number - [InlineData(double.PositiveInfinity)] // a value beyond every finite fraction - [InlineData(double.NegativeInfinity)] // a value below every finite fraction - [InlineData(-0.01)] // a value below the zero lower boundary - [InlineData(1.01)] // a value above the one upper boundary + [InlineData(double.NaN)] // A value that is not a number. + [InlineData(double.PositiveInfinity)] // A value beyond every finite fraction. + [InlineData(double.NegativeInfinity)] // A value below every finite fraction. + [InlineData(-0.01)] // A value below the zero lower boundary. + [InlineData(1.01)] // A value above the one upper boundary. public void Start_WhenProgressFractionIsInvalid_ShouldReturnInvalidProgressFractionError(double lastProgressFraction) { // Act @@ -152,8 +152,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(0.0)] // the lower boundary of the progress fraction - [InlineData(1.0)] // the upper boundary of the progress fraction + [InlineData(0.0)] // The lower boundary of the progress fraction. + [InlineData(1.0)] // The upper boundary of the progress fraction. public void Start_WhenProgressFractionIsAtABoundary_ShouldCreateRecord(double lastProgressFraction) { // Act @@ -171,9 +171,9 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // a movie resumes from a time offset, not from a location - [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // a book resumes from a location, not from a time offset - [InlineData(MediaKind.Photo, MediaPositionKind.TimeOffset)] // a photo cannot be resumed, so it accepts no position at all + [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // A movie resumes from a time offset, not from a location. + [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // A book resumes from a location, not from a time offset. + [InlineData(MediaKind.Photo, MediaPositionKind.TimeOffset)] // A photo cannot be resumed, so it accepts no position at all. public void Start_WhenPositionDoesNotMatchTheMediaKindRule_ShouldReturnInvalidMediaPositionError(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange @@ -194,8 +194,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.TimeOffset)] // a movie resumes from a time offset - [InlineData(MediaKind.Book, MediaPositionKind.Location)] // a book resumes from a location + [InlineData(MediaKind.Movie, MediaPositionKind.TimeOffset)] // A movie resumes from a time offset. + [InlineData(MediaKind.Book, MediaPositionKind.Location)] // A book resumes from a location. public void Start_WhenPositionMatchesTheMediaKindRule_ShouldStoreThePosition(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange @@ -284,13 +284,13 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.MusicTrack)] // a duration based kind that is started explicitly - [InlineData(MediaKind.PodcastEpisode)] // a duration based kind that is started explicitly - [InlineData(MediaKind.Audiobook)] // a duration based kind that is started explicitly - [InlineData(MediaKind.Movie)] // a duration based kind that is started explicitly - [InlineData(MediaKind.TvEpisode)] // a duration based kind that is started explicitly - [InlineData(MediaKind.Book)] // a page based kind that is started explicitly - [InlineData(MediaKind.Video)] // a duration based kind that is started explicitly + [InlineData(MediaKind.MusicTrack)] // A duration based kind that is started explicitly. + [InlineData(MediaKind.PodcastEpisode)] // A duration based kind that is started explicitly. + [InlineData(MediaKind.Audiobook)] // A duration based kind that is started explicitly. + [InlineData(MediaKind.Movie)] // A duration based kind that is started explicitly. + [InlineData(MediaKind.TvEpisode)] // A duration based kind that is started explicitly. + [InlineData(MediaKind.Book)] // A page based kind that is started explicitly. + [InlineData(MediaKind.Video)] // A duration based kind that is started explicitly. public void StartCompleted_WhenMediaKindIsNotOneShot_ShouldReturnMediaKindCannotStartCompletedError(MediaKind mediaKind) { // Act @@ -306,8 +306,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.None)] // the default value, which is not a valid kind for a media item - [InlineData((MediaKind)999)] // a value outside the declared enumeration members + [InlineData(MediaKind.None)] // The default value, which is not a valid kind for a media item. + [InlineData((MediaKind)999)] // A value outside the declared enumeration members. public void StartCompleted_WhenMediaKindIsUnsupported_ShouldReturnUnsupportedMediaKindError(MediaKind mediaKind) { // Act @@ -374,8 +374,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(ConsumptionStatus.Completed)] // a session that reached its completion - [InlineData(ConsumptionStatus.Stopped)] // a session that ended before completing + [InlineData(ConsumptionStatus.Completed)] // A session that reached its completion. + [InlineData(ConsumptionStatus.Stopped)] // A session that ended before completing. public void Reconstitute_WhenCalledWithTerminalData_ShouldPreserveAllPropertiesAndDeriveTimestamps(ConsumptionStatus status) { // Arrange @@ -448,8 +448,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.None)] // the default value, which is not a valid kind for a media item - [InlineData((MediaKind)999)] // a value outside the declared enumeration members + [InlineData(MediaKind.None)] // The default value, which is not a valid kind for a media item. + [InlineData((MediaKind)999)] // A value outside the declared enumeration members. public void Reconstitute_WhenMediaKindIsUnsupported_ShouldReturnUnsupportedMediaKindError(MediaKind mediaKind) { // Arrange @@ -477,11 +477,11 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(double.NaN)] // a value that is not a number - [InlineData(double.PositiveInfinity)] // a value beyond every finite fraction - [InlineData(double.NegativeInfinity)] // a value below every finite fraction - [InlineData(-0.01)] // a value below the zero lower boundary - [InlineData(1.01)] // a value above the one upper boundary + [InlineData(double.NaN)] // A value that is not a number. + [InlineData(double.PositiveInfinity)] // A value beyond every finite fraction. + [InlineData(double.NegativeInfinity)] // A value below every finite fraction. + [InlineData(-0.01)] // A value below the zero lower boundary. + [InlineData(1.01)] // A value above the one upper boundary. public void Reconstitute_WhenProgressFractionIsInvalid_ShouldReturnInvalidProgressFractionError(double lastProgressFraction) { // Arrange @@ -509,9 +509,9 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.Movie)] // a duration based kind does not count pages - [InlineData(MediaKind.Photo)] // a one-shot kind does not count pages - [InlineData(MediaKind.MusicTrack)] // a duration based kind does not count pages + [InlineData(MediaKind.Movie)] // A duration based kind does not count pages. + [InlineData(MediaKind.Photo)] // A one-shot kind does not count pages. + [InlineData(MediaKind.MusicTrack)] // A duration based kind does not count pages. public void Reconstitute_WhenConsecutivePagesReadIsPositiveForANonPageBasedKind_ShouldReturnConsecutivePagesReadIsOnlySupportedForPageBasedMediaError(MediaKind mediaKind) { // Arrange @@ -572,8 +572,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.Movie)] // a duration based kind accepts a zero page count - [InlineData(MediaKind.Photo)] // a one-shot kind accepts a zero page count + [InlineData(MediaKind.Movie)] // A duration based kind accepts a zero page count. + [InlineData(MediaKind.Photo)] // A one-shot kind accepts a zero page count. public void Reconstitute_WhenConsecutivePagesReadIsZeroForANonPageBasedKind_ShouldCreateRecord(MediaKind mediaKind) { // Arrange @@ -604,9 +604,9 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // a movie resumes from a time offset, not from a location - [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // a book resumes from a location, not from a time offset - [InlineData(MediaKind.Photo, MediaPositionKind.Location)] // a photo cannot be resumed, so it accepts no position at all + [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // A movie resumes from a time offset, not from a location. + [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // A book resumes from a location, not from a time offset. + [InlineData(MediaKind.Photo, MediaPositionKind.Location)] // A photo cannot be resumed, so it accepts no position at all. public void Reconstitute_WhenPositionDoesNotMatchTheMediaKindRule_ShouldReturnInvalidMediaPositionError(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange @@ -667,8 +667,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(ConsumptionStatus.Completed)] // a completed session must record when it ended - [InlineData(ConsumptionStatus.Stopped)] // a stopped session must record when it ended + [InlineData(ConsumptionStatus.Completed)] // A completed session must record when it ended. + [InlineData(ConsumptionStatus.Stopped)] // A stopped session must record when it ended. public void Reconstitute_WhenTerminalStatusHasNoEndTime_ShouldReturnEndedConsumptionMustHaveEndTimeError(ConsumptionStatus status) { // Arrange @@ -727,8 +727,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(ConsumptionStatus.Completed)] // a completed session cannot end before its last activity - [InlineData(ConsumptionStatus.Stopped)] // a stopped session cannot end before its last activity + [InlineData(ConsumptionStatus.Completed)] // A completed session cannot end before its last activity. + [InlineData(ConsumptionStatus.Stopped)] // A stopped session cannot end before its last activity. public void Reconstitute_WhenEndTimePrecedesLastActivity_ShouldReturnEndedConsumptionCannotPrecedeLastActivityError(ConsumptionStatus status) { // Arrange @@ -758,8 +758,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(ConsumptionStatus.Completed)] // a completed session may end exactly at its last activity - [InlineData(ConsumptionStatus.Stopped)] // a stopped session may end exactly at its last activity + [InlineData(ConsumptionStatus.Completed)] // A completed session may end exactly at its last activity. + [InlineData(ConsumptionStatus.Stopped)] // A stopped session may end exactly at its last activity. public void Reconstitute_WhenEndTimeEqualsLastActivity_ShouldCreateRecord(ConsumptionStatus status) { // Arrange @@ -852,8 +852,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(ConsumptionStatus.Completed)] // a completed session accepted no further progress - [InlineData(ConsumptionStatus.Stopped)] // a stopped session accepted no further progress + [InlineData(ConsumptionStatus.Completed)] // A completed session accepted no further progress. + [InlineData(ConsumptionStatus.Stopped)] // A stopped session accepted no further progress. public void ReportProgress_WhenStatusIsNotInProgress_ShouldReturnConsumptionIsNotInProgressError(ConsumptionStatus status) { // Arrange @@ -885,11 +885,11 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(double.NaN)] // a value that is not a number - [InlineData(double.PositiveInfinity)] // a value beyond every finite fraction - [InlineData(double.NegativeInfinity)] // a value below every finite fraction - [InlineData(-0.01)] // a value below the zero lower boundary - [InlineData(1.01)] // a value above the one upper boundary + [InlineData(double.NaN)] // A value that is not a number. + [InlineData(double.PositiveInfinity)] // A value beyond every finite fraction. + [InlineData(double.NegativeInfinity)] // A value below every finite fraction. + [InlineData(-0.01)] // A value below the zero lower boundary. + [InlineData(1.01)] // A value above the one upper boundary. public void ReportProgress_WhenProgressFractionIsInvalid_ShouldReturnInvalidProgressFractionError(double lastProgressFraction) { // Arrange @@ -943,8 +943,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.Movie)] // a duration based kind does not count pages - [InlineData(MediaKind.Photo)] // a one-shot kind does not count pages + [InlineData(MediaKind.Movie)] // A duration based kind does not count pages. + [InlineData(MediaKind.Photo)] // A one-shot kind does not count pages. public void ReportProgress_WhenConsecutivePagesReadIsPositiveForANonPageBasedKind_ShouldReturnConsecutivePagesReadIsOnlySupportedForPageBasedMediaError(MediaKind mediaKind) { // Arrange @@ -987,9 +987,9 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // a movie resumes from a time offset, not from a location - [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // a book resumes from a location, not from a time offset - [InlineData(MediaKind.Photo, MediaPositionKind.TimeOffset)] // a photo cannot be resumed, so it accepts no position at all + [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // A movie resumes from a time offset, not from a location. + [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // A book resumes from a location, not from a time offset. + [InlineData(MediaKind.Photo, MediaPositionKind.TimeOffset)] // A photo cannot be resumed, so it accepts no position at all. public void ReportProgress_WhenPositionDoesNotMatchTheMediaKindRule_ShouldReturnInvalidMediaPositionError(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange @@ -1219,8 +1219,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.Movie)] // a duration based kind does not count pages - [InlineData(MediaKind.Photo)] // a one-shot kind does not count pages + [InlineData(MediaKind.Movie)] // A duration based kind does not count pages. + [InlineData(MediaKind.Photo)] // A one-shot kind does not count pages. public void Complete_WhenConsecutivePagesReadIsPositiveForANonPageBasedKind_ShouldReturnConsecutivePagesReadIsOnlySupportedForPageBasedMediaError(MediaKind mediaKind) { // Arrange @@ -1242,8 +1242,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(ConsumptionStatus.Completed)] // an already completed session cannot complete again - [InlineData(ConsumptionStatus.Stopped)] // an already stopped session cannot complete + [InlineData(ConsumptionStatus.Completed)] // An already completed session cannot complete again. + [InlineData(ConsumptionStatus.Stopped)] // An already stopped session cannot complete. public void Complete_WhenStatusIsTerminal_ShouldReturnConsumptionIsAlreadyTerminalError(ConsumptionStatus status) { // Arrange @@ -1271,11 +1271,11 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(double.NaN)] // a value that is not a number - [InlineData(double.PositiveInfinity)] // a value beyond every finite fraction - [InlineData(double.NegativeInfinity)] // a value below every finite fraction - [InlineData(-0.01)] // a value below the zero lower boundary - [InlineData(1.01)] // a value above the one upper boundary + [InlineData(double.NaN)] // A value that is not a number. + [InlineData(double.PositiveInfinity)] // A value beyond every finite fraction. + [InlineData(double.NegativeInfinity)] // A value below every finite fraction. + [InlineData(-0.01)] // A value below the zero lower boundary. + [InlineData(1.01)] // A value above the one upper boundary. public void Complete_WhenProgressFractionIsInvalid_ShouldReturnInvalidProgressFractionError(double lastProgressFraction) { // Arrange @@ -1330,9 +1330,9 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // a movie resumes from a time offset, not from a location - [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // a book resumes from a location, not from a time offset - [InlineData(MediaKind.Photo, MediaPositionKind.Location)] // a photo cannot be resumed, so it accepts no position at all + [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // A movie resumes from a time offset, not from a location. + [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // A book resumes from a location, not from a time offset. + [InlineData(MediaKind.Photo, MediaPositionKind.Location)] // A photo cannot be resumed, so it accepts no position at all. public void Complete_WhenPositionDoesNotMatchTheMediaKindRule_ShouldReturnInvalidMediaPositionError(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange @@ -1512,8 +1512,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.Movie)] // a duration based kind does not count pages - [InlineData(MediaKind.Photo)] // a one-shot kind does not count pages + [InlineData(MediaKind.Movie)] // A duration based kind does not count pages. + [InlineData(MediaKind.Photo)] // A one-shot kind does not count pages. public void Stop_WhenConsecutivePagesReadIsPositiveForANonPageBasedKind_ShouldReturnConsecutivePagesReadIsOnlySupportedForPageBasedMediaError(MediaKind mediaKind) { // Arrange @@ -1535,8 +1535,8 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(ConsumptionStatus.Completed)] // an already completed session cannot stop - [InlineData(ConsumptionStatus.Stopped)] // an already stopped session cannot stop again + [InlineData(ConsumptionStatus.Completed)] // An already completed session cannot stop. + [InlineData(ConsumptionStatus.Stopped)] // An already stopped session cannot stop again. public void Stop_WhenStatusIsTerminal_ShouldReturnConsumptionIsAlreadyTerminalError(ConsumptionStatus status) { // Arrange @@ -1564,11 +1564,11 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(double.NaN)] // a value that is not a number - [InlineData(double.PositiveInfinity)] // a value beyond every finite fraction - [InlineData(double.NegativeInfinity)] // a value below every finite fraction - [InlineData(-0.01)] // a value below the zero lower boundary - [InlineData(1.01)] // a value above the one upper boundary + [InlineData(double.NaN)] // A value that is not a number. + [InlineData(double.PositiveInfinity)] // A value beyond every finite fraction. + [InlineData(double.NegativeInfinity)] // A value below every finite fraction. + [InlineData(-0.01)] // A value below the zero lower boundary. + [InlineData(1.01)] // A value above the one upper boundary. public void Stop_WhenProgressFractionIsInvalid_ShouldReturnInvalidProgressFractionError(double lastProgressFraction) { // Arrange @@ -1623,9 +1623,9 @@ public class MediaConsumptionRecordTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // a movie resumes from a time offset, not from a location - [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // a book resumes from a location, not from a time offset - [InlineData(MediaKind.Photo, MediaPositionKind.Location)] // a photo cannot be resumed, so it accepts no position at all + [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // A movie resumes from a time offset, not from a location. + [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // A book resumes from a location, not from a time offset. + [InlineData(MediaKind.Photo, MediaPositionKind.Location)] // A photo cannot be resumed, so it accepts no position at all. public void Stop_WhenPositionDoesNotMatchTheMediaKindRule_ShouldReturnInvalidMediaPositionError(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/MediaResumePointAggregate/MediaResumePointTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/MediaResumePointAggregate/MediaResumePointTests.cs index 1812a6da..605d52da 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/MediaResumePointAggregate/MediaResumePointTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaConsumptionBoundedContext/MediaResumePointAggregate/MediaResumePointTests.cs @@ -103,8 +103,8 @@ public class MediaResumePointTests } [Theory] - [InlineData(MediaKind.None)] // the default value, which is not a valid kind for a media item - [InlineData((MediaKind)999)] // a value outside the declared enumeration members + [InlineData(MediaKind.None)] // The default value, which is not a valid kind for a media item. + [InlineData((MediaKind)999)] // A value outside the declared enumeration members. public void Create_WhenMediaKindIsUnsupported_ShouldReturnUnsupportedMediaKindError(MediaKind mediaKind) { // Arrange @@ -168,11 +168,11 @@ public class MediaResumePointTests } [Theory] - [InlineData(double.NaN)] // a value that is not a number - [InlineData(double.PositiveInfinity)] // a value beyond every finite fraction - [InlineData(double.NegativeInfinity)] // a value below every finite fraction - [InlineData(-0.01)] // a value below the zero lower boundary - [InlineData(1.01)] // a value above the one upper boundary + [InlineData(double.NaN)] // A value that is not a number. + [InlineData(double.PositiveInfinity)] // A value beyond every finite fraction. + [InlineData(double.NegativeInfinity)] // A value below every finite fraction. + [InlineData(-0.01)] // A value below the zero lower boundary. + [InlineData(1.01)] // A value above the one upper boundary. public void Create_WhenProgressFractionIsInvalid_ShouldReturnInvalidProgressFractionError(double lastProgressFraction) { // Arrange @@ -194,8 +194,8 @@ public class MediaResumePointTests } [Theory] - [InlineData(0.0)] // the lower boundary of the progress fraction - [InlineData(1.0)] // the upper boundary of the progress fraction + [InlineData(0.0)] // The lower boundary of the progress fraction. + [InlineData(1.0)] // The upper boundary of the progress fraction. public void Create_WhenProgressFractionIsAtABoundary_ShouldCreateResumePoint(double lastProgressFraction) { // Arrange @@ -217,8 +217,8 @@ public class MediaResumePointTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // a movie resumes from a time offset, not from a location - [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // a book resumes from a location, not from a time offset + [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // A movie resumes from a time offset, not from a location. + [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // A book resumes from a location, not from a time offset. public void Create_WhenPositionDoesNotMatchTheMediaKindRule_ShouldReturnInvalidMediaPositionError(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange @@ -240,8 +240,8 @@ public class MediaResumePointTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.TimeOffset)] // a movie resumes from a time offset - [InlineData(MediaKind.Book, MediaPositionKind.Location)] // a book resumes from a location + [InlineData(MediaKind.Movie, MediaPositionKind.TimeOffset)] // A movie resumes from a time offset. + [InlineData(MediaKind.Book, MediaPositionKind.Location)] // A book resumes from a location. public void Create_WhenPositionMatchesTheMediaKindRule_ShouldStoreThePosition(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange @@ -336,8 +336,8 @@ public class MediaResumePointTests } [Theory] - [InlineData(MediaKind.None)] // the default value, which is not a valid kind for a media item - [InlineData((MediaKind)999)] // a value outside the declared enumeration members + [InlineData(MediaKind.None)] // The default value, which is not a valid kind for a media item. + [InlineData((MediaKind)999)] // A value outside the declared enumeration members. public void Reconstitute_WhenMediaKindIsUnsupported_ShouldReturnUnsupportedMediaKindError(MediaKind mediaKind) { // Arrange @@ -386,11 +386,11 @@ public class MediaResumePointTests } [Theory] - [InlineData(double.NaN)] // a value that is not a number - [InlineData(double.PositiveInfinity)] // a value beyond every finite fraction - [InlineData(double.NegativeInfinity)] // a value below every finite fraction - [InlineData(-0.01)] // a value below the zero lower boundary - [InlineData(1.01)] // a value above the one upper boundary + [InlineData(double.NaN)] // A value that is not a number. + [InlineData(double.PositiveInfinity)] // A value beyond every finite fraction. + [InlineData(double.NegativeInfinity)] // A value below every finite fraction. + [InlineData(-0.01)] // A value below the zero lower boundary. + [InlineData(1.01)] // A value above the one upper boundary. public void Reconstitute_WhenProgressFractionIsInvalid_ShouldReturnInvalidProgressFractionError(double lastProgressFraction) { // Arrange @@ -415,8 +415,8 @@ public class MediaResumePointTests } [Theory] - [InlineData(0.0)] // the lower boundary of the progress fraction - [InlineData(1.0)] // the upper boundary of the progress fraction + [InlineData(0.0)] // The lower boundary of the progress fraction. + [InlineData(1.0)] // The upper boundary of the progress fraction. public void Reconstitute_WhenProgressFractionIsAtABoundary_ShouldReconstituteResumePoint(double lastProgressFraction) { // Arrange @@ -441,8 +441,8 @@ public class MediaResumePointTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // a movie resumes from a time offset, not from a location - [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // a book resumes from a location, not from a time offset + [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // A movie resumes from a time offset, not from a location. + [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // A book resumes from a location, not from a time offset. public void Reconstitute_WhenPositionDoesNotMatchTheMediaKindRule_ShouldReturnInvalidMediaPositionError(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange @@ -467,8 +467,8 @@ public class MediaResumePointTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.TimeOffset)] // a movie resumes from a time offset - [InlineData(MediaKind.Book, MediaPositionKind.Location)] // a book resumes from a location + [InlineData(MediaKind.Movie, MediaPositionKind.TimeOffset)] // A movie resumes from a time offset. + [InlineData(MediaKind.Book, MediaPositionKind.Location)] // A book resumes from a location. public void Reconstitute_WhenPositionMatchesTheMediaKindRule_ShouldStoreThePosition(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange @@ -493,8 +493,8 @@ public class MediaResumePointTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.TimeOffset)] // a movie resumes from a time offset - [InlineData(MediaKind.Book, MediaPositionKind.Location)] // a book resumes from a location + [InlineData(MediaKind.Movie, MediaPositionKind.TimeOffset)] // A movie resumes from a time offset. + [InlineData(MediaKind.Book, MediaPositionKind.Location)] // A book resumes from a location. public void Advance_WhenCalledWithAValidPosition_ShouldReplaceTheResumePointState(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange @@ -525,8 +525,8 @@ public class MediaResumePointTests } [Theory] - [InlineData(0.0)] // the lower boundary of the progress fraction - [InlineData(1.0)] // the upper boundary of the progress fraction + [InlineData(0.0)] // The lower boundary of the progress fraction. + [InlineData(1.0)] // The upper boundary of the progress fraction. public void Advance_WhenProgressFractionIsAtABoundary_ShouldAdvanceResumePoint(double progressFraction) { // Arrange @@ -549,11 +549,11 @@ public class MediaResumePointTests } [Theory] - [InlineData(double.NaN)] // a value that is not a number - [InlineData(double.PositiveInfinity)] // a value beyond every finite fraction - [InlineData(double.NegativeInfinity)] // a value below every finite fraction - [InlineData(-0.01)] // a value below the zero lower boundary - [InlineData(1.01)] // a value above the one upper boundary + [InlineData(double.NaN)] // A value that is not a number. + [InlineData(double.PositiveInfinity)] // A value beyond every finite fraction. + [InlineData(double.NegativeInfinity)] // A value below every finite fraction. + [InlineData(-0.01)] // A value below the zero lower boundary. + [InlineData(1.01)] // A value above the one upper boundary. public void Advance_WhenProgressFractionIsInvalid_ShouldReturnInvalidProgressFractionErrorAndLeaveTheResumePointUnchanged(double progressFraction) { // Arrange @@ -586,8 +586,8 @@ public class MediaResumePointTests } [Theory] - [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // a movie resumes from a time offset, not from a location - [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // a book resumes from a location, not from a time offset + [InlineData(MediaKind.Movie, MediaPositionKind.Location)] // A movie resumes from a time offset, not from a location. + [InlineData(MediaKind.Book, MediaPositionKind.TimeOffset)] // A book resumes from a location, not from a time offset. public void Advance_WhenPositionDoesNotMatchTheMediaKindRule_ShouldReturnInvalidMediaPositionErrorAndLeaveTheResumePointUnchanged(MediaKind mediaKind, MediaPositionKind positionKind) { // Arrange diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/MediaContributorTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/MediaContributorTests.cs index fee2fb0e..44d8a18a 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/MediaContributorTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/MediaContributorTests.cs @@ -89,7 +89,7 @@ public class MediaContributorTests Type contributorType = contributor.GetType(); // Assert - // the contributor is a person, agnostic of the roles it played in the media items, so it must not expose a role + // The contributor is a person, agnostic of the roles it played in the media items, so it must not expose a role. Assert.Null(contributorType.GetProperty("Role")); } } diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/ValueObjects/MediaContributorNameTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/ValueObjects/MediaContributorNameTests.cs index c1777268..92481bbc 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/ValueObjects/MediaContributorNameTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/MediaContributorBoundedContext/MediaContributorAggregate/ValueObjects/MediaContributorNameTests.cs @@ -42,9 +42,9 @@ public class MediaContributorNameTests } [Theory] - [InlineData(null)] // null display name - [InlineData("")] // empty display name - [InlineData(" ")] // whitespace display name + [InlineData(null)] // Null display name. + [InlineData("")] // Empty display name. + [InlineData(" ")] // Whitespace display name. public void Create_WhenDisplayNameIsNullOrWhitespace_ShouldReturnError(string? displayName) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/PlaylistBoundedContext/PlaylistAggregate/Entities/PlaylistEntryTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/PlaylistBoundedContext/PlaylistAggregate/Entities/PlaylistEntryTests.cs index ca5c959c..b118df8d 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/PlaylistBoundedContext/PlaylistAggregate/Entities/PlaylistEntryTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/PlaylistBoundedContext/PlaylistAggregate/Entities/PlaylistEntryTests.cs @@ -42,8 +42,8 @@ public class PlaylistEntryTests } [Theory] - [InlineData(PlaylistMediaItemType.MusicTrack)] // a track of a music library - [InlineData(PlaylistMediaItemType.VideoFile)] // a video file, kept whatever the playlist that references it accepts today + [InlineData(PlaylistMediaItemType.MusicTrack)] // A track of a music library. + [InlineData(PlaylistMediaItemType.VideoFile)] // A video file, kept whatever the playlist that references it accepts today. public void Create_WhenCalled_ShouldPreserveTheMediaItemType(PlaylistMediaItemType mediaItemType) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/PlaylistBoundedContext/PlaylistAggregate/PlaylistTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/PlaylistBoundedContext/PlaylistAggregate/PlaylistTests.cs index 8cd08d6c..8b917502 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/PlaylistBoundedContext/PlaylistAggregate/PlaylistTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/PlaylistBoundedContext/PlaylistAggregate/PlaylistTests.cs @@ -155,8 +155,8 @@ public class PlaylistTests } [Theory] - [InlineData(PlaylistMediaItemType.VideoFile)] // a video file cannot belong to a music playlist - [InlineData((PlaylistMediaItemType)999)] // a value outside the declared enumeration members + [InlineData(PlaylistMediaItemType.VideoFile)] // A video file cannot belong to a music playlist. + [InlineData((PlaylistMediaItemType)999)] // A value outside the declared enumeration members. public void Create_WhenAnEntryReferencesAMediaItemTypeThePlaylistCannotContain_ShouldReturnPlaylistDoesNotAcceptMediaItems(PlaylistMediaItemType mediaItemType) { // Arrange @@ -354,13 +354,13 @@ public class PlaylistTests } [Theory] - [InlineData(PlaylistType.Music, PlaylistMediaItemType.MusicTrack, true)] // a music playlist accepts music tracks - [InlineData(PlaylistType.Music, PlaylistMediaItemType.VideoFile, false)] // a music playlist does not accept video files - [InlineData(PlaylistType.Music, (PlaylistMediaItemType)999, false)] // a value outside the declared enumeration members - [InlineData((PlaylistType)999, PlaylistMediaItemType.MusicTrack, false)] // a playlist type outside the declared enumeration members - [InlineData((PlaylistType)999, PlaylistMediaItemType.VideoFile, false)] // both sides outside the declared enumeration members - [InlineData((PlaylistType)(-1), PlaylistMediaItemType.MusicTrack, false)] // a playlist type below the declared enumeration members - [InlineData((PlaylistType)(-1), PlaylistMediaItemType.VideoFile, false)] // both sides below the declared enumeration members + [InlineData(PlaylistType.Music, PlaylistMediaItemType.MusicTrack, true)] // A music playlist accepts music tracks. + [InlineData(PlaylistType.Music, PlaylistMediaItemType.VideoFile, false)] // A music playlist does not accept video files. + [InlineData(PlaylistType.Music, (PlaylistMediaItemType)999, false)] // A value outside the declared enumeration members. + [InlineData((PlaylistType)999, PlaylistMediaItemType.MusicTrack, false)] // A playlist type outside the declared enumeration members. + [InlineData((PlaylistType)999, PlaylistMediaItemType.VideoFile, false)] // Both sides outside the declared enumeration members. + [InlineData((PlaylistType)(-1), PlaylistMediaItemType.MusicTrack, false)] // A playlist type below the declared enumeration members. + [InlineData((PlaylistType)(-1), PlaylistMediaItemType.VideoFile, false)] // Both sides below the declared enumeration members. public void CanContain_WhenCalled_ShouldOnlyAcceptMusicTracksForMusicPlaylists(PlaylistType playlistType, PlaylistMediaItemType mediaItemType, bool expectedCanContain) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ScheduledJobTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ScheduledJobTests.cs index fdb4b954..a2d893f8 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ScheduledJobTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ScheduledJobTests.cs @@ -65,9 +65,9 @@ public class ScheduledJobTests } [Theory] - [InlineData(null)] // null name - [InlineData("")] // empty name - [InlineData(" ")] // whitespace name + [InlineData(null)] // Null name. + [InlineData("")] // Empty name. + [InlineData(" ")] // Whitespace name. public void Create_WhenNameIsEmptyOrWhitespace_ShouldReturnError(string? name) { // Act @@ -124,9 +124,9 @@ public class ScheduledJobTests } [Theory] - [InlineData(ScheduledJobStatus.Active)] // cannot add an already active scheduled job - [InlineData(ScheduledJobStatus.Running)] // cannot add a running scheduled job - [InlineData(ScheduledJobStatus.Completed)] // cannot add a completed scheduled job + [InlineData(ScheduledJobStatus.Active)] // Cannot add an already active scheduled job. + [InlineData(ScheduledJobStatus.Running)] // Cannot add a running scheduled job. + [InlineData(ScheduledJobStatus.Completed)] // Cannot add a completed scheduled job. public void Add_WhenStatusIsNotAdded_ShouldReturnError(ScheduledJobStatus status) { // Arrange @@ -159,8 +159,8 @@ public class ScheduledJobTests } [Theory] - [InlineData(ScheduledJobStatus.Active)] // cannot start an already active execution cycle - [InlineData(ScheduledJobStatus.Running)] // cannot start a running execution cycle + [InlineData(ScheduledJobStatus.Active)] // Cannot start an already active execution cycle. + [InlineData(ScheduledJobStatus.Running)] // Cannot start a running execution cycle. public void StartCycle_WhenCycleAlreadyStarted_ShouldReturnError(ScheduledJobStatus status) { // Arrange @@ -217,8 +217,8 @@ public class ScheduledJobTests } [Theory] - [InlineData(ScheduledJobStatus.Added)] // cannot stop a cycle that was never started - [InlineData(ScheduledJobStatus.Completed)] // cannot stop a finished one time execution + [InlineData(ScheduledJobStatus.Added)] // Cannot stop a cycle that was never started. + [InlineData(ScheduledJobStatus.Completed)] // Cannot stop a finished one time execution. public void StopCycle_WhenCycleWasNeverStarted_ShouldReturnError(ScheduledJobStatus status) { // Arrange @@ -285,8 +285,8 @@ public class ScheduledJobTests } [Theory] - [InlineData(true)] // cycle run - [InlineData(false)] // one time run + [InlineData(true)] // Cycle run. + [InlineData(false)] // One time run. public void MarkExecutionStarted_WhenStatusIsNotRunning_ShouldTransitionToRunningAndRaiseExecutionStartedEvent(bool isCycleRun) { // Arrange @@ -326,8 +326,8 @@ public class ScheduledJobTests } [Theory] - [InlineData(true)] // a cycle run returns the scheduled job to its active status - [InlineData(false)] // a one time execution completes the scheduled job + [InlineData(true)] // A cycle run returns the scheduled job to its active status. + [InlineData(false)] // A one time execution completes the scheduled job. public void MarkExecutionCompleted_WhenStatusIsRunning_ShouldTransitionStatusAndRaiseExecutionCompletedEvent(bool isCycleRun) { // Arrange @@ -352,9 +352,9 @@ public class ScheduledJobTests } [Theory] - [InlineData(ScheduledJobStatus.Added)] // cannot complete an execution that never started - [InlineData(ScheduledJobStatus.Active)] // cannot complete an execution that never started - [InlineData(ScheduledJobStatus.Completed)] // cannot complete an already completed execution + [InlineData(ScheduledJobStatus.Added)] // Cannot complete an execution that never started. + [InlineData(ScheduledJobStatus.Active)] // Cannot complete an execution that never started. + [InlineData(ScheduledJobStatus.Completed)] // Cannot complete an already completed execution. public void MarkExecutionCompleted_WhenStatusIsNotRunning_ShouldReturnError(ScheduledJobStatus status) { // Arrange diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ValueObjects/DailyScheduleTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ValueObjects/DailyScheduleTests.cs index 3f50d8fe..5e5767f7 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ValueObjects/DailyScheduleTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ValueObjects/DailyScheduleTests.cs @@ -29,8 +29,8 @@ public class DailyScheduleTests } [Theory] - [InlineData(-1)] // hour below the allowed range - [InlineData(24)] // hour above the allowed range + [InlineData(-1)] // Hour below the allowed range. + [InlineData(24)] // Hour above the allowed range. public void Create_WhenHourIsOutOfRange_ShouldReturnError(int hour) { // Act @@ -42,8 +42,8 @@ public class DailyScheduleTests } [Theory] - [InlineData(-1)] // minute below the allowed range - [InlineData(60)] // minute above the allowed range + [InlineData(-1)] // Minute below the allowed range. + [InlineData(60)] // Minute above the allowed range. public void Create_WhenMinuteIsOutOfRange_ShouldReturnError(int minute) { // Act @@ -131,8 +131,8 @@ public class DailyScheduleTests } [Theory] - [InlineData(9, 30)] // different hour - [InlineData(8, 31)] // different minute + [InlineData(9, 30)] // Different hour. + [InlineData(8, 31)] // Different minute. public void Equals_WhenHourOrMinuteDiffer_ShouldReturnFalse(int hour, int minute) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ValueObjects/IntervalScheduleTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ValueObjects/IntervalScheduleTests.cs index c91a84f3..14cd4c3f 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ValueObjects/IntervalScheduleTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/SchedulingBoundedContext/ScheduledJobAggregate/ValueObjects/IntervalScheduleTests.cs @@ -28,9 +28,9 @@ public class IntervalScheduleTests } [Theory] - [InlineData(0)] // interval of zero - [InlineData(-1)] // negative interval - [InlineData(-100)] // negative interval far from zero + [InlineData(0)] // Interval of zero. + [InlineData(-1)] // Negative interval. + [InlineData(-100)] // Negative interval far from zero. public void Create_WhenIntervalIsNotPositive_ShouldReturnError(int intervalMinutes) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/BookTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/BookTests.cs index cb15846c..dfd93024 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/BookTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/BookTests.cs @@ -63,7 +63,7 @@ public class BookTests book.UpdateContributors([replacementContributor]); // Assert - // the previous contributors are replaced, not appended + // The previous contributors are replaced, not appended. BookMediaContributor contributor = Assert.Single(book.Contributors); Assert.Equal(replacementContributor, contributor); } @@ -169,7 +169,7 @@ public class BookTests [.. enrichedSource.Ratings]); // Assert - // the metadata and related fields are replaced with the enriched values + // The metadata and related fields are replaced with the enriched values. Assert.Equal(enrichedSource.Metadata, book.Metadata); Assert.Equal(enrichedSource.Format, book.Format); Assert.Equal(enrichedSource.Edition, book.Edition); @@ -233,7 +233,7 @@ public class BookTests [.. secondEnrichmentSource.Ratings]); // Assert - // the second enrichment replaces the first, it is not appended to it + // The second enrichment replaces the first, it is not appended to it. Assert.Equal(secondEnrichmentSource.ISBNs.Count, book.ISBNs.Count); Assert.Equal(secondEnrichmentSource.ISBNs, book.ISBNs); Assert.Equal(secondEnrichmentSource.Ratings, book.Ratings); @@ -253,7 +253,7 @@ public class BookTests bool hasCoverImagePath = bookType.GetProperty("CoverImagePath") is not null; // Assert - // the enrichment state is a persistence concern, tracked on the repository entity by the enrichment jobs + // The enrichment state is a persistence concern, tracked on the repository entity by the enrichment jobs. Assert.False(hasMetadataStatus); Assert.False(hasLastMetadataUpdateUtc); Assert.False(hasMetadataProvider); diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/BookRatingTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/BookRatingTests.cs index dd71cb90..66f4e029 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/BookRatingTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/BookRatingTests.cs @@ -38,8 +38,8 @@ public class BookRatingTests } [Theory] - [InlineData(-1)] // negative value - [InlineData(-0.5)] // negative fractional value + [InlineData(-1)] // Negative value. + [InlineData(-0.5)] // Negative fractional value. public void Create_WhenValueIsNegative_ShouldReturnError(double value) { // Act diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/IsbnTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/IsbnTests.cs index bd9cf7e2..d434a2ca 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/IsbnTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/WrittenContentLibraryBoundedContext/BookLibraryAggregate/ValueObjects/IsbnTests.cs @@ -42,9 +42,9 @@ public class IsbnTests } [Theory] - [InlineData(null)] // null ISBN value - [InlineData("")] // empty ISBN value - [InlineData(" ")] // whitespace ISBN value + [InlineData(null)] // Null ISBN value. + [InlineData("")] // Empty ISBN value. + [InlineData(" ")] // Whitespace ISBN value. public void Create_WhenValueIsNullOrWhitespace_ShouldReturnError(string? value) { // Act @@ -100,8 +100,8 @@ public class IsbnTests } [Theory] - [InlineData("0-306-40615-2")] // valid ISBN-10 with hyphens - [InlineData("0306406152")] // valid ISBN-10 without hyphens + [InlineData("0-306-40615-2")] // Valid ISBN-10 with hyphens. + [InlineData("0306406152")] // Valid ISBN-10 without hyphens. public void IsValidIsbn10_WhenValueIsValid_ShouldReturnTrue(string isbn) { // Act @@ -112,11 +112,11 @@ public class IsbnTests } [Theory] - [InlineData("0-306-40615-3")] // invalid check digit - [InlineData("030640615")] // too short - [InlineData("03064061523")] // too long - [InlineData("")] // empty value - [InlineData("ISBN 0-306-40615-2")] // ISBN prefix is not stripped by the checksum computation + [InlineData("0-306-40615-3")] // Invalid check digit. + [InlineData("030640615")] // Too short. + [InlineData("03064061523")] // Too long. + [InlineData("")] // Empty value. + [InlineData("ISBN 0-306-40615-2")] // ISBN prefix is not stripped by the checksum computation. public void IsValidIsbn10_WhenValueIsInvalid_ShouldReturnFalse(string isbn) { // Act @@ -127,9 +127,9 @@ public class IsbnTests } [Theory] - [InlineData("978-0-306-40615-7")] // valid ISBN-13 with hyphens - [InlineData("9780306406157")] // valid ISBN-13 without hyphens - [InlineData("979-0-306-40615-6")] // valid ISBN-13 with 979 prefix + [InlineData("978-0-306-40615-7")] // Valid ISBN-13 with hyphens. + [InlineData("9780306406157")] // Valid ISBN-13 without hyphens. + [InlineData("979-0-306-40615-6")] // Valid ISBN-13 with 979 prefix. public void IsValidIsbn13_WhenValueIsValid_ShouldReturnTrue(string isbn) { // Act @@ -140,11 +140,11 @@ public class IsbnTests } [Theory] - [InlineData("978-0-306-40615-8")] // invalid check digit - [InlineData("978030640615")] // too short - [InlineData("97803064061578")] // too long - [InlineData("")] // empty value - [InlineData("ISBN 978-0-306-40615-7")] // ISBN prefix is not stripped by the checksum computation + [InlineData("978-0-306-40615-8")] // Invalid check digit. + [InlineData("978030640615")] // Too short. + [InlineData("97803064061578")] // Too long. + [InlineData("")] // Empty value. + [InlineData("ISBN 978-0-306-40615-7")] // ISBN prefix is not stripped by the checksum computation. public void IsValidIsbn13_WhenValueIsInvalid_ShouldReturnFalse(string isbn) { // Act diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/DomainEvents/DomainEventPublisherTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/DomainEvents/DomainEventPublisherTests.cs index 77250d85..ac9c7934 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/DomainEvents/DomainEventPublisherTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/DomainEvents/DomainEventPublisherTests.cs @@ -102,7 +102,7 @@ public class DomainEventPublisherTests await publisher.PublishAsync(domainEvent, CancellationToken.None); // Assert - // reaching this point without an exception means the publish was a no-op, as expected + // Reaching this point without an exception means the publish was a no-op, as expected. } [Fact] diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Networking/PublicHostRedirectHandlerTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Networking/PublicHostRedirectHandlerTests.cs index 97aa0d77..1c95cd60 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Networking/PublicHostRedirectHandlerTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Networking/PublicHostRedirectHandlerTests.cs @@ -33,13 +33,13 @@ public class PublicHostRedirectHandlerTests } [Theory] - [InlineData("http://127.0.0.1/cover.jpg")] // the IPv4 loopback address - [InlineData("http://localhost/cover.jpg")] // the loopback host name - [InlineData("http://[::1]/cover.jpg")] // the IPv6 loopback address - [InlineData("http://169.254.169.254/latest/meta-data/")] // the link local cloud metadata endpoint - [InlineData("http://10.0.0.5/cover.jpg")] // a private class A address - [InlineData("http://172.16.0.1/cover.jpg")] // a private class B address - [InlineData("http://192.168.1.10/cover.jpg")] // a private class C address + [InlineData("http://127.0.0.1/cover.jpg")] // The IPv4 loopback address. + [InlineData("http://localhost/cover.jpg")] // The loopback host name. + [InlineData("http://[::1]/cover.jpg")] // The IPv6 loopback address. + [InlineData("http://169.254.169.254/latest/meta-data/")] // The link local cloud metadata endpoint. + [InlineData("http://10.0.0.5/cover.jpg")] // A private class A address. + [InlineData("http://172.16.0.1/cover.jpg")] // A private class B address. + [InlineData("http://192.168.1.10/cover.jpg")] // A private class C address. public async Task SendAsync_WhenTheInitialRequestHostIsPrivateOrLocal_ShouldThrowAndNotSendTheRequest(string url) { // Arrange @@ -83,12 +83,12 @@ public class PublicHostRedirectHandlerTests } [Theory] - [InlineData("http://archive.org/index.json")] // a downgrade of a trusted host to plain HTTP - [InlineData("https://127.0.0.1/index.json")] // the IPv4 loopback address - [InlineData("https://localhost/index.json")] // the loopback host name - [InlineData("https://169.254.169.254/latest/meta-data/")] // the link local cloud metadata endpoint - [InlineData("https://10.0.0.5/index.json")] // a private class A address - [InlineData("https://192.168.1.10/index.json")] // a private class C address + [InlineData("http://archive.org/index.json")] // A downgrade of a trusted host to plain HTTP. + [InlineData("https://127.0.0.1/index.json")] // The IPv4 loopback address. + [InlineData("https://localhost/index.json")] // The loopback host name. + [InlineData("https://169.254.169.254/latest/meta-data/")] // The link local cloud metadata endpoint. + [InlineData("https://10.0.0.5/index.json")] // A private class A address. + [InlineData("https://192.168.1.10/index.json")] // A private class C address. public async Task SendAsync_WhenTheInitialRequestRedirectsToADisallowedTarget_ShouldThrow(string location) { // Arrange diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Networking/PublicHostValidatorTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Networking/PublicHostValidatorTests.cs index 0d2e3097..a77fbf48 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Networking/PublicHostValidatorTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Networking/PublicHostValidatorTests.cs @@ -12,13 +12,13 @@ namespace Lumina.Infrastructure.UnitTests.Common.Networking; public class PublicHostValidatorTests { [Theory] - [InlineData("coverartarchive.org")] // a public host name - [InlineData("example.com")] // a public host name - [InlineData("8.8.8.8")] // a public IPv4 address - [InlineData("1.1.1.1")] // a public IPv4 address - [InlineData("172.15.0.1")] // the address just below the private class B range - [InlineData("172.32.0.1")] // the address just above the private class B range - [InlineData("2606:4700:4700::1111")] // a public IPv6 address + [InlineData("coverartarchive.org")] // A public host name. + [InlineData("example.com")] // A public host name. + [InlineData("8.8.8.8")] // A public IPv4 address. + [InlineData("1.1.1.1")] // A public IPv4 address. + [InlineData("172.15.0.1")] // The address just below the private class B range. + [InlineData("172.32.0.1")] // The address just above the private class B range. + [InlineData("2606:4700:4700::1111")] // A public IPv6 address. public void IsPublicHost_WhenTheHostIsPublic_ShouldReturnTrue(string host) { // Act @@ -29,24 +29,24 @@ public class PublicHostValidatorTests } [Theory] - [InlineData("")] // an empty host - [InlineData(" ")] // only white space - [InlineData("localhost")] // the loopback host name - [InlineData("LOCALHOST")] // the loopback host name, upper cased - [InlineData("127.0.0.1")] // the IPv4 loopback address - [InlineData("::1")] // the IPv6 loopback address - [InlineData("[::1]")] // the IPv6 loopback address, bracketed like a URI host - [InlineData("0.0.0.0")] // the unspecified IPv4 address - [InlineData("[::]")] // the unspecified IPv6 address - [InlineData("169.254.169.254")] // the link local cloud metadata endpoint - [InlineData("10.0.0.5")] // a private class A address - [InlineData("172.16.0.1")] // the lower bound of the private class B range - [InlineData("172.31.255.255")] // the upper bound of the private class B range - [InlineData("192.168.1.10")] // a private class C address - [InlineData("100.64.0.1")] // the lower bound of the carrier grade NAT range - [InlineData("100.127.255.255")] // the upper bound of the carrier grade NAT range - [InlineData("fc00::1")] // the IPv6 unique local range - [InlineData("fe80::1")] // the IPv6 link local range + [InlineData("")] // An empty host. + [InlineData(" ")] // Only white space. + [InlineData("localhost")] // The loopback host name. + [InlineData("LOCALHOST")] // The loopback host name, upper cased. + [InlineData("127.0.0.1")] // The IPv4 loopback address. + [InlineData("::1")] // The IPv6 loopback address. + [InlineData("[::1]")] // The IPv6 loopback address, bracketed like a URI host. + [InlineData("0.0.0.0")] // The unspecified IPv4 address. + [InlineData("[::]")] // The unspecified IPv6 address. + [InlineData("169.254.169.254")] // The link local cloud metadata endpoint. + [InlineData("10.0.0.5")] // A private class A address. + [InlineData("172.16.0.1")] // The lower bound of the private class B range. + [InlineData("172.31.255.255")] // The upper bound of the private class B range. + [InlineData("192.168.1.10")] // A private class C address. + [InlineData("100.64.0.1")] // The lower bound of the carrier grade NAT range. + [InlineData("100.127.255.255")] // The upper bound of the carrier grade NAT range. + [InlineData("fc00::1")] // The IPv6 unique local range. + [InlineData("fe80::1")] // The IPv6 link local range. public void IsPublicHost_WhenTheHostIsPrivateOrLocal_ShouldReturnFalse(string host) { // Act diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Utilities/ExceptionUtilitiesTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Utilities/ExceptionUtilitiesTests.cs index 50f79113..9ac779be 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Utilities/ExceptionUtilitiesTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Utilities/ExceptionUtilitiesTests.cs @@ -96,8 +96,8 @@ public class ExceptionUtilitiesTests List result = [.. exception.GetInnerExceptions()]; // Assert - // the aggregate exception itself, its inner exceptions and their inners are traversed, and the first inner exception - // is also reachable through the regular InnerException chain, so it is yielded twice + // The aggregate exception itself, its inner exceptions and their inners are traversed, and the first inner exception + // is also reachable through the regular InnerException chain, so it is yielded twice. Assert.Equal(6, result.Count); Assert.Contains(result, inner => inner is AggregateException); Assert.Equal(2, result.Count(inner => inner.Message == "first-inner")); diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Utilities/ImageTypeUtilitiesTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Utilities/ImageTypeUtilitiesTests.cs index 8ce853ee..7fc2a848 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Utilities/ImageTypeUtilitiesTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Utilities/ImageTypeUtilitiesTests.cs @@ -13,18 +13,18 @@ namespace Lumina.Infrastructure.UnitTests.Common.Utilities; public class ImageTypeUtilitiesTests { [Theory] - [InlineData(ImageType.BMP, "bmp")] // bitmap image - [InlineData(ImageType.GIF, "gif")] // graphics interchange format - [InlineData(ImageType.PNG, "png")] // portable network graphics - [InlineData(ImageType.TIFF, "tiff")] // tagged image file format - [InlineData(ImageType.PICT, "pct")] // macintosh picture - [InlineData(ImageType.ICO, "ico")] // icon format - [InlineData(ImageType.PSD, "psd")] // photoshop document - [InlineData(ImageType.JPEG2000, "jp2")] // jpeg 2000 - [InlineData(ImageType.AVIF, "avif")] // av1 image file format - [InlineData(ImageType.WEBP, "webp")] // web picture format - [InlineData(ImageType.TGA, "tga")] // truevision tga - [InlineData(ImageType.SVG, "svg")] // scalable vector graphics + [InlineData(ImageType.BMP, "bmp")] // Bitmap image. + [InlineData(ImageType.GIF, "gif")] // Graphics interchange format. + [InlineData(ImageType.PNG, "png")] // Portable network graphics. + [InlineData(ImageType.TIFF, "tiff")] // Tagged image file format. + [InlineData(ImageType.PICT, "pct")] // Macintosh picture. + [InlineData(ImageType.ICO, "ico")] // Icon format. + [InlineData(ImageType.PSD, "psd")] // Photoshop document. + [InlineData(ImageType.JPEG2000, "jp2")] // JPEG 2000. + [InlineData(ImageType.AVIF, "avif")] // AV1 image file format. + [InlineData(ImageType.WEBP, "webp")] // Web picture format. + [InlineData(ImageType.TGA, "tga")] // Truevision TGA. + [InlineData(ImageType.SVG, "svg")] // Scalable vector graphics. public void ToFileExtension_WhenTypeIsRecognized_ShouldReturnConventionalExtension(ImageType imageType, string expectedExtension) { // Act @@ -35,9 +35,9 @@ public class ImageTypeUtilitiesTests } [Theory] - [InlineData(ImageType.JPEG)] // joint photographic experts group - [InlineData(ImageType.JPEG_CANON)] // canon-specific jpeg - [InlineData(ImageType.JPEG_UNKNOWN)] // unknown jpeg + [InlineData(ImageType.JPEG)] // Joint photographic experts group. + [InlineData(ImageType.JPEG_CANON)] // Canon-specific JPEG. + [InlineData(ImageType.JPEG_UNKNOWN)] // Unknown JPEG. public void ToFileExtension_WhenTypeIsAnyJpeg_ShouldReturnJpg(ImageType imageType) { // Act diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/EncryptionSettingsDtoValidatorTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/EncryptionSettingsDtoValidatorTests.cs index 735bba56..a7637b7a 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/EncryptionSettingsDtoValidatorTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/EncryptionSettingsDtoValidatorTests.cs @@ -33,7 +33,7 @@ public class EncryptionSettingsDtoValidatorTests { // Arrange EncryptionSettingsDto model = _fixture.Build() - .With(x => x.SecretKey, "dGhpcyBpcyBhIHZhbGlkIGJhc2U2NCBzdHJpbmc=") // "this is a valid base64 string" in base64 + .With(x => x.SecretKey, "dGhpcyBpcyBhIHZhbGlkIGJhc2U2NCBzdHJpbmc=") // "this is a valid base64 string" in base64. .Create(); // Act diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/ThemeEngineOptionsDtoValidatorTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/ThemeEngineOptionsDtoValidatorTests.cs index 731f9845..0a07a6d8 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/ThemeEngineOptionsDtoValidatorTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/ThemeEngineOptionsDtoValidatorTests.cs @@ -75,8 +75,8 @@ public class ThemeEngineOptionsDtoValidatorTests } [Theory] - [InlineData(0L)] // zero, not positive - [InlineData(-1L)] // negative + [InlineData(0L)] // Zero, not positive. + [InlineData(-1L)] // Negative. public void Validate_WhenMaxArchiveBytesIsNotPositive_ShouldHaveValidationError(long maxArchiveBytes) { // Arrange @@ -91,8 +91,8 @@ public class ThemeEngineOptionsDtoValidatorTests } [Theory] - [InlineData(0L)] // zero, not positive - [InlineData(-1L)] // negative + [InlineData(0L)] // Zero, not positive. + [InlineData(-1L)] // Negative. public void Validate_WhenMaxExpandedBytesIsNotPositive_ShouldHaveValidationError(long maxExpandedBytes) { // Arrange @@ -107,8 +107,8 @@ public class ThemeEngineOptionsDtoValidatorTests } [Theory] - [InlineData(0L)] // zero, not positive - [InlineData(-1L)] // negative + [InlineData(0L)] // Zero, not positive. + [InlineData(-1L)] // Negative. public void Validate_WhenMaxSingleFileBytesIsNotPositive_ShouldHaveValidationError(long maxSingleFileBytes) { // Arrange @@ -123,8 +123,8 @@ public class ThemeEngineOptionsDtoValidatorTests } [Theory] - [InlineData(0)] // zero, not positive - [InlineData(-1)] // negative + [InlineData(0)] // Zero, not positive. + [InlineData(-1)] // Negative. public void Validate_WhenMaxEntriesIsNotPositive_ShouldHaveValidationError(int maxEntries) { // Arrange diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/TranscodingSettingsDtoValidatorTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/TranscodingSettingsDtoValidatorTests.cs index 1d50352d..7fe15615 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/TranscodingSettingsDtoValidatorTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Validators/TranscodingSettingsDtoValidatorTests.cs @@ -78,9 +78,9 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable } [Theory] - [InlineData(null)] // a missing ffmpeg path - [InlineData("")] // an empty ffmpeg path - [InlineData(" ")] // a whitespace ffmpeg path + [InlineData(null)] // A missing ffmpeg path. + [InlineData("")] // An empty ffmpeg path. + [InlineData(" ")] // A whitespace ffmpeg path. public void Validate_WhenFfmpegPathIsEmpty_ShouldHaveFfmpegPathCannotBeEmptyError(string? ffmpegPath) { // Arrange @@ -94,8 +94,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable } [Theory] - [InlineData(0)] // a job count of zero disables normalization - [InlineData(-1)] // a negative job count disables normalization + [InlineData(0)] // A job count of zero disables normalization. + [InlineData(-1)] // A negative job count disables normalization. public void Validate_WhenMaxConcurrentJobsIsNotPositive_ShouldHaveMaxConcurrentJobsMustBePositiveError(int maxConcurrentJobs) { // Arrange @@ -136,8 +136,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable } [Theory] - [InlineData(0)] // a per-user job count of zero never admits a normalization - [InlineData(-1)] // a negative per-user job count never admits a normalization + [InlineData(0)] // A per-user job count of zero never admits a normalization. + [InlineData(-1)] // A negative per-user job count never admits a normalization. public void Validate_WhenMaxConcurrentJobsPerUserIsNotPositive_ShouldHaveMaxConcurrentJobsPerUserMustBePositiveError(int maxConcurrentJobsPerUser) { // Arrange @@ -178,8 +178,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable } [Theory] - [InlineData(0)] // a cache with no capacity cannot hold a normalized track - [InlineData(-1)] // a negative cache size is not a capacity + [InlineData(0)] // A cache with no capacity cannot hold a normalized track. + [InlineData(-1)] // A negative cache size is not a capacity. public void Validate_WhenMaxCacheBytesIsNotPositive_ShouldHaveMaxCacheBytesMustBePositiveError(long maxCacheBytes) { // Arrange @@ -193,8 +193,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable } [Theory] - [InlineData(0)] // a job timeout of zero stops every job immediately - [InlineData(-1)] // a negative job timeout stops every job immediately + [InlineData(0)] // A job timeout of zero stops every job immediately. + [InlineData(-1)] // A negative job timeout stops every job immediately. public void Validate_WhenJobTimeoutSecondsIsNotPositive_ShouldHaveJobTimeoutMustBePositiveError(int jobTimeoutSeconds) { // Arrange @@ -235,8 +235,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable } [Theory] - [InlineData(0)] // an eviction grace of zero protects nothing - [InlineData(-1)] // a negative eviction grace protects nothing + [InlineData(0)] // An eviction grace of zero protects nothing. + [InlineData(-1)] // A negative eviction grace protects nothing. public void Validate_WhenEvictionGraceSecondsIsNotPositive_ShouldHaveEvictionGraceSecondsMustBePositiveError(int evictionGraceSeconds) { // Arrange @@ -386,8 +386,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable } [Theory] - [InlineData(null)] // no configured directory, so the default temporary directory is used - [InlineData(" ")] // a whitespace directory, so the default temporary directory is used + [InlineData(null)] // No configured directory, so the default temporary directory is used. + [InlineData(" ")] // A whitespace directory, so the default temporary directory is used. public void Validate_WhenCacheDirectoryIsNotConfigured_ShouldOnlyValidateTheDefaultDirectory(string? cacheDirectory) { // Arrange diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/JwtTokenGeneratorTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/JwtTokenGeneratorTests.cs index a44ebe31..e1617f06 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/JwtTokenGeneratorTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/JwtTokenGeneratorTests.cs @@ -59,17 +59,17 @@ public class JwtTokenGeneratorTests JwtSecurityToken jwtToken = tokenHandler.ReadJwtToken(token); - // verify token properties + // Verify token properties. Assert.Equal(_jwtSettings.Issuer, jwtToken.Issuer); Assert.Single(jwtToken.Audiences, _jwtSettings.Audience); Assert.Equal(_fixedUtcNow.AddMinutes(_jwtSettings.ExpiryMinutes), jwtToken.ValidTo); - // verify claims + // Verify claims. Assert.Contains(jwtToken.Claims, c => c.Type == JwtRegisteredClaimNames.Sub && c.Value == userId); Assert.Contains(jwtToken.Claims, c => c.Type == JwtRegisteredClaimNames.UniqueName && c.Value == username); Assert.Contains(jwtToken.Claims, c => c.Type == JwtRegisteredClaimNames.Jti && c.Value == userId); - // verify the token is actually valid + // Verify the token is actually valid. TokenValidationParameters validationParameters = new() { ValidateIssuerSigningKey = true, @@ -80,7 +80,7 @@ public class JwtTokenGeneratorTests ValidAudience = _jwtSettings.Audience, ValidateLifetime = true, ClockSkew = TimeSpan.Zero, - // override the current time to match our fixed test time + // Override the current time to match our fixed test time. LifetimeValidator = (notBefore, expires, token, parameters) => expires > _fixedUtcNow }; diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/QRCodeGeneratorTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/QRCodeGeneratorTests.cs index 3bbc5912..a28e382c 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/QRCodeGeneratorTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/QRCodeGeneratorTests.cs @@ -26,7 +26,7 @@ public class QRCodeGeneratorTests // Assert Assert.StartsWith("data:image/png;base64,", result); - Assert.True(IsBase64String(result[22..])); // skip "data:image/png;base64," + Assert.True(IsBase64String(result[22..])); // Skip "data:image/png;base64,". } [Fact] @@ -112,7 +112,7 @@ public class QRCodeGeneratorTests { // Arrange (string username, _) = QRCodeGeneratorFixture.CreateQrCodeTestData(); - byte[] shortSecret = [1]; // minimum length for Base32 encoding + byte[] shortSecret = [1]; // Minimum length for Base32 encoding. // Act string result = _sut.GenerateQrCodeDataUri(username, shortSecret); diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/TokenGeneratorTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/TokenGeneratorTests.cs index b6f6ea42..22949bda 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/TokenGeneratorTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/TokenGeneratorTests.cs @@ -57,7 +57,7 @@ public class TokenGeneratorTests string token = _sut.GenerateToken(); // Assert - // 32 bytes in Base64 without padding should be 43 characters + // 32 bytes in Base64 without padding should be 43 characters. Assert.Equal(43, token.Length); } } diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/TotpTokenGeneratorTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/TotpTokenGeneratorTests.cs index 72dfe00b..0340f4b2 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/TotpTokenGeneratorTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Authentication/TotpTokenGeneratorTests.cs @@ -56,10 +56,10 @@ public class TotpTokenGeneratorTests [Theory] [InlineData("")] [InlineData(" ")] - [InlineData("123456")] // Valid format but wrong token - [InlineData("abcdef")] // Invalid format - [InlineData("12345")] // Too short - [InlineData("1234567")] // Too long + [InlineData("123456")] // Valid format but wrong token. + [InlineData("abcdef")] // Invalid format. + [InlineData("12345")] // Too short. + [InlineData("1234567")] // Too long. public void ValidateToken_WhenTokenIsInvalid_ShouldReturnFalse(string invalidToken) { // Arrange @@ -95,6 +95,6 @@ public class TotpTokenGeneratorTests byte[] secret = _sut.GenerateSecret(); // Assert - Assert.Equal(20, secret.Length); // standard TOTP secret length + Assert.Equal(20, secret.Length); // Standard TOTP secret length. } } diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs index 49eb9f2c..ea4171d1 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs @@ -315,9 +315,9 @@ public class MusicArtworkServiceTests } [Theory] - [InlineData("cover")] // a name without an extension falls back to the .img extension - [InlineData("")] // an empty name falls back to the .img extension - [InlineData(null)] // a null name falls back to the .img extension + [InlineData("cover")] // A name without an extension falls back to the .img extension. + [InlineData("")] // An empty name falls back to the .img extension. + [InlineData(null)] // A null name falls back to the .img extension. public async Task SaveAlbumArtworkAsync_WhenTheUploadedFileNameHasNoExtension_ShouldBufferTheUploadWithTheImgExtension(string? fileName) { // Arrange @@ -427,9 +427,9 @@ public class MusicArtworkServiceTests } [Theory] - [InlineData(null)] // a null path is a no-op - [InlineData("")] // an empty path is a no-op - [InlineData(" ")] // a whitespace path is a no-op + [InlineData(null)] // A null path is a no-op. + [InlineData("")] // An empty path is a no-op. + [InlineData(" ")] // A whitespace path is a no-op. public void DeleteStoredArtwork_WhenThePathIsMissing_ShouldReturnDeletedWithoutTouchingTheFileSystem(string? artworkRelativePath) { // Act diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Metadata/AudioContainerResolverTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Metadata/AudioContainerResolverTests.cs index 4899ef66..5f80e45c 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Metadata/AudioContainerResolverTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Metadata/AudioContainerResolverTests.cs @@ -12,12 +12,12 @@ namespace Lumina.Infrastructure.UnitTests.Core.MediaLibrary.AudioLibrary.MusicLi public class AudioContainerResolverTests { [Theory] - [InlineData(null, null)] // an absent mime type leaves the container unrecognized - [InlineData("", null)] // an empty mime type leaves the container unrecognized - [InlineData(" ", null)] // a blank mime type leaves the container unrecognized - [InlineData("taglib/wav", "WAV")] // the taglib prefix is dropped and the container is upper cased - [InlineData("taglib/png", "PNG")] // a container the resolver has no dedicated parser for still yields its name - [InlineData("audio/x-wavpack", "X-WAVPACK")] // the last segment of a standard mime type names the container + [InlineData(null, null)] // An absent mime type leaves the container unrecognized. + [InlineData("", null)] // An empty mime type leaves the container unrecognized. + [InlineData(" ", null)] // A blank mime type leaves the container unrecognized. + [InlineData("taglib/wav", "WAV")] // The taglib prefix is dropped and the container is upper cased. + [InlineData("taglib/png", "PNG")] // A container the resolver has no dedicated parser for still yields its name. + [InlineData("audio/x-wavpack", "X-WAVPACK")] // The last segment of a standard mime type names the container. public void ResolveFromMimeType_WhenCalled_ShouldReturnTheContainerNamedByTheMimeType(string? mimeType, string? expectedContainer) { // Act diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackDeliveryHandleServiceTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackDeliveryHandleServiceTests.cs index 8363c47d..bde828bc 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackDeliveryHandleServiceTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackDeliveryHandleServiceTests.cs @@ -143,10 +143,10 @@ public class PlaybackDeliveryHandleServiceTests } [Theory] - [InlineData(null)] // an absent handle cannot address a delivery - [InlineData("")] // an empty handle cannot address a delivery - [InlineData(" ")] // a whitespace handle cannot address a delivery - [InlineData("0123456789abcdef0123456789abcdef")] // a well formed handle that was never issued + [InlineData(null)] // An absent handle cannot address a delivery. + [InlineData("")] // An empty handle cannot address a delivery. + [InlineData(" ")] // A whitespace handle cannot address a delivery. + [InlineData("0123456789abcdef0123456789abcdef")] // A well formed handle that was never issued. public void GetDelivery_WhenTheHandleIsMissingOrUnknown_ShouldReturnPlaybackDeliveryNotFoundError(string? deliveryId) { // Act diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackFormatCatalogTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackFormatCatalogTests.cs index 034f69fc..d8fda6c8 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackFormatCatalogTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackFormatCatalogTests.cs @@ -21,13 +21,13 @@ public class PlaybackFormatCatalogTests // Arrange (string Container, string Codec)[] expectedPairs = [ - ("MP4", "AAC"), // the preferred container of the preferred codec - ("AAC", "AAC"), // the second container of the preferred codec - ("OGG", "OPUS"), // the preferred lossy codec after AAC - ("MP3", "MP3"), // the compatibility codec - ("OGG", "VORBIS"), // the second lossy codec in OGG - ("FLAC", "FLAC"), // the lossless codec - ("WAV", "PCM") // the uncompressed codec + ("MP4", "AAC"), // The preferred container of the preferred codec. + ("AAC", "AAC"), // The second container of the preferred codec. + ("OGG", "OPUS"), // The preferred lossy codec after AAC. + ("MP3", "MP3"), // The compatibility codec. + ("OGG", "VORBIS"), // The second lossy codec in OGG. + ("FLAC", "FLAC"), // The lossless codec. + ("WAV", "PCM") // The uncompressed codec. ]; // Act @@ -80,7 +80,7 @@ public class PlaybackFormatCatalogTests Assert.True(result.TryGetValue(expectedEntry.Key, out IReadOnlyList? containers)); Assert.Equal(expectedEntry.Value, containers); } - Assert.Equal(["MP4", "AAC"], result["AAC"]); // the preferred codec has two producible containers, in preference order + Assert.Equal(["MP4", "AAC"], result["AAC"]); // The preferred codec has two producible containers, in preference order. Assert.Equal(["OGG"], result["OPUS"]); Assert.Equal(["OGG"], result["VORBIS"]); Assert.Equal(["MP3"], result["MP3"]); @@ -130,9 +130,9 @@ public class PlaybackFormatCatalogTests } [Theory] - [InlineData("mp4/aac", "MP4", "AAC")] // the canonical pair in lower case - [InlineData("Mp4/Aac", "MP4", "AAC")] // the canonical pair in mixed case - [InlineData("aac/aac", "AAC", "AAC")] // the second format in the catalog, in lower case + [InlineData("mp4/aac", "MP4", "AAC")] // The canonical pair in lower case. + [InlineData("Mp4/Aac", "MP4", "AAC")] // The canonical pair in mixed case. + [InlineData("aac/aac", "AAC", "AAC")] // The second format in the catalog, in lower case. public void FormatsByPair_WhenLookedUpWithDifferentCasing_ShouldReturnTheCatalogFormat(string pairKey, string expectedContainer, string expectedCodec) { // Act @@ -167,11 +167,11 @@ public class PlaybackFormatCatalogTests } [Theory] - [InlineData(null, null, "/")] // both parts are absent - [InlineData("", "", "/")] // both parts are empty - [InlineData(" ", " ", "/")] // both parts are white space - [InlineData(null, "aac", "/AAC")] // only the container is absent - [InlineData("mp4", null, "MP4/")] // only the codec is absent + [InlineData(null, null, "/")] // Both parts are absent. + [InlineData("", "", "/")] // Both parts are empty. + [InlineData(" ", " ", "/")] // Both parts are white space. + [InlineData(null, "aac", "/AAC")] // Only the container is absent. + [InlineData("mp4", null, "MP4/")] // Only the codec is absent. public void BuildPairKey_WhenAContainerOrCodecIsNullOrEmpty_ShouldProduceTheSlashSeparatedFormWithoutThrowing(string? container, string? codec, string expectedKey) { // Act diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackFormatServiceTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackFormatServiceTests.cs index 17c4a78e..0bca090f 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackFormatServiceTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/PlaybackFormatServiceTests.cs @@ -122,16 +122,16 @@ public class PlaybackFormatServiceTests } [Theory] - [InlineData("MP3", "MPEG-1 Layer 3", "MP3")] // the free form description of an MPEG-1 Layer 3 stream - [InlineData("MP3", "MP3", "MP3")] // a codec that is already named canonically - [InlineData("FLAC", "Flac", "FLAC")] // the description of a FLAC stream - [InlineData("OGG", "Vorbis I", "VORBIS")] // the description of a Vorbis stream - [InlineData("OGG", "Opus", "OPUS")] // the description of an Opus stream - [InlineData("MP4", "Apple Lossless", "ALAC")] // the description of an Apple Lossless stream - [InlineData("AAC", "MPEG-4 AAC", "AAC")] // a description naming both MPEG and AAC is AAC, not MP3 - [InlineData("WAV", "PCM", "PCM")] // the description of an uncompressed stream - [InlineData("WAV", "Uncompressed", "PCM")] // another description of an uncompressed stream - [InlineData("WMA", "Windows Media Audio", "WMA")] // the description of a Windows Media stream + [InlineData("MP3", "MPEG-1 Layer 3", "MP3")] // The free form description of an MPEG-1 Layer 3 stream. + [InlineData("MP3", "MP3", "MP3")] // A codec that is already named canonically. + [InlineData("FLAC", "Flac", "FLAC")] // The description of a FLAC stream. + [InlineData("OGG", "Vorbis I", "VORBIS")] // The description of a Vorbis stream. + [InlineData("OGG", "Opus", "OPUS")] // The description of an Opus stream. + [InlineData("MP4", "Apple Lossless", "ALAC")] // The description of an Apple Lossless stream. + [InlineData("AAC", "MPEG-4 AAC", "AAC")] // A description naming both MPEG and AAC is AAC, not MP3. + [InlineData("WAV", "PCM", "PCM")] // The description of an uncompressed stream. + [InlineData("WAV", "Uncompressed", "PCM")] // Another description of an uncompressed stream. + [InlineData("WMA", "Windows Media Audio", "WMA")] // The description of a Windows Media stream. public void DecideDelivery_WhenTheStoredCodecDescriptionIsRecognizable_ShouldCanonicalizeItAndDirectPlay(string container, string codecDescription, string canonicalCodec) { // Arrange @@ -148,9 +148,9 @@ public class PlaybackFormatServiceTests } [Theory] - [InlineData("MPEG-1 Layer 2")] // MP2 shares the MP3 container but an MP3 decoder cannot decode it - [InlineData("MPEG-1 Layer 1")] // MP1 shares the MP3 container but an MP3 decoder cannot decode it - [InlineData("MPEG-4 Audio")] // a description that names no decodable codec is not mistaken for MP3 + [InlineData("MPEG-1 Layer 2")] // MP2 shares the MP3 container but an MP3 decoder cannot decode it. + [InlineData("MPEG-1 Layer 1")] // MP1 shares the MP3 container but an MP3 decoder cannot decode it. + [InlineData("MPEG-4 Audio")] // A description that names no decodable codec is not mistaken for MP3. public void DecideDelivery_WhenAnMpegDescriptionIsNotLayer3_ShouldReturnTranscode(string codecDescription) { // Arrange @@ -166,9 +166,9 @@ public class PlaybackFormatServiceTests } [Theory] - [InlineData(null, null)] // an absent probe result names no codec - [InlineData("", "")] // an empty probe result names no codec - [InlineData("MP3", "AC-3")] // a codec description the server does not recognize + [InlineData(null, null)] // An absent probe result names no codec. + [InlineData("", "")] // An empty probe result names no codec. + [InlineData("MP3", "AC-3")] // A codec description the server does not recognize. public void DecideDelivery_WhenTheStoredFormatIsUnknown_ShouldReturnTranscode(string? container, string? codec) { // Arrange diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TrackNormalizationServiceTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TrackNormalizationServiceTests.cs index 953045ee..023cd659 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TrackNormalizationServiceTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TrackNormalizationServiceTests.cs @@ -92,8 +92,8 @@ public class TrackNormalizationServiceTests : IDisposable } [Theory] - [InlineData(true)] // the source file length no longer matches the declared delivery - [InlineData(false)] // the source file modification time no longer matches the declared delivery + [InlineData(true)] // The source file length no longer matches the declared delivery. + [InlineData(false)] // The source file modification time no longer matches the declared delivery. public async Task GetOrCreateNormalizedTrackAsync_WhenTheSourceFileChangedSinceTheDeliveryWasDeclared_ShouldReturnPlaybackDeliveryChangedError(bool isLengthChanged) { // Arrange diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TranscodingToolchainStatusTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TranscodingToolchainStatusTests.cs index 66d6bfac..399feb56 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TranscodingToolchainStatusTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Playback/TranscodingToolchainStatusTests.cs @@ -74,8 +74,8 @@ public class TranscodingToolchainStatusTests } [Theory] - [InlineData("AAC")] // an encoder name in upper case - [InlineData("Aac")] // an encoder name in mixed case + [InlineData("AAC")] // An encoder name in upper case. + [InlineData("Aac")] // An encoder name in mixed case. public void RecordMissingEncoders_WhenTheNameDiffersInCase_ShouldReportTheEncoderUnavailable(string missingEncoderName) { // Act diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructureTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructureTests.cs index 2ac6f06a..fc8c39da 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructureTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructureTests.cs @@ -26,8 +26,8 @@ public class MusicLibraryPathStructureTests } [Theory] - [InlineData('\\', @"C:\Music\Queen\A Night at the Opera", @"C:\Music\Queen\A Night at the Opera\Bohemian Rhapsody.flac")] // Windows separated path - [InlineData('/', "/music/queen/a-night-at-the-opera", "/music/queen/a-night-at-the-opera/bohemian-rhapsody.flac")] // Unix separated path + [InlineData('\\', @"C:\Music\Queen\A Night at the Opera", @"C:\Music\Queen\A Night at the Opera\Bohemian Rhapsody.flac")] // Windows separated path. + [InlineData('/', "/music/queen/a-night-at-the-opera", "/music/queen/a-night-at-the-opera/bohemian-rhapsody.flac")] // Unix separated path. public void GetAlbumDirectory_WhenTheTrackIsInTheAlbumDirectory_ShouldReturnTheTrackDirectory(char separator, string albumDirectory, string trackPath) { // Arrange @@ -41,14 +41,14 @@ public class MusicLibraryPathStructureTests } [Theory] - [InlineData('\\', "Disc 1")] // canonical disc directory name, Windows separated path - [InlineData('\\', "disc 2")] // lowercase disc directory name, Windows separated path - [InlineData('\\', "CD3")] // compact disc directory name, Windows separated path - [InlineData('\\', "disk4")] // disk directory name, Windows separated path - [InlineData('/', "Disc 1")] // canonical disc directory name, Unix separated path - [InlineData('/', "disc 2")] // lowercase disc directory name, Unix separated path - [InlineData('/', "CD3")] // compact disc directory name, Unix separated path - [InlineData('/', "disk4")] // disk directory name, Unix separated path + [InlineData('\\', "Disc 1")] // Canonical disc directory name, Windows separated path. + [InlineData('\\', "disc 2")] // Lowercase disc directory name, Windows separated path. + [InlineData('\\', "CD3")] // Compact disc directory name, Windows separated path. + [InlineData('\\', "disk4")] // Disk directory name, Windows separated path. + [InlineData('/', "Disc 1")] // Canonical disc directory name, Unix separated path. + [InlineData('/', "disc 2")] // Lowercase disc directory name, Unix separated path. + [InlineData('/', "CD3")] // Compact disc directory name, Unix separated path. + [InlineData('/', "disk4")] // Disk directory name, Unix separated path. public void GetAlbumDirectory_WhenTheTrackIsInADiscDirectory_ShouldReturnTheParentAlbumDirectory(char separator, string discDirectoryName) { // Arrange @@ -64,8 +64,8 @@ public class MusicLibraryPathStructureTests } [Theory] - [InlineData('\\')] // Windows separated path - [InlineData('/')] // Unix separated path + [InlineData('\\')] // Windows separated path. + [InlineData('/')] // Unix separated path. public void GetAlbumDirectory_WhenTheDirectoryIsNotADiscDirectory_ShouldReturnTheTrackDirectory(char separator) { // Arrange @@ -93,8 +93,8 @@ public class MusicLibraryPathStructureTests } [Theory] - [InlineData('\\')] // Windows separated path - [InlineData('/')] // Unix separated path + [InlineData('\\')] // Windows separated path. + [InlineData('/')] // Unix separated path. public void GetAlbumDirectory_WhenThePathHasNoDirectory_ShouldReturnTheProvidedPath(char separator) { // Arrange @@ -109,10 +109,10 @@ public class MusicLibraryPathStructureTests } [Theory] - [InlineData('\\', "Album")] // canonical release type directory, Windows separated path - [InlineData('\\', "album")] // lowercase release type directory, Windows separated path - [InlineData('/', "Album")] // canonical release type directory, Unix separated path - [InlineData('/', "album")] // lowercase release type directory, Unix separated path + [InlineData('\\', "Album")] // Canonical release type directory, Windows separated path. + [InlineData('\\', "album")] // Lowercase release type directory, Windows separated path. + [InlineData('/', "Album")] // Canonical release type directory, Unix separated path. + [InlineData('/', "album")] // Lowercase release type directory, Unix separated path. public void GetReleaseTypeDirectoryName_WhenTheParentOfTheAlbumDirectoryIsAReleaseType_ShouldReturnIt(char separator, string releaseTypeDirectoryName) { // Arrange @@ -127,8 +127,8 @@ public class MusicLibraryPathStructureTests } [Theory] - [InlineData('\\')] // Windows separated path - [InlineData('/')] // Unix separated path + [InlineData('\\')] // Windows separated path. + [InlineData('/')] // Unix separated path. public void GetReleaseTypeDirectoryName_WhenTheAlbumIsMultiDisc_ShouldReturnTheReleaseTypeDirectory(char separator) { // Arrange @@ -143,8 +143,8 @@ public class MusicLibraryPathStructureTests } [Theory] - [InlineData('\\')] // Windows separated path - [InlineData('/')] // Unix separated path + [InlineData('\\')] // Windows separated path. + [InlineData('/')] // Unix separated path. public void GetReleaseTypeDirectoryName_WhenTheParentOfTheAlbumDirectoryIsNotAReleaseType_ShouldReturnNull(char separator) { // Arrange @@ -159,10 +159,10 @@ public class MusicLibraryPathStructureTests } [Theory] - [InlineData('\\', "Live")] // release type name used as the artist directory name, Windows separated path - [InlineData('/', "Live")] // release type name used as the artist directory name, Unix separated path - [InlineData('\\', "42")] // numeric artist directory name, Windows separated path - [InlineData('/', "42")] // numeric artist directory name, Unix separated path + [InlineData('\\', "Live")] // Release type name used as the artist directory name, Windows separated path. + [InlineData('/', "Live")] // Release type name used as the artist directory name, Unix separated path. + [InlineData('\\', "42")] // Numeric artist directory name, Windows separated path. + [InlineData('/', "42")] // Numeric artist directory name, Unix separated path. public void GetReleaseTypeDirectoryName_WhenTheArtistDirectoryIsNamedLikeAReleaseType_ShouldReturnNull(char separator, string artistName) { // Arrange @@ -178,8 +178,8 @@ public class MusicLibraryPathStructureTests } [Theory] - [InlineData('\\')] // Windows separated path - [InlineData('/')] // Unix separated path + [InlineData('\\')] // Windows separated path. + [InlineData('/')] // Unix separated path. public void GetReleaseTypeDirectoryName_WhenAReleaseTypeDirectoryDiffersFromTheArtistDirectory_ShouldReturnIt(char separator) { // Arrange diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanMetadataEnricherTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanMetadataEnricherTests.cs index 6994dc7e..675b9873 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanMetadataEnricherTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanMetadataEnricherTests.cs @@ -103,7 +103,7 @@ public class MusicMediaLibraryScanMetadataEnricherTests _userId = _userIdFixture.Create(); _libraryId = _libraryIdFixture.Create(); - // the configured providers are registered under the plugin Ids they are configured with, the way the host registers plugin provided services + // The configured providers are registered under the plugin Ids they are configured with, the way the host registers plugin provided services. Guid pluginAId = Guid.NewGuid(); Guid pluginBId = Guid.NewGuid(); _mockMetadataConfigurationRepository.GetByLibraryIdAsync(_libraryId.Value, Arg.Any()) @@ -153,7 +153,7 @@ public class MusicMediaLibraryScanMetadataEnricherTests await _sut.EnrichAsync(_libraryId, _scanId, _userId, CancellationToken.None); // Assert - // the total is the sum of the artists, the albums and the tracks, and the final update reaches it + // The total is the sum of the artists, the albums and the tracks, and the final update reaches it. await _mockDomainEventPublisher.Received(1).PublishAsync(Arg.Is(domainEvent => domainEvent.MediaLibraryScanCompositeId.ScanId == _scanId && domainEvent.Progress.CompletedItems == 0 @@ -215,7 +215,7 @@ public class MusicMediaLibraryScanMetadataEnricherTests ArtistEntity artist = _artistEntityFixture.Create(libraryId: _libraryId.Value); _mockArtistRepository.GetArtistsNeedingMetadataAsync(_libraryId.Value, Arg.Any(), Arg.Any(), Arg.Any()) .Returns(Result>.Success([artist]), Result>.Success([])); - // a genre without a name is usable as metadata, but makes the domain conversion of the whole metadata fail + // A genre without a name is usable as metadata, but makes the domain conversion of the whole metadata fail. _mockProviderA.GetMetadataAsync(Arg.Any(), Arg.Any()) .Returns((MetadataDto?)CreateApplicableArtistMetadata("Local Artist", genres: [_genreDtoFixture.Create(includeName: false)])); _mockProviderB.GetMetadataAsync(Arg.Any(), Arg.Any()) diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Common/MediaLibraryScanArtworkEnrichmentJobTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Common/MediaLibraryScanArtworkEnrichmentJobTests.cs index 1bcd1732..8bdb1b4e 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Common/MediaLibraryScanArtworkEnrichmentJobTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Common/MediaLibraryScanArtworkEnrichmentJobTests.cs @@ -64,7 +64,7 @@ public class MediaLibraryScanArtworkEnrichmentJobTests _mockUnitOfWork.LibraryRepository.Returns(_mockLibraryRepository); _mockServiceProvider.GetService(typeof(IUnitOfWork)).Returns(_mockUnitOfWork); - // the job resolves the artwork enricher of the loaded library type from the service scope, so the music enricher must be available + // The job resolves the artwork enricher of the loaded library type from the service scope, so the music enricher must be available. _mockArtworkEnricher = Substitute.For(); _mockArtworkEnricher.SupportedLibraryType.Returns(LibraryType.Music); _mockArtworkEnricher.EnrichAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Common/MediaLibraryScanHashJobTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Common/MediaLibraryScanHashJobTests.cs index 3934edea..1d10fe82 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Common/MediaLibraryScanHashJobTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Common/MediaLibraryScanHashJobTests.cs @@ -349,7 +349,7 @@ public class MediaLibraryScanHashJobTests // Assert Assert.Equal(LibraryScanJobStatus.Completed, _sut.Status); - // the initial progress and the progress published from the hashing callback are both reported + // The initial progress and the progress published from the hashing callback are both reported. await _mockDomainEventPublisher.Received(2).PublishAsync(Arg.Is(domainEvent => domainEvent.LibraryId == _libraryId), Arg.Any()); } diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Progress/MediaLibraryScanProgressHubTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Progress/MediaLibraryScanProgressHubTests.cs index 6acf31f3..b1df8c1b 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Progress/MediaLibraryScanProgressHubTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Progress/MediaLibraryScanProgressHubTests.cs @@ -20,7 +20,7 @@ public class MediaLibraryScanProgressHubTests [Fact] public async Task SubscribeToScan_WhenCalled_ShouldAddTheConnectionToTheGroupOfTheAuthenticatedUser() { - // Arrange. + // Arrange MediaLibraryScanProgressHub sut = new(); HubCallerContext context = Substitute.For(); context.ConnectionId.Returns("connection-1"); @@ -33,17 +33,17 @@ public class MediaLibraryScanProgressHubTests ClaimsPrincipal user = new(new ClaimsIdentity([new Claim(ClaimTypes.NameIdentifier, userId.ToString())])); context.User.Returns(user); - // Act. + // Act await sut.SubscribeToScan(scanId); - // Assert. + // Assert await groupManager.Received(1).AddToGroupAsync("connection-1", $"{scanId}-{userId}", CancellationToken.None); } [Fact] public async Task SubscribeToScan_WhenUserClaimIsMissing_ShouldNotAddTheConnectionToAnyGroup() { - // Arrange. + // Arrange MediaLibraryScanProgressHub sut = new(); HubCallerContext context = Substitute.For(); context.ConnectionId.Returns("connection-1"); @@ -54,17 +54,17 @@ public class MediaLibraryScanProgressHubTests ClaimsPrincipal user = new(new ClaimsIdentity()); context.User.Returns(user); - // Act. + // Act await sut.SubscribeToScan(scanId); - // Assert. + // Assert await groupManager.DidNotReceive().AddToGroupAsync(Arg.Any(), Arg.Any(), Arg.Any()); } [Fact] public async Task SubscribeToScan_WhenUserIdClaimIsNotAGuid_ShouldNotAddTheConnectionToAnyGroup() { - // Arrange. + // Arrange MediaLibraryScanProgressHub sut = new(); HubCallerContext context = Substitute.For(); context.ConnectionId.Returns("connection-1"); @@ -75,10 +75,10 @@ public class MediaLibraryScanProgressHubTests ClaimsPrincipal user = new(new ClaimsIdentity([new Claim(ClaimTypes.NameIdentifier, "not-a-guid")])); context.User.Returns(user); - // Act. + // Act await sut.SubscribeToScan(scanId); - // Assert. + // Assert await groupManager.DidNotReceive().AddToGroupAsync(Arg.Any(), Arg.Any(), Arg.Any()); } } diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Queue/MediaLibraryScanProcessorJobTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Queue/MediaLibraryScanProcessorJobTests.cs index a78b2f23..819dfd5d 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Queue/MediaLibraryScanProcessorJobTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Queue/MediaLibraryScanProcessorJobTests.cs @@ -84,7 +84,7 @@ public class MediaLibraryScanProcessorJobTests : IDisposable RegisterScan(firstScanId, LibraryScanJobStatus.Pending); RegisterScan(secondScanId, LibraryScanJobStatus.Pending); TaskCompletionSource releaseFirstScan = new(TaskCreationOptions.RunContinuationsAsynchronously); - // ExecutionStarted is signaled before the callback runs, and resumes the test on another thread, so the test waits for the callback itself to record the scan + // ExecutionStarted is signaled before the callback runs, and resumes the test on another thread, so the test waits for the callback itself to record the scan. TaskCompletionSource firstScanRecorded = new(TaskCreationOptions.RunContinuationsAsynchronously); List startedScanIds = []; FakeMediaLibraryScanDiscoveryJob firstRootJob = _mediaLibraryScanDiscoveryJobFixture.Create(onExecute: async _ => diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Reading/BookReaderEnablementCacheTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Reading/BookReaderEnablementCacheTests.cs index 500cb3b7..c51cc014 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Reading/BookReaderEnablementCacheTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Reading/BookReaderEnablementCacheTests.cs @@ -25,8 +25,8 @@ public class BookReaderEnablementCacheTests } [Theory] - [InlineData(true)] // reader enabled - [InlineData(false)] // reader disabled + [InlineData(true)] // Reader enabled. + [InlineData(false)] // Reader disabled. public void Set_WhenCalled_ThenGetShouldReturnTheCachedValue(bool isEnabled) { // Arrange diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Reading/ReadingContentSanitizerTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Reading/ReadingContentSanitizerTests.cs index 48bd6d5d..21005a2c 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Reading/ReadingContentSanitizerTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/WrittenContentLibrary/BookLibrary/Reading/ReadingContentSanitizerTests.cs @@ -126,8 +126,8 @@ public class ReadingContentSanitizerTests } [Theory] - [InlineData(true)] // preserve styles - [InlineData(false)] // strip styles + [InlineData(true)] // Preserve styles. + [InlineData(false)] // Strip styles. public void Sanitize_WhenHtmlContainsActiveContent_ShouldStripItRegardlessOfTheStylePreference(bool shouldPreserveStyles) { // Arrange @@ -145,9 +145,9 @@ public class ReadingContentSanitizerTests } [Theory] - [InlineData(null)] // null input - [InlineData("")] // empty input - [InlineData(" ")] // whitespace input + [InlineData(null)] // Null input. + [InlineData("")] // Empty input. + [InlineData(" ")] // Whitespace input. public void Sanitize_WhenInputIsBlank_ShouldReturnEmptyString(string? html) { // Act diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Security/CryptographyServiceTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Security/CryptographyServiceTests.cs index 4a7fe2fd..39e906a5 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Security/CryptographyServiceTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Security/CryptographyServiceTests.cs @@ -116,7 +116,7 @@ public class CryptographyServiceTests public void Decrypt_WhenInputIsTooShort_ShouldThrowArgumentException() { // Arrange - string shortCiphertext = Convert.ToBase64String(new byte[8]); // less than required 16 bytes + string shortCiphertext = Convert.ToBase64String(new byte[8]); // Less than required 16 bytes. // Act Action act = () => _sut.Decrypt(shortCiphertext); @@ -135,7 +135,7 @@ public class CryptographyServiceTests // Decode the Base64 string, modify one byte, then re-encode. byte[] encryptedBytes = Convert.FromBase64String(encrypted); - encryptedBytes[^1] ^= 0xFF; // flip all bits in the last byte + encryptedBytes[^1] ^= 0xFF; // Flip all bits in the last byte. string corrupted = Convert.ToBase64String(encryptedBytes); // Act diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Security/HashServiceTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Security/HashServiceTests.cs index 72599e89..9498474f 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Security/HashServiceTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Security/HashServiceTests.cs @@ -57,7 +57,7 @@ public class HashServiceTests // Assert Assert.NotNull(hash); Assert.NotEmpty(hash); - // verify it's a valid Base64 string + // Verify it's a valid Base64 string. Assert.NotNull(Convert.FromBase64String(hash)); } @@ -92,8 +92,8 @@ public class HashServiceTests [Theory] [InlineData("")] - [InlineData("dGVzdA==")] // valid base64 but wrong length - [InlineData("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=")] // valid base64 but wrong length + [InlineData("dGVzdA==")] // Valid base64 but wrong length. + [InlineData("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=")] // Valid base64 but wrong length. public void CheckStringAgainstHash_WhenHashIsInvalidLength_ShouldReturnFalse(string invalidHash) { // Arrange diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Themes/ThemeMimeTypesTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Themes/ThemeMimeTypesTests.cs index 8600181e..df5b79d1 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Themes/ThemeMimeTypesTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/Themes/ThemeMimeTypesTests.cs @@ -31,7 +31,7 @@ public class ThemeMimeTypesTests public void GetMimeType_WhenExtensionIsKnown_ShouldReturnMappedContentType(string filePath, string expectedContentType) { // Arrange - // filePath and expectedContentType are provided by the test data + // filePath and expectedContentType are provided by the test data. // Act string result = ThemeMimeTypes.GetMimeType(filePath); diff --git a/tests/UnitTests/Lumina.Plugins.Calibre.UnitTests/Core/Mapping/CalibreMapperTests.cs b/tests/UnitTests/Lumina.Plugins.Calibre.UnitTests/Core/Mapping/CalibreMapperTests.cs index a665a0af..509ae36b 100644 --- a/tests/UnitTests/Lumina.Plugins.Calibre.UnitTests/Core/Mapping/CalibreMapperTests.cs +++ b/tests/UnitTests/Lumina.Plugins.Calibre.UnitTests/Core/Mapping/CalibreMapperTests.cs @@ -103,7 +103,7 @@ public class CalibreMapperTests } [Theory] - [InlineData(0)] // a zero series index is not a meaningful volume number + [InlineData(0)] // A zero series index is not a meaningful volume number. public void Map_WhenSeriesIndexIsZero_ShouldReturnNullVolumeNumber(double seriesIndex) { // Arrange @@ -350,7 +350,7 @@ public class CalibreMapperTests BookMetadataDto result = CalibreMapper.Map(document); // Assert - // a book without a publication date must still be enrichable, so the release info is present with empty fields + // A book without a publication date must still be enrichable, so the release info is present with empty fields. Assert.NotNull(result.ReleaseInfo); Assert.Null(result.ReleaseInfo!.OriginalReleaseDate); Assert.Null(result.ReleaseInfo.OriginalReleaseYear); diff --git a/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Api/CoverArtArchiveHttpClientTests.cs b/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Api/CoverArtArchiveHttpClientTests.cs index a79ccc3f..3fceffd8 100644 --- a/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Api/CoverArtArchiveHttpClientTests.cs +++ b/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Api/CoverArtArchiveHttpClientTests.cs @@ -180,10 +180,10 @@ public class CoverArtArchiveHttpClientTests } [Theory] - [InlineData("https://evil.example/index.json")] // an unrelated public host - [InlineData("https://localhost/index.json")] // the loopback host name - [InlineData("https://127.0.0.1/index.json")] // the IPv4 loopback address - [InlineData("https://169.254.169.254/latest/meta-data/")] // the link local cloud metadata endpoint + [InlineData("https://evil.example/index.json")] // An unrelated public host. + [InlineData("https://localhost/index.json")] // The loopback host name. + [InlineData("https://127.0.0.1/index.json")] // The IPv4 loopback address. + [InlineData("https://169.254.169.254/latest/meta-data/")] // The link local cloud metadata endpoint. public async Task GetReleaseArtworkAsync_WhenTheRedirectPointsAtADisallowedHost_ShouldThrow(string location) { // Arrange diff --git a/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/CoverArtArchiveHostsTests.cs b/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/CoverArtArchiveHostsTests.cs index d35c7005..fa61d0bb 100644 --- a/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/CoverArtArchiveHostsTests.cs +++ b/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/CoverArtArchiveHostsTests.cs @@ -12,10 +12,10 @@ namespace Lumina.Plugins.CoverArtArchive.UnitTests.Core; public class CoverArtArchiveHostsTests { [Theory] - [InlineData("coverartarchive.org")] // the Cover Art Archive host - [InlineData("archive.org")] // the Internet Archive host - [InlineData("ia800100.us.archive.org")] // a subdomain of the Internet Archive that serves its downloads - [InlineData("media.coverartarchive.org")] // a subdomain of the Cover Art Archive + [InlineData("coverartarchive.org")] // The Cover Art Archive host. + [InlineData("archive.org")] // The Internet Archive host. + [InlineData("ia800100.us.archive.org")] // A subdomain of the Internet Archive that serves its downloads. + [InlineData("media.coverartarchive.org")] // A subdomain of the Cover Art Archive. public void IsAllowed_WhenTheHostIsATrustedArchiveHost_ShouldReturnTrue(string host) { // Act @@ -26,8 +26,8 @@ public class CoverArtArchiveHostsTests } [Theory] - [InlineData("COVERARTARCHIVE.ORG")] // the Cover Art Archive host, upper cased - [InlineData("Archive.Org")] // the Internet Archive host, mixed cased + [InlineData("COVERARTARCHIVE.ORG")] // The Cover Art Archive host, upper cased. + [InlineData("Archive.Org")] // The Internet Archive host, mixed cased. public void IsAllowed_WhenTheHostDiffersOnlyByCase_ShouldReturnTrue(string host) { // Act @@ -38,18 +38,18 @@ public class CoverArtArchiveHostsTests } [Theory] - [InlineData("")] // an empty host - [InlineData(" ")] // only white space - [InlineData("localhost")] // the loopback host name - [InlineData("127.0.0.1")] // the IPv4 loopback address - [InlineData("169.254.169.254")] // the link local cloud metadata endpoint - [InlineData("10.0.0.5")] // a private class A address - [InlineData("192.168.1.10")] // a private class C address - [InlineData("evil.example")] // an unrelated public host - [InlineData("coverartarchive.org.evil.example")] // the trusted host used as a prefix of an attacker controlled host - [InlineData("archive.org.evil.example")] // the Internet Archive host used as a prefix of an attacker controlled host - [InlineData("notcoverartarchive.org")] // a suffix collision that is not a subdomain - [InlineData("notarchive.org")] // a suffix collision that is not a subdomain + [InlineData("")] // An empty host. + [InlineData(" ")] // Only white space. + [InlineData("localhost")] // The loopback host name. + [InlineData("127.0.0.1")] // The IPv4 loopback address. + [InlineData("169.254.169.254")] // The link local cloud metadata endpoint. + [InlineData("10.0.0.5")] // A private class A address. + [InlineData("192.168.1.10")] // A private class C address. + [InlineData("evil.example")] // An unrelated public host. + [InlineData("coverartarchive.org.evil.example")] // The trusted host used as a prefix of an attacker controlled host. + [InlineData("archive.org.evil.example")] // The Internet Archive host used as a prefix of an attacker controlled host. + [InlineData("notcoverartarchive.org")] // A suffix collision that is not a subdomain. + [InlineData("notarchive.org")] // A suffix collision that is not a subdomain. public void IsAllowed_WhenTheHostIsNotATrustedArchiveHost_ShouldReturnFalse(string host) { // Act diff --git a/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Mapping/CoverArtArchiveMapperTests.cs b/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Mapping/CoverArtArchiveMapperTests.cs index 82273ab1..04356af3 100644 --- a/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Mapping/CoverArtArchiveMapperTests.cs +++ b/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Mapping/CoverArtArchiveMapperTests.cs @@ -73,9 +73,9 @@ public class CoverArtArchiveMapperTests } [Theory] - [InlineData(null)] // a null URL - [InlineData("")] // an empty URL - [InlineData(" ")] // a white space URL + [InlineData(null)] // A null URL. + [InlineData("")] // An empty URL. + [InlineData(" ")] // A white space URL. public void MapArtwork_WhenTheImageUrlIsMissing_ShouldSkipIt(string? imageUrl) { // Arrange @@ -90,9 +90,9 @@ public class CoverArtArchiveMapperTests } [Theory] - [InlineData("not-a-url")] // a value that is not an URI at all - [InlineData("/release/11111111-1111-1111-1111-111111111111/1.jpg")] // a relative URI - [InlineData("coverartarchive.org/release/1.jpg")] // a host without a scheme + [InlineData("not-a-url")] // A value that is not an URI at all. + [InlineData("/release/11111111-1111-1111-1111-111111111111/1.jpg")] // A relative URI. + [InlineData("coverartarchive.org/release/1.jpg")] // A host without a scheme. public void MapArtwork_WhenTheImageUrlIsNotAnAbsoluteUri_ShouldSkipIt(string imageUrl) { // Arrange @@ -107,14 +107,14 @@ public class CoverArtArchiveMapperTests } [Theory] - [InlineData("http://localhost/release/1.jpg")] // the loopback host name - [InlineData("http://127.0.0.1/release/1.jpg")] // the IPv4 loopback address - [InlineData("http://169.254.169.254/latest/meta-data/")] // the link local cloud metadata endpoint - [InlineData("http://10.0.0.5/release/1.jpg")] // a private class A address - [InlineData("http://192.168.1.10/release/1.jpg")] // a private class C address - [InlineData("https://evil.example/release/1.jpg")] // an unrelated public host - [InlineData("https://coverartarchive.org.evil.example/1.jpg")] // the trusted host used as a prefix of an attacker controlled host - [InlineData("https://archive.org.evil.example/1.jpg")] // the Internet Archive host used as a prefix of an attacker controlled host + [InlineData("http://localhost/release/1.jpg")] // The loopback host name. + [InlineData("http://127.0.0.1/release/1.jpg")] // The IPv4 loopback address. + [InlineData("http://169.254.169.254/latest/meta-data/")] // The link local cloud metadata endpoint. + [InlineData("http://10.0.0.5/release/1.jpg")] // A private class A address. + [InlineData("http://192.168.1.10/release/1.jpg")] // A private class C address. + [InlineData("https://evil.example/release/1.jpg")] // An unrelated public host. + [InlineData("https://coverartarchive.org.evil.example/1.jpg")] // The trusted host used as a prefix of an attacker controlled host. + [InlineData("https://archive.org.evil.example/1.jpg")] // The Internet Archive host used as a prefix of an attacker controlled host. public void MapArtwork_WhenTheImageUrlPointsAtAnUntrustedHost_ShouldSkipIt(string imageUrl) { // Arrange @@ -129,9 +129,9 @@ public class CoverArtArchiveMapperTests } [Theory] - [InlineData("file:///etc/passwd")] // a local file URI - [InlineData("ftp://coverartarchive.org/1.jpg")] // an unsupported scheme on a trusted host - [InlineData("data:image/png;base64,SGVsbG8=")] // an inline data URI + [InlineData("file:///etc/passwd")] // A local file URI. + [InlineData("ftp://coverartarchive.org/1.jpg")] // An unsupported scheme on a trusted host. + [InlineData("data:image/png;base64,SGVsbG8=")] // An inline data URI. public void MapArtwork_WhenTheImageUrlUsesAnUnsupportedScheme_ShouldSkipIt(string imageUrl) { // Arrange @@ -178,20 +178,20 @@ public class CoverArtArchiveMapperTests } [Theory] - [InlineData("front", ArtworkType.Cover)] // the front cover type, lower cased - [InlineData("Front", ArtworkType.Cover)] // the front cover type - [InlineData("BACK", ArtworkType.Back)] // the back cover type, upper cased - [InlineData("Booklet", ArtworkType.Booklet)] // a booklet page - [InlineData("Medium", ArtworkType.Medium)] // a medium label - [InlineData("Tray", ArtworkType.Tray)] // the tray artwork - [InlineData("Spine", ArtworkType.Spine)] // the spine artwork - [InlineData("Obi", ArtworkType.Obi)] // the obi strip - [InlineData("Sticker", ArtworkType.Sticker)] // the sticker - [InlineData("Poster", ArtworkType.Poster)] // the poster - [InlineData("Liner", ArtworkType.Liner)] // the liner notes - [InlineData("Watermark", ArtworkType.Watermark)] // a watermark - [InlineData(" Booklet ", ArtworkType.Booklet)] // a type with surrounding white space - [InlineData("SomeUnknownType", ArtworkType.Other)] // an unknown type is kept as generic artwork + [InlineData("front", ArtworkType.Cover)] // The front cover type, lower cased. + [InlineData("Front", ArtworkType.Cover)] // The front cover type. + [InlineData("BACK", ArtworkType.Back)] // The back cover type, upper cased. + [InlineData("Booklet", ArtworkType.Booklet)] // A booklet page. + [InlineData("Medium", ArtworkType.Medium)] // A medium label. + [InlineData("Tray", ArtworkType.Tray)] // The tray artwork. + [InlineData("Spine", ArtworkType.Spine)] // The spine artwork. + [InlineData("Obi", ArtworkType.Obi)] // The obi strip. + [InlineData("Sticker", ArtworkType.Sticker)] // The sticker. + [InlineData("Poster", ArtworkType.Poster)] // The poster. + [InlineData("Liner", ArtworkType.Liner)] // The liner notes. + [InlineData("Watermark", ArtworkType.Watermark)] // A watermark. + [InlineData(" Booklet ", ArtworkType.Booklet)] // A type with surrounding white space. + [InlineData("SomeUnknownType", ArtworkType.Other)] // An unknown type is kept as generic artwork. public void MapArtwork_WhenTheImageIsTaggedWithAType_ShouldMapItToTheExpectedArtworkType(string type, ArtworkType expectedArtworkType) { // Arrange @@ -254,9 +254,9 @@ public class CoverArtArchiveMapperTests } [Theory] - [InlineData(null)] // a null element inside the types collection - [InlineData("")] // an empty element inside the types collection - [InlineData(" ")] // a white space element inside the types collection + [InlineData(null)] // A null element inside the types collection. + [InlineData("")] // An empty element inside the types collection. + [InlineData(" ")] // A white space element inside the types collection. public void MapArtwork_WhenTheTypesCollectionContainsNullOrEmptyElements_ShouldSkipThem(string? type) { // Arrange diff --git a/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Settings/CoverArtArchiveSettingsProviderTests.cs b/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Settings/CoverArtArchiveSettingsProviderTests.cs index 27423268..9428855e 100644 --- a/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Settings/CoverArtArchiveSettingsProviderTests.cs +++ b/tests/UnitTests/Lumina.Plugins.CoverArtArchive.UnitTests/Core/Settings/CoverArtArchiveSettingsProviderTests.cs @@ -78,11 +78,11 @@ public class CoverArtArchiveSettingsProviderTests } [Theory] - [InlineData("user\r\n@example.com")] // carriage return and line feed injection - [InlineData("user@example.com\r\nX-Injected: value")] // header injection attempt - [InlineData("user(comment)@example.com")] // parentheses break the user agent comment - [InlineData("user\"quoted\"@example.com")] // quotes break the header value - [InlineData("user example@example.com")] // an inner space is not a valid token character + [InlineData("user\r\n@example.com")] // Carriage return and line feed injection. + [InlineData("user@example.com\r\nX-Injected: value")] // Header injection attempt. + [InlineData("user(comment)@example.com")] // Parentheses break the user agent comment. + [InlineData("user\"quoted\"@example.com")] // Quotes break the header value. + [InlineData("user example@example.com")] // An inner space is not a valid token character. public async Task GetAsync_WhenThePersistedContactEmailContainsUnsafeCharacters_ShouldDropIt(string storedEmail) { // Arrange @@ -99,9 +99,9 @@ public class CoverArtArchiveSettingsProviderTests } [Theory] - [InlineData("", null)] // an empty value clears the email - [InlineData(" ", null)] // a white space value clears the email - [InlineData(" user@example.com ", "user@example.com")] // a value with surrounding white space is trimmed + [InlineData("", null)] // An empty value clears the email. + [InlineData(" ", null)] // A white space value clears the email. + [InlineData(" user@example.com ", "user@example.com")] // A value with surrounding white space is trimmed. public async Task GetAsync_WhenThePersistedContactEmailIsPresent_ShouldSetOrClearIt(string storedEmail, string? expectedEmail) { // Arrange @@ -119,17 +119,17 @@ public class CoverArtArchiveSettingsProviderTests [Theory] [InlineData("2.5", 2.5)] - [InlineData("0", 0)] // an interval of zero is allowed - [InlineData("-3", 0)] // a negative interval is clamped to zero - [InlineData("not-a-number", 1)] // an unparsable value keeps the default - [InlineData("NaN", 1)] // a non finite value keeps the default - [InlineData("Infinity", 1)] // a non finite value keeps the default - [InlineData("-Infinity", 1)] // a non finite value keeps the default - [InlineData("1e400", 1)] // a value that overflows the double range keeps the default - [InlineData("1e308", 60)] // a huge but finite value is clamped to the maximum - [InlineData("1000", 60)] // a value above the maximum is clamped - [InlineData("60", 60)] // the maximum itself is kept - [InlineData("59", 59)] // a value within the range is kept + [InlineData("0", 0)] // An interval of zero is allowed. + [InlineData("-3", 0)] // A negative interval is clamped to zero. + [InlineData("not-a-number", 1)] // An unparsable value keeps the default. + [InlineData("NaN", 1)] // A non finite value keeps the default. + [InlineData("Infinity", 1)] // A non finite value keeps the default. + [InlineData("-Infinity", 1)] // A non finite value keeps the default. + [InlineData("1e400", 1)] // A value that overflows the double range keeps the default. + [InlineData("1e308", 60)] // A huge but finite value is clamped to the maximum. + [InlineData("1000", 60)] // A value above the maximum is clamped. + [InlineData("60", 60)] // The maximum itself is kept. + [InlineData("59", 59)] // A value within the range is kept. public async Task GetAsync_WhenThePersistedMinimumRequestIntervalIsPresent_ShouldParseAndClampIt(string storedInterval, double expectedSeconds) { // Arrange diff --git a/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Mapping/Id3TagMapperTests.cs b/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Mapping/Id3TagMapperTests.cs index e5cb3314..78531647 100644 --- a/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Mapping/Id3TagMapperTests.cs +++ b/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Mapping/Id3TagMapperTests.cs @@ -392,13 +392,13 @@ public class Id3TagMapperTests } [Theory] - [InlineData("eng", "en", "English")] // a three letter code maps to the neutral culture - [InlineData("deu", "de", "German")] // another three letter code maps to the neutral culture - [InlineData("en", "en", "English")] // a two letter code maps too - [InlineData("zxx", "zxx", "No linguistic content")] // the special code of MusicBrainz - [InlineData("mul", "mul", "Multiple languages")] // the special code of MusicBrainz - [InlineData("und", "und", "Undetermined")] // the special code of MusicBrainz - [InlineData("eng/ara", "en", "English")] // only the first code of a multi language tag is used + [InlineData("eng", "en", "English")] // A three letter code maps to the neutral culture. + [InlineData("deu", "de", "German")] // Another three letter code maps to the neutral culture. + [InlineData("en", "en", "English")] // A two letter code maps too. + [InlineData("zxx", "zxx", "No linguistic content")] // The special code of MusicBrainz. + [InlineData("mul", "mul", "Multiple languages")] // The special code of MusicBrainz. + [InlineData("und", "und", "Undetermined")] // The special code of MusicBrainz. + [InlineData("eng/ara", "en", "English")] // Only the first code of a multi language tag is used. public void MapAlbum_WhenTheLanguageCodeIsPresent_ShouldMapIt(string language, string expectedCode, string expectedName) { // Arrange @@ -539,7 +539,7 @@ public class Id3TagMapperTests [InlineData("minidisc", MusicMediaFormat.MiniDisc)] [InlineData("8cm cd", MusicMediaFormat.Cm8CD)] [InlineData("dat", MusicMediaFormat.DAT)] - [InlineData("vinyl disc", MusicMediaFormat.VinylDisc)] // parsed through the normalized fallback + [InlineData("vinyl disc", MusicMediaFormat.VinylDisc)] // Parsed through the normalized fallback. [InlineData("other", MusicMediaFormat.Other)] public void MapAlbum_WhenTheMediaFormatIsKnown_ShouldMapIt(string mediaFormat, MusicMediaFormat expected) { @@ -955,7 +955,7 @@ public class Id3TagMapperTests [InlineData("Fm", MusicKey.FMinor)] [InlineData("G", MusicKey.GMajor)] [InlineData("Gm", MusicKey.GMinor)] - [InlineData("E\u266d", MusicKey.DSharpMajor)] // the flat sign is normalized to the sharp equivalent + [InlineData("E\u266d", MusicKey.DSharpMajor)] // The flat sign is normalized to the sharp equivalent. [InlineData("F# major", MusicKey.FSharpMajor)] [InlineData("Gb", MusicKey.FSharpMajor)] [InlineData("G#m", MusicKey.GSharpMinor)] diff --git a/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Tags/AudioContainerResolverTests.cs b/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Tags/AudioContainerResolverTests.cs index 009a26da..6c295d4b 100644 --- a/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Tags/AudioContainerResolverTests.cs +++ b/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Tags/AudioContainerResolverTests.cs @@ -12,12 +12,12 @@ namespace Lumina.Plugins.ID3.UnitTests.Core.Tags; public class AudioContainerResolverTests { [Theory] - [InlineData(null, null)] // an absent mime type leaves the container unrecognized - [InlineData("", null)] // an empty mime type leaves the container unrecognized - [InlineData(" ", null)] // a blank mime type leaves the container unrecognized - [InlineData("taglib/wav", "WAV")] // the taglib prefix is dropped and the container is upper cased - [InlineData("taglib/png", "PNG")] // a container the resolver has no dedicated parser for still yields its name - [InlineData("audio/x-wavpack", "X-WAVPACK")] // the last segment of a standard mime type names the container + [InlineData(null, null)] // An absent mime type leaves the container unrecognized. + [InlineData("", null)] // An empty mime type leaves the container unrecognized. + [InlineData(" ", null)] // A blank mime type leaves the container unrecognized. + [InlineData("taglib/wav", "WAV")] // The taglib prefix is dropped and the container is upper cased. + [InlineData("taglib/png", "PNG")] // A container the resolver has no dedicated parser for still yields its name. + [InlineData("audio/x-wavpack", "X-WAVPACK")] // The last segment of a standard mime type names the container. public void ResolveFromMimeType_WhenCalled_ShouldReturnTheContainerNamedByTheMimeType(string? mimeType, string? expectedContainer) { // Act diff --git a/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Tags/Id3TagReaderTests.cs b/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Tags/Id3TagReaderTests.cs index 72cb56cf..2821adf7 100644 --- a/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Tags/Id3TagReaderTests.cs +++ b/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Tags/Id3TagReaderTests.cs @@ -37,8 +37,8 @@ public class Id3TagReaderTests : IDisposable } [Theory] - [InlineData("")] // an empty path - [InlineData(" ")] // a white space path + [InlineData("")] // An empty path. + [InlineData(" ")] // A white space path. public void Read_WhenPathIsEmptyOrWhiteSpace_ShouldReturnNull(string path) { // Act diff --git a/tests/UnitTests/Lumina.Plugins.LocalMusicArtwork.UnitTests/Core/Settings/LocalMusicArtworkSettingsProviderTests.cs b/tests/UnitTests/Lumina.Plugins.LocalMusicArtwork.UnitTests/Core/Settings/LocalMusicArtworkSettingsProviderTests.cs index 4835b085..4267a133 100644 --- a/tests/UnitTests/Lumina.Plugins.LocalMusicArtwork.UnitTests/Core/Settings/LocalMusicArtworkSettingsProviderTests.cs +++ b/tests/UnitTests/Lumina.Plugins.LocalMusicArtwork.UnitTests/Core/Settings/LocalMusicArtworkSettingsProviderTests.cs @@ -67,10 +67,10 @@ public class LocalMusicArtworkSettingsProviderTests } [Theory] - [InlineData("false", true, false)] // a stored value disables extraction over a default that enables it - [InlineData("true", false, true)] // a stored value enables extraction over a default that disables it - [InlineData("True", false, true)] // the stored value is parsed without regard to casing - [InlineData("FALSE", true, false)] // the stored value is parsed without regard to casing + [InlineData("false", true, false)] // A stored value disables extraction over a default that enables it. + [InlineData("true", false, true)] // A stored value enables extraction over a default that disables it. + [InlineData("True", false, true)] // The stored value is parsed without regard to casing. + [InlineData("FALSE", true, false)] // The stored value is parsed without regard to casing. public async Task GetAsync_WhenTheSettingIsPersisted_ShouldOverlayItOverTheDefaults(string storedValue, bool defaultValue, bool expectedValue) { // Arrange diff --git a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Common/Models/Contracts/Responses/MusicBrainzAliasResponseTests.cs b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Common/Models/Contracts/Responses/MusicBrainzAliasResponseTests.cs index 6be62d2e..c497f0e8 100644 --- a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Common/Models/Contracts/Responses/MusicBrainzAliasResponseTests.cs +++ b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Common/Models/Contracts/Responses/MusicBrainzAliasResponseTests.cs @@ -16,7 +16,7 @@ public class MusicBrainzAliasResponseTests public void IsEnded_WhenTheMusicBrainzApiReturnsNull_ShouldDeserializeAsNull() { // Arrange - // the MusicBrainz search API can return a null ended flag for aliases, which used to break deserialization into a non-nullable boolean + // The MusicBrainz search API can return a null ended flag for aliases, which used to break deserialization into a non-nullable boolean. const string JSON = """{"name":"Rammstein","ended":null}"""; // Act diff --git a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Common/Models/Contracts/Responses/MusicBrainzLifeSpanResponseTests.cs b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Common/Models/Contracts/Responses/MusicBrainzLifeSpanResponseTests.cs index 38ee4e0c..ed696d2a 100644 --- a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Common/Models/Contracts/Responses/MusicBrainzLifeSpanResponseTests.cs +++ b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Common/Models/Contracts/Responses/MusicBrainzLifeSpanResponseTests.cs @@ -16,7 +16,7 @@ public class MusicBrainzLifeSpanResponseTests public void IsEnded_WhenTheMusicBrainzApiReturnsNull_ShouldDeserializeAsNull() { // Arrange - // the MusicBrainz search API returns a null ended flag for artists whose end status is unknown, which used to break deserialization into a non-nullable boolean + // The MusicBrainz search API returns a null ended flag for artists whose end status is unknown, which used to break deserialization into a non-nullable boolean. const string JSON = """{"begin":"1994-01","ended":null}"""; // Act diff --git a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Api/MusicBrainzHttpClientTests.cs b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Api/MusicBrainzHttpClientTests.cs index ca3a0f9e..7625a4ad 100644 --- a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Api/MusicBrainzHttpClientTests.cs +++ b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Api/MusicBrainzHttpClientTests.cs @@ -65,8 +65,8 @@ public class MusicBrainzHttpClientTests } [Theory] - [InlineData("https://musicbrainz.org/ws/2/")] // the real service - [InlineData("https://mirror.musicbrainz.org/ws/2/")] // a subdomain of the real service + [InlineData("https://musicbrainz.org/ws/2/")] // The real service. + [InlineData("https://mirror.musicbrainz.org/ws/2/")] // A subdomain of the real service. public async Task GetRecordingAsync_WhenTheBaseUrlIsTheRealService_ShouldThrottleTheRequests(string baseUrl) { // Arrange @@ -288,9 +288,9 @@ public class MusicBrainzHttpClientTests } [Theory] - [InlineData(0, "limit=1")] // a limit below the minimum is clamped up - [InlineData(200, "limit=100")] // a limit above the maximum is clamped down - [InlineData(50, "limit=50")] // a limit within the range is kept + [InlineData(0, "limit=1")] // A limit below the minimum is clamped up. + [InlineData(200, "limit=100")] // A limit above the maximum is clamped down. + [InlineData(50, "limit=50")] // A limit within the range is kept. public async Task SearchArtistsAsync_WhenTheLimitIsOutOfRange_ShouldClampIt(int requestedLimit, string expectedQuery) { // Arrange @@ -505,11 +505,11 @@ public class MusicBrainzHttpClientTests } [Theory] - [InlineData("A & B")] // ampersand query separator - [InlineData("Title #fragment")] // fragment separator - [InlineData("A?B")] // query separator - [InlineData("../../secret")] // path traversal - [InlineData("A\" OR \"B")] // quote escape + [InlineData("A & B")] // Ampersand query separator. + [InlineData("Title #fragment")] // Fragment separator. + [InlineData("A?B")] // Query separator. + [InlineData("../../secret")] // Path traversal. + [InlineData("A\" OR \"B")] // Quote escape. public async Task SearchArtistsAsync_WhenTheQueryContainsReservedCharacters_ShouldKeepThemInsideTheQueryString(string searchTerm) { // Arrange diff --git a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Mapping/MusicBrainzMapperTests.cs b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Mapping/MusicBrainzMapperTests.cs index 018ebdf2..7b575157 100644 --- a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Mapping/MusicBrainzMapperTests.cs +++ b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Mapping/MusicBrainzMapperTests.cs @@ -189,13 +189,13 @@ public class MusicBrainzMapperTests } [Theory] - [InlineData("person", MusicArtistType.Person)] // an individual - [InlineData("group", MusicArtistType.Group)] // an ensemble - [InlineData("orchestra", MusicArtistType.Orchestra)] // an instrumental ensemble - [InlineData("choir", MusicArtistType.Choir)] // a vocal ensemble - [InlineData("character", MusicArtistType.Character)] // a fictional character - [InlineData("other", MusicArtistType.Other)] // a known but uncategorized type - [InlineData("PERSON", MusicArtistType.Person)] // the value is normalized + [InlineData("person", MusicArtistType.Person)] // An individual. + [InlineData("group", MusicArtistType.Group)] // An ensemble. + [InlineData("orchestra", MusicArtistType.Orchestra)] // An instrumental ensemble. + [InlineData("choir", MusicArtistType.Choir)] // A vocal ensemble. + [InlineData("character", MusicArtistType.Character)] // A fictional character. + [InlineData("other", MusicArtistType.Other)] // A known but uncategorized type. + [InlineData("PERSON", MusicArtistType.Person)] // The value is normalized. public void MapArtist_WhenTheTypeIsKnown_ShouldMapIt(string type, MusicArtistType expected) { // Arrange @@ -227,7 +227,7 @@ public class MusicBrainzMapperTests [InlineData("female", MusicArtistGender.Female)] [InlineData("other", MusicArtistGender.Other)] [InlineData("not applicable", MusicArtistGender.NotApplicable)] - [InlineData("FEMALE", MusicArtistGender.Female)] // the value is normalized + [InlineData("FEMALE", MusicArtistGender.Female)] // The value is normalized. public void MapArtist_WhenTheGenderIsKnown_ShouldMapIt(string gender, MusicArtistGender expected) { // Act @@ -251,7 +251,7 @@ public class MusicBrainzMapperTests } [Theory] - [InlineData("executive producer", MediaContributorRole.ExecutiveProducer)] // more specific than producer + [InlineData("executive producer", MediaContributorRole.ExecutiveProducer)] // More specific than producer. [InlineData("producer", MediaContributorRole.Producer)] [InlineData("remixer", MediaContributorRole.Remixer)] [InlineData("mix", MediaContributorRole.Mixer)] @@ -703,13 +703,13 @@ public class MusicBrainzMapperTests } [Theory] - [InlineData("1975-11-21", 1975, 11, 21, 1975)] // an exact date is parsed fully - [InlineData("1975", null, 0, 0, 1975)] // a bare year yields only the year - [InlineData("Spring 1975", null, 0, 0, 1975)] // an embedded year is extracted when the value is not a date - [InlineData("not a date", null, 0, 0, null)] // an unparsable value yields nothing - [InlineData("2200", null, 0, 0, null)] // a year outside the accepted window yields nothing - [InlineData("2100", null, 0, 0, 2100)] // the upper boundary is accepted - [InlineData(" 1975-11-21 ", 1975, 11, 21, 1975)] // surrounding white space is trimmed + [InlineData("1975-11-21", 1975, 11, 21, 1975)] // An exact date is parsed fully. + [InlineData("1975", null, 0, 0, 1975)] // A bare year yields only the year. + [InlineData("Spring 1975", null, 0, 0, 1975)] // An embedded year is extracted when the value is not a date. + [InlineData("not a date", null, 0, 0, null)] // An unparsable value yields nothing. + [InlineData("2200", null, 0, 0, null)] // A year outside the accepted window yields nothing. + [InlineData("2100", null, 0, 0, 2100)] // The upper boundary is accepted. + [InlineData(" 1975-11-21 ", 1975, 11, 21, 1975)] // Surrounding white space is trimmed. public void MapAlbum_WhenTheFirstReleaseDateHasVariousShapes_ShouldParseIt(string firstReleaseDate, int? expectedYear, int expectedMonth, int expectedDay, int? expectedParsedYear) { // Arrange @@ -729,10 +729,10 @@ public class MusicBrainzMapperTests [Theory] [InlineData("US", ReleaseCountry.US)] - [InlineData("us", ReleaseCountry.US)] // the code is matched case insensitively - [InlineData("XE", ReleaseCountry.XE)] // the Europe special code - [InlineData("XW", ReleaseCountry.XW)] // the Worldwide special code - [InlineData("AN", ReleaseCountry.AN)] // the Netherlands Antilles special code + [InlineData("us", ReleaseCountry.US)] // The code is matched case insensitively. + [InlineData("XE", ReleaseCountry.XE)] // The Europe special code. + [InlineData("XW", ReleaseCountry.XW)] // The Worldwide special code. + [InlineData("AN", ReleaseCountry.AN)] // The Netherlands Antilles special code. public void MapAlbum_WhenTheReleaseCountryIsKnown_ShouldMapIt(string country, ReleaseCountry expected) { // Arrange @@ -747,9 +747,9 @@ public class MusicBrainzMapperTests } [Theory] - [InlineData("ZZ")] // a valid shape but not a known code - [InlineData("")] // an empty value - [InlineData(" ")] // only white space + [InlineData("ZZ")] // A valid shape but not a known code. + [InlineData("")] // An empty value. + [InlineData(" ")] // Only white space. public void MapAlbum_WhenTheReleaseCountryIsUnknown_ShouldReturnNullCountry(string country) { // Arrange @@ -863,7 +863,7 @@ public class MusicBrainzMapperTests [InlineData("8cm cd", MusicMediaFormat.Cm8CD)] [InlineData("dat", MusicMediaFormat.DAT)] [InlineData("other", MusicMediaFormat.Other)] - [InlineData("made-up", MusicMediaFormat.Other)] // an unknown format still maps to Other + [InlineData("made-up", MusicMediaFormat.Other)] // An unknown format still maps to Other. public void MapAlbum_WhenTheMediaFormatIsKnownOrUnknownButPresent_ShouldMapIt(string format, MusicMediaFormat expected) { // Arrange @@ -909,7 +909,7 @@ public class MusicBrainzMapperTests [InlineData("super jewel box", MusicReleasePackaging.SuperJewelBox)] [InlineData("none", MusicReleasePackaging.None)] [InlineData("other", MusicReleasePackaging.Other)] - [InlineData("made-up", MusicReleasePackaging.Other)] // an unknown packaging still maps to Other + [InlineData("made-up", MusicReleasePackaging.Other)] // An unknown packaging still maps to Other. public void MapAlbum_WhenThePackagingIsKnownOrUnknownButPresent_ShouldMapIt(string packaging, MusicReleasePackaging expected) { // Arrange @@ -1051,7 +1051,7 @@ public class MusicBrainzMapperTests Assert.Null(result.Channels); Assert.Null(result.BitDepth); Assert.Null(result.AudioCodec); - Assert.Null(result.Container); // a metadata provider never supplies the container, which is captured locally from the file + Assert.Null(result.Container); // A metadata provider never supplies the container, which is captured locally from the file. Assert.Null(result.Bitrate); Assert.Equal(recordingId, result.MusicBrainzRecordingId); Assert.Null(result.MusicBrainzTrackId); @@ -1111,10 +1111,10 @@ public class MusicBrainzMapperTests } [Theory] - [InlineData(null, null)] // no length at all - [InlineData(0L, null)] // a zero length is treated as unknown - [InlineData(-100L, null)] // a negative length is treated as unknown - [InlineData(1500L, 1)] // milliseconds are truncated to whole seconds + [InlineData(null, null)] // No length at all. + [InlineData(0L, null)] // A zero length is treated as unknown. + [InlineData(-100L, null)] // A negative length is treated as unknown. + [InlineData(1500L, 1)] // Milliseconds are truncated to whole seconds. [InlineData(215_400L, 215)] public void MapTrack_WhenTheRecordingHasALength_ShouldMapTheDurationInSeconds(long? length, int? expectedSeconds) { @@ -1199,7 +1199,7 @@ public class MusicBrainzMapperTests } [Theory] - [InlineData(1.0)] // a value only + [InlineData(1.0)] // A value only. [InlineData(2.5)] public void MapArtist_WhenOnlyTheRatingValueIsPresent_ShouldMapItWithANullVoteCount(decimal value) { @@ -1262,16 +1262,16 @@ public class MusicBrainzMapperTests } [Theory] - [InlineData("eng", "en", "English")] // a three letter code maps to the neutral culture + [InlineData("eng", "en", "English")] // A three letter code maps to the neutral culture. [InlineData("deu", "de", "German")] - [InlineData("en", "en", "English")] // a two letter code maps too - [InlineData("zxx", "zxx", "No linguistic content")] // a special MusicBrainz code + [InlineData("en", "en", "English")] // A two letter code maps too. + [InlineData("zxx", "zxx", "No linguistic content")] // A special MusicBrainz code. [InlineData("mul", "mul", "Multiple languages")] [InlineData("und", "und", "Undetermined")] - [InlineData("eng/ara", "en", "English")] // only the first code of a multi language value is used - [InlineData("/", "/", "/")] // a value with no usable part falls back to the raw code - [InlineData(" eng ", "en", "English")] // surrounding white space is trimmed - [InlineData("qqq", "qqq", "qqq")] // an unknown code falls back to the raw code + [InlineData("eng/ara", "en", "English")] // Only the first code of a multi language value is used. + [InlineData("/", "/", "/")] // A value with no usable part falls back to the raw code. + [InlineData(" eng ", "en", "English")] // Surrounding white space is trimmed. + [InlineData("qqq", "qqq", "qqq")] // An unknown code falls back to the raw code. public void MapTrack_WhenTheLanguageCodeIsPresent_ShouldMapIt(string language, string expectedCode, string expectedName) { // Arrange diff --git a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/MusicBrainzAlbumMetadataProviderTests.cs b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/MusicBrainzAlbumMetadataProviderTests.cs index 817b050a..44d284bd 100644 --- a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/MusicBrainzAlbumMetadataProviderTests.cs +++ b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/MusicBrainzAlbumMetadataProviderTests.cs @@ -115,7 +115,7 @@ public class MusicBrainzAlbumMetadataProviderTests Assert.Equal("Other Album", result[1].Title); Assert.Equal(1, handler.CallCount); Assert.Contains("limit=10", handler.Requests[0].RequestUri!.Query); - // the quotes are removed from the built query, and the artist constraint is appended + // The quotes are removed from the built query, and the artist constraint is appended. string query = Uri.UnescapeDataString(handler.Requests[0].RequestUri!.Query); Assert.Contains("releasegroup:\"The Album\"", query); Assert.Contains("AND artist:\"The Artist\"", query); @@ -231,7 +231,7 @@ public class MusicBrainzAlbumMetadataProviderTests Assert.NotNull(result); Assert.Equal("The Album", result.Title); Assert.Equal(s_releaseGroupId, result.MusicBrainzReleaseGroupId); - // the search, the detail lookup and the release browse are all used + // The search, the detail lookup and the release browse are all used. Assert.Equal(3, handler.CallCount); Assert.Contains("limit=1", handler.Requests[0].RequestUri!.Query); } @@ -461,7 +461,7 @@ public class MusicBrainzAlbumMetadataProviderTests // Assert Assert.NotNull(result); Assert.NotNull(result.CatalogNumbers); - // every distinct catalog number is kept, while the duplicates are removed. + // Every distinct catalog number is kept, while the duplicates are removed. Assert.Equal(["EMC 4008", "0C 066-98 485"], result.CatalogNumbers); Assert.Equal("EMI", result.Label); } diff --git a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/MusicBrainzArtistMetadataProviderTests.cs b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/MusicBrainzArtistMetadataProviderTests.cs index 514babe0..8058362c 100644 --- a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/MusicBrainzArtistMetadataProviderTests.cs +++ b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/MusicBrainzArtistMetadataProviderTests.cs @@ -113,7 +113,7 @@ public class MusicBrainzArtistMetadataProviderTests Assert.Equal("The Artist", result[0].Name); Assert.Equal("Other Artist", result[1].Name); Assert.Equal(1, handler.CallCount); - // the name is trimmed and the configured search result limit is used + // The name is trimmed and the configured search result limit is used. Assert.Contains("limit=10", handler.Requests[0].RequestUri!.Query); Assert.Contains("query=The%20Artist", handler.Requests[0].RequestUri!.Query); } @@ -227,7 +227,7 @@ public class MusicBrainzArtistMetadataProviderTests Assert.Equal("The Artist", result.Name); Assert.Equal(MusicArtistType.Group, result.Type); Assert.Null(result.MusicBrainzArtistId); - // the search is used, and the per identifier lookup must not be requested + // The search is used, and the per identifier lookup must not be requested. Assert.Equal(1, handler.CallCount); } diff --git a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Settings/MusicBrainzSettingsProviderTests.cs b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Settings/MusicBrainzSettingsProviderTests.cs index 00c0643e..6b04da68 100644 --- a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Settings/MusicBrainzSettingsProviderTests.cs +++ b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Settings/MusicBrainzSettingsProviderTests.cs @@ -89,10 +89,10 @@ public class MusicBrainzSettingsProviderTests } [Theory] - [InlineData("not-a-url")] // a value that is not an URI at all - [InlineData("ftp://mirror.example/")] // an absolute URI with an unsupported scheme - [InlineData("relative/path")] // a relative URI - [InlineData(" ")] // only white space + [InlineData("not-a-url")] // A value that is not an URI at all. + [InlineData("ftp://mirror.example/")] // An absolute URI with an unsupported scheme. + [InlineData("relative/path")] // A relative URI. + [InlineData(" ")] // Only white space. public async Task GetAsync_WhenThePersistedBaseUrlIsInvalid_ShouldKeepTheDefaultBaseUrl(string baseUrl) { // Arrange @@ -109,15 +109,15 @@ public class MusicBrainzSettingsProviderTests } [Theory] - [InlineData("http://127.0.0.1/ws/2/")] // IPv4 loopback - [InlineData("http://localhost/ws/2/")] // loopback host name - [InlineData("http://[::1]/ws/2/")] // IPv6 loopback - [InlineData("http://169.254.169.254/latest/meta-data/")] // link local cloud metadata endpoint - [InlineData("http://10.0.0.5/ws/2/")] // private class A range - [InlineData("http://172.16.0.1/ws/2/")] // private class B range - [InlineData("http://192.168.1.10/ws/2/")] // private class C range - [InlineData("http://0.0.0.0/ws/2/")] // unspecified address - [InlineData("http://[fc00::1]/ws/2/")] // IPv6 unique local range + [InlineData("http://127.0.0.1/ws/2/")] // IPv4 loopback. + [InlineData("http://localhost/ws/2/")] // Loopback host name. + [InlineData("http://[::1]/ws/2/")] // IPv6 loopback. + [InlineData("http://169.254.169.254/latest/meta-data/")] // Link local cloud metadata endpoint. + [InlineData("http://10.0.0.5/ws/2/")] // Private class A range. + [InlineData("http://172.16.0.1/ws/2/")] // Private class B range. + [InlineData("http://192.168.1.10/ws/2/")] // Private class C range. + [InlineData("http://0.0.0.0/ws/2/")] // Unspecified address. + [InlineData("http://[fc00::1]/ws/2/")] // IPv6 unique local range. public async Task GetAsync_WhenThePersistedBaseUrlPointsAtALocalOrPrivateHost_ShouldKeepTheDefaultBaseUrl(string baseUrl) { // Arrange @@ -134,9 +134,9 @@ public class MusicBrainzSettingsProviderTests } [Theory] - [InlineData("http://192.168.1.10/ws/2/")] // private class C range, a typical self hosted mirror - [InlineData("http://localhost/ws/2/")] // loopback host name - [InlineData("http://[fc00::1]/ws/2/")] // IPv6 unique local range + [InlineData("http://192.168.1.10/ws/2/")] // Private class C range, a typical self hosted mirror. + [InlineData("http://localhost/ws/2/")] // Loopback host name. + [InlineData("http://[fc00::1]/ws/2/")] // IPv6 unique local range. public async Task GetAsync_WhenPrivateBaseUrlsAreExplicitlyAllowed_ShouldApplyThem(string baseUrl) { // Arrange @@ -157,11 +157,11 @@ public class MusicBrainzSettingsProviderTests } [Theory] - [InlineData("user\r\n@example.com")] // carriage return and line feed injection - [InlineData("user@example.com\r\nX-Injected: value")] // header injection attempt - [InlineData("user(comment)@example.com")] // parentheses break the user agent comment - [InlineData("user\"quoted\"@example.com")] // quotes break the header value - [InlineData("user example@example.com")] // an inner space is not a valid token character + [InlineData("user\r\n@example.com")] // Carriage return and line feed injection. + [InlineData("user@example.com\r\nX-Injected: value")] // Header injection attempt. + [InlineData("user(comment)@example.com")] // Parentheses break the user agent comment. + [InlineData("user\"quoted\"@example.com")] // Quotes break the header value. + [InlineData("user example@example.com")] // An inner space is not a valid token character. public async Task GetAsync_WhenThePersistedContactEmailContainsUnsafeCharacters_ShouldDropIt(string storedEmail) { // Arrange @@ -210,9 +210,9 @@ public class MusicBrainzSettingsProviderTests } [Theory] - [InlineData("", null)] // an empty value clears the email - [InlineData(" ", null)] // a white space value clears the email - [InlineData(" user@example.com ", "user@example.com")] // a value with surrounding white space is trimmed + [InlineData("", null)] // An empty value clears the email. + [InlineData(" ", null)] // A white space value clears the email. + [InlineData(" user@example.com ", "user@example.com")] // A value with surrounding white space is trimmed. public async Task GetAsync_WhenThePersistedContactEmailIsPresent_ShouldSetOrClearIt(string storedEmail, string? expectedEmail) { // Arrange @@ -230,9 +230,9 @@ public class MusicBrainzSettingsProviderTests [Theory] [InlineData("42", 42)] - [InlineData("0", 1)] // a limit of zero is clamped to one - [InlineData("-5", 1)] // a negative limit is clamped to one - [InlineData("not-a-number", 10)] // an unparsable value keeps the default + [InlineData("0", 1)] // A limit of zero is clamped to one. + [InlineData("-5", 1)] // A negative limit is clamped to one. + [InlineData("not-a-number", 10)] // An unparsable value keeps the default. public async Task GetAsync_WhenThePersistedSearchResultLimitIsPresent_ShouldParseAndClampIt(string storedLimit, int expectedLimit) { // Arrange @@ -250,9 +250,9 @@ public class MusicBrainzSettingsProviderTests [Theory] [InlineData("30", 30)] - [InlineData("0", 1)] // a limit of zero is clamped to one - [InlineData("-5", 1)] // a negative limit is clamped to one - [InlineData("not-a-number", 25)] // an unparsable value keeps the default + [InlineData("0", 1)] // A limit of zero is clamped to one. + [InlineData("-5", 1)] // A negative limit is clamped to one. + [InlineData("not-a-number", 25)] // An unparsable value keeps the default. public async Task GetAsync_WhenThePersistedReleaseLookupLimitIsPresent_ShouldParseAndClampIt(string storedLimit, int expectedLimit) { // Arrange @@ -270,9 +270,9 @@ public class MusicBrainzSettingsProviderTests [Theory] [InlineData("2.5", 2.5)] - [InlineData("0", 0)] // an interval of zero is allowed - [InlineData("-3", 0)] // a negative interval is clamped to zero - [InlineData("not-a-number", 1)] // an unparsable value keeps the default + [InlineData("0", 0)] // An interval of zero is allowed. + [InlineData("-3", 0)] // A negative interval is clamped to zero. + [InlineData("not-a-number", 1)] // An unparsable value keeps the default. public async Task GetAsync_WhenThePersistedMinimumRequestIntervalIsPresent_ShouldParseAndClampIt(string storedInterval, double expectedSeconds) { // Arrange diff --git a/tests/UnitTests/Lumina.Plugins.OpenLibrary.UnitTests/Core/Settings/OpenLibrarySettingsLoaderTests.cs b/tests/UnitTests/Lumina.Plugins.OpenLibrary.UnitTests/Core/Settings/OpenLibrarySettingsLoaderTests.cs index 515d4e15..8d45094a 100644 --- a/tests/UnitTests/Lumina.Plugins.OpenLibrary.UnitTests/Core/Settings/OpenLibrarySettingsLoaderTests.cs +++ b/tests/UnitTests/Lumina.Plugins.OpenLibrary.UnitTests/Core/Settings/OpenLibrarySettingsLoaderTests.cs @@ -98,11 +98,11 @@ public class OpenLibrarySettingsLoaderTests } [Theory] - [InlineData("user\r\n@example.com")] // carriage return and line feed injection - [InlineData("user@example.com\r\nX-Injected: value")] // header injection attempt - [InlineData("user(comment)@example.com")] // parentheses break the from header - [InlineData("user\"quoted\"@example.com")] // quotes break the header value - [InlineData("user example@example.com")] // an inner space is not a valid token character + [InlineData("user\r\n@example.com")] // Carriage return and line feed injection. + [InlineData("user@example.com\r\nX-Injected: value")] // Header injection attempt. + [InlineData("user(comment)@example.com")] // Parentheses break the from header. + [InlineData("user\"quoted\"@example.com")] // Quotes break the header value. + [InlineData("user example@example.com")] // An inner space is not a valid token character. public void Apply_WhenContactEmailContainsUnsafeCharacters_ShouldSetItToNull(string storedEmail) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Common/MimeTypes/ImageMimeTypesTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Common/MimeTypes/ImageMimeTypesTests.cs index 7764d573..a893eac3 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Common/MimeTypes/ImageMimeTypesTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Common/MimeTypes/ImageMimeTypesTests.cs @@ -13,11 +13,11 @@ namespace Lumina.Presentation.Api.UnitTests.Common.MimeTypes; public class ImageMimeTypesTests { [Theory] - [InlineData(ImageType.BMP, "image/bmp")] // bmp image type - [InlineData(ImageType.JPEG, "image/jpeg")] // jpeg image type - [InlineData(ImageType.JPEG_CANON, "image/jpeg")] // canon jpeg image type - [InlineData(ImageType.SVG, "image/svg+xml")] // svg image type - [InlineData(ImageType.TGA, "image/x-tga")] // tga image type + [InlineData(ImageType.BMP, "image/bmp")] // BMP image type. + [InlineData(ImageType.JPEG, "image/jpeg")] // JPEG image type. + [InlineData(ImageType.JPEG_CANON, "image/jpeg")] // Canon JPEG image type. + [InlineData(ImageType.SVG, "image/svg+xml")] // SVG image type. + [InlineData(ImageType.TGA, "image/x-tga")] // TGA image type. public void GetMimeType_WhenTypeIsKnown_ShouldReturnTheMappedMimeType(ImageType type, string expectedMimeType) { // Act @@ -28,8 +28,8 @@ public class ImageMimeTypesTests } [Theory] - [InlineData(ImageType.None)] // the none image type has no mime mapping - [InlineData((ImageType)999)] // an unknown image type has no mime mapping + [InlineData(ImageType.None)] // The none image type has no mime mapping. + [InlineData((ImageType)999)] // An unknown image type has no mime mapping. public void GetMimeType_WhenTypeIsUnknown_ShouldReturnOpaqueBinaryMimeType(ImageType type) { // Act diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Common/MimeTypes/MusicMimeTypesTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Common/MimeTypes/MusicMimeTypesTests.cs index 56e314f3..8945e4a0 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Common/MimeTypes/MusicMimeTypesTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Common/MimeTypes/MusicMimeTypesTests.cs @@ -13,20 +13,20 @@ namespace Lumina.Presentation.Api.UnitTests.Common.MimeTypes; public class MusicMimeTypesTests { [Theory] - [InlineData(AudioFileFormat.MP3, "audio/mpeg")] // mp3 audio format - [InlineData(AudioFileFormat.FLAC, "audio/flac")] // flac audio format - [InlineData(AudioFileFormat.M4A, "audio/mp4")] // m4a audio format - [InlineData(AudioFileFormat.AAC, "audio/aac")] // aac audio format - [InlineData(AudioFileFormat.OGG, "audio/ogg")] // ogg audio format - [InlineData(AudioFileFormat.OPUS, "audio/ogg")] // opus audio format - [InlineData(AudioFileFormat.WAV, "audio/wav")] // wav audio format - [InlineData(AudioFileFormat.WMA, "audio/x-ms-wma")] // wma audio format - [InlineData(AudioFileFormat.AIFF, "audio/aiff")] // aiff audio format - [InlineData(AudioFileFormat.APE, "audio/x-ape")] // ape audio format - [InlineData(AudioFileFormat.WAVPACK, "audio/x-wavpack")] // wavpack audio format - [InlineData(AudioFileFormat.DSF, "audio/x-dsf")] // dsf audio format - [InlineData(AudioFileFormat.DFF, "audio/x-dff")] // dff audio format - [InlineData(AudioFileFormat.MATROSKA, "audio/x-matroska")] // matroska audio format + [InlineData(AudioFileFormat.MP3, "audio/mpeg")] // MP3 audio format. + [InlineData(AudioFileFormat.FLAC, "audio/flac")] // FLAC audio format. + [InlineData(AudioFileFormat.M4A, "audio/mp4")] // M4A audio format. + [InlineData(AudioFileFormat.AAC, "audio/aac")] // AAC audio format. + [InlineData(AudioFileFormat.OGG, "audio/ogg")] // OGG audio format. + [InlineData(AudioFileFormat.OPUS, "audio/ogg")] // Opus audio format. + [InlineData(AudioFileFormat.WAV, "audio/wav")] // WAV audio format. + [InlineData(AudioFileFormat.WMA, "audio/x-ms-wma")] // WMA audio format. + [InlineData(AudioFileFormat.AIFF, "audio/aiff")] // AIFF audio format. + [InlineData(AudioFileFormat.APE, "audio/x-ape")] // APE audio format. + [InlineData(AudioFileFormat.WAVPACK, "audio/x-wavpack")] // WavPack audio format. + [InlineData(AudioFileFormat.DSF, "audio/x-dsf")] // DSF audio format. + [InlineData(AudioFileFormat.DFF, "audio/x-dff")] // DFF audio format. + [InlineData(AudioFileFormat.MATROSKA, "audio/x-matroska")] // Matroska audio format. public void GetMimeType_WhenFormatIsKnown_ShouldReturnMappedMimeType(AudioFileFormat format, string expectedMimeType) { // Act @@ -37,8 +37,8 @@ public class MusicMimeTypesTests } [Theory] - [InlineData(AudioFileFormat.None)] // the none audio format has no mime mapping - [InlineData((AudioFileFormat)999)] // an unknown audio format has no mime mapping + [InlineData(AudioFileFormat.None)] // The none audio format has no mime mapping. + [InlineData((AudioFileFormat)999)] // An unknown audio format has no mime mapping. public void GetMimeType_WhenFormatIsUnknown_ShouldReturnOpaqueBinaryMimeType(AudioFileFormat format) { // Act @@ -49,14 +49,14 @@ public class MusicMimeTypesTests } [Theory] - [InlineData("MP3", "audio/mpeg")] // mp3 container - [InlineData("FLAC", "audio/flac")] // flac container - [InlineData("MP4", "audio/mp4")] // mp4 container - [InlineData("M4A", "audio/mp4")] // m4a container - [InlineData("AAC", "audio/aac")] // aac container - [InlineData("OGG", "audio/ogg")] // ogg container - [InlineData("OPUS", "audio/ogg")] // opus container - [InlineData("WAV", "audio/wav")] // wav container + [InlineData("MP3", "audio/mpeg")] // MP3 container. + [InlineData("FLAC", "audio/flac")] // FLAC container. + [InlineData("MP4", "audio/mp4")] // MP4 container. + [InlineData("M4A", "audio/mp4")] // M4A container. + [InlineData("AAC", "audio/aac")] // AAC container. + [InlineData("OGG", "audio/ogg")] // OGG container. + [InlineData("OPUS", "audio/ogg")] // Opus container. + [InlineData("WAV", "audio/wav")] // WAV container. public void GetContainerMimeType_WhenContainerIsMapped_ShouldReturnMappedMimeType(string container, string expectedMimeType) { // Act @@ -67,10 +67,10 @@ public class MusicMimeTypesTests } [Theory] - [InlineData("mp3", "audio/mpeg")] // lowercase mp3 container - [InlineData("Flac", "audio/flac")] // mixed case flac container - [InlineData("mP4", "audio/mp4")] // mixed case mp4 container - [InlineData("opus", "audio/ogg")] // lowercase opus container + [InlineData("mp3", "audio/mpeg")] // Lowercase MP3 container. + [InlineData("Flac", "audio/flac")] // Mixed case FLAC container. + [InlineData("mP4", "audio/mp4")] // Mixed case MP4 container. + [InlineData("opus", "audio/ogg")] // Lowercase Opus container. public void GetContainerMimeType_WhenContainerDiffersInCase_ShouldReturnMappedMimeType(string container, string expectedMimeType) { // Act @@ -81,9 +81,9 @@ public class MusicMimeTypesTests } [Theory] - [InlineData(" MP3 ", "audio/mpeg")] // leading and trailing whitespace around mp3 - [InlineData("\tOGG", "audio/ogg")] // leading tab around ogg - [InlineData("WAV\n", "audio/wav")] // trailing newline around wav + [InlineData(" MP3 ", "audio/mpeg")] // Leading and trailing whitespace around MP3. + [InlineData("\tOGG", "audio/ogg")] // Leading tab around OGG. + [InlineData("WAV\n", "audio/wav")] // Trailing newline around WAV. public void GetContainerMimeType_WhenContainerHasSurroundingWhitespace_ShouldReturnMappedMimeType(string container, string expectedMimeType) { // Act @@ -94,11 +94,11 @@ public class MusicMimeTypesTests } [Theory] - [InlineData(null)] // an absent container has no mime mapping - [InlineData("")] // an empty container has no mime mapping - [InlineData(" ")] // a whitespace only container has no mime mapping - [InlineData("WMA")] // a known file format that is not a mapped delivery container - [InlineData("not-a-container")] // an unknown container has no mime mapping + [InlineData(null)] // An absent container has no mime mapping. + [InlineData("")] // An empty container has no mime mapping. + [InlineData(" ")] // A whitespace only container has no mime mapping. + [InlineData("WMA")] // A known file format that is not a mapped delivery container. + [InlineData("not-a-container")] // An unknown container has no mime mapping. public void GetContainerMimeType_WhenContainerIsUnknown_ShouldReturnOpaqueBinaryMimeType(string? container) { // Act diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackSegment/GetTrackSegmentEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackSegment/GetTrackSegmentEndpointTests.cs index 1271be84..eea13b8b 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackSegment/GetTrackSegmentEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackSegment/GetTrackSegmentEndpointTests.cs @@ -43,10 +43,10 @@ public class GetTrackSegmentEndpointTests } [Theory] - [InlineData("MP4", "audio/mp4")] // mp4 delivery container - [InlineData("OGG", "audio/ogg")] // ogg delivery container - [InlineData("MP3", "audio/mpeg")] // mp3 delivery container - [InlineData("not-a-container", "application/octet-stream")] // an unknown delivery container falls back to opaque binary + [InlineData("MP4", "audio/mp4")] // MP4 delivery container. + [InlineData("OGG", "audio/ogg")] // OGG delivery container. + [InlineData("MP3", "audio/mpeg")] // MP3 delivery container. + [InlineData("not-a-container", "application/octet-stream")] // An unknown delivery container falls back to opaque binary. public async Task ExecuteAsync_WhenSegmentIsProduced_ShouldReturnDisposingStreamResultWithTheSegment(string container, string expectedContentType) { // Arrange @@ -135,9 +135,9 @@ public class GetTrackSegmentEndpointTests } [Theory] - [InlineData("NotFound", StatusCodes.Status404NotFound)] // the delivery, track or segment does not exist - [InlineData("Conflict", StatusCodes.Status409Conflict)] // the delivery changed since the manifest declared it - [InlineData("ResourceUnavailable", StatusCodes.Status503ServiceUnavailable)] // the normalization pipeline is temporarily unavailable + [InlineData("NotFound", StatusCodes.Status404NotFound)] // The delivery, track or segment does not exist. + [InlineData("Conflict", StatusCodes.Status409Conflict)] // The delivery changed since the manifest declared it. + [InlineData("ResourceUnavailable", StatusCodes.Status503ServiceUnavailable)] // The normalization pipeline is temporarily unavailable. public async Task ExecuteAsync_WhenHandlerReturnsAProblemError_ShouldReturnTheMappedStatusCode(string errorKind, int expectedStatusCode) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackStream/GetTrackStreamEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackStream/GetTrackStreamEndpointTests.cs index 723bdad1..694748e2 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackStream/GetTrackStreamEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrackStream/GetTrackStreamEndpointTests.cs @@ -75,10 +75,10 @@ public class GetTrackStreamEndpointTests } [Theory] - [InlineData(AudioFileFormat.MP3, "audio/mpeg")] // mp3 audio - [InlineData(AudioFileFormat.FLAC, "audio/flac")] // flac audio - [InlineData(AudioFileFormat.OGG, "audio/ogg")] // ogg audio - [InlineData(AudioFileFormat.None, "application/octet-stream")] // an unrecognized format stays opaque binary + [InlineData(AudioFileFormat.MP3, "audio/mpeg")] // MP3 audio. + [InlineData(AudioFileFormat.FLAC, "audio/flac")] // FLAC audio. + [InlineData(AudioFileFormat.OGG, "audio/ogg")] // OGG audio. + [InlineData(AudioFileFormat.None, "application/octet-stream")] // An unrecognized format stays opaque binary. public async Task ExecuteAsync_WhenSuccessful_ShouldServeTheMediaTypeOfTheFormat(AudioFileFormat format, string expectedContentType) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs index 997f9de9..657714b9 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs @@ -115,18 +115,18 @@ public class GetReadingResourceEndpointTests } [Theory] - [InlineData("image/png", "image/png")] // a non-svg image is inert content - [InlineData("image/svg+xml", "application/octet-stream")] // an svg can be executed, so it is served as an opaque download - [InlineData("audio/mpeg", "audio/mpeg")] // audio is inert content - [InlineData("video/mp4", "video/mp4")] // video is inert content - [InlineData("font/woff2", "font/woff2")] // fonts are inert content - [InlineData("application/font-woff", "application/font-woff")] // legacy woff font media type - [InlineData("application/font-woff2", "application/font-woff2")] // legacy woff2 font media type - [InlineData("application/vnd.ms-opentype", "application/vnd.ms-opentype")] // opentype font media type - [InlineData("application/x-font-ttf", "application/x-font-ttf")] // ttf font media type - [InlineData("application/x-font-opentype", "application/x-font-opentype")] // otf font media type - [InlineData("text/css", "text/css")] // stylesheets are inert content - [InlineData("text/html", "application/octet-stream")] // an html document can be executed, so it is served as an opaque download + [InlineData("image/png", "image/png")] // A non-svg image is inert content. + [InlineData("image/svg+xml", "application/octet-stream")] // An svg can be executed, so it is served as an opaque download. + [InlineData("audio/mpeg", "audio/mpeg")] // Audio is inert content. + [InlineData("video/mp4", "video/mp4")] // Video is inert content. + [InlineData("font/woff2", "font/woff2")] // Fonts are inert content. + [InlineData("application/font-woff", "application/font-woff")] // Legacy woff font media type. + [InlineData("application/font-woff2", "application/font-woff2")] // Legacy woff2 font media type. + [InlineData("application/vnd.ms-opentype", "application/vnd.ms-opentype")] // Opentype font media type. + [InlineData("application/x-font-ttf", "application/x-font-ttf")] // Ttf font media type. + [InlineData("application/x-font-opentype", "application/x-font-opentype")] // Otf font media type. + [InlineData("text/css", "text/css")] // Stylesheets are inert content. + [InlineData("text/html", "application/octet-stream")] // An html document can be executed, so it is served as an opaque download. public async Task ExecuteAsync_WhenServingAResource_ShouldUseTheSafeContentType(string mimeType, string expectedContentType) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs index 22d0c303..29d33cf4 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs @@ -170,7 +170,7 @@ public class InstallPluginEndpointTests private void ConfigureFormWithArchive(byte[] content, string fileName) { - // the stream stays open for the duration of the test, since the endpoint reads it through the form file during execution + // The stream stays open for the duration of the test, since the endpoint reads it through the form file during execution. MemoryStream archiveStream = new(content); IFormFile formFile = new FormFile(archiveStream, 0, content.Length, "archive", fileName); FormFileCollection files = [formFile]; diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs index 4a93b17d..0c15e294 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Themes/Management/InstallTheme/InstallThemeEndpointTests.cs @@ -181,7 +181,7 @@ public class InstallThemeEndpointTests private void ConfigureFormWithArchive(byte[] content, string fileName) { - // the stream stays open for the duration of the test, since the endpoint reads it through the form file during execution + // The stream stays open for the duration of the test, since the endpoint reads it through the form file during execution. MemoryStream archiveStream = new(content); IFormFile formFile = new FormFile(archiveStream, 0, content.Length, "archive", fileName); FormFileCollection files = [formFile]; diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Api/ApiStreamResultTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Api/ApiStreamResultTests.cs index 68521337..eeef3bc2 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Api/ApiStreamResultTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Api/ApiStreamResultTests.cs @@ -53,9 +53,9 @@ public class ApiStreamResultTests } [Theory] - [InlineData("0")] // an empty production reports zero segments - [InlineData("1")] // a single segment production - [InlineData("42")] // a multi segment production + [InlineData("0")] // An empty production reports zero segments. + [InlineData("1")] // A single segment production. + [InlineData("42")] // A multi segment production. public async Task CreateAsync_WhenSegmentCountIsValid_ShouldExposeIt(string segmentCount) { // Arrange @@ -70,11 +70,11 @@ public class ApiStreamResultTests } [Theory] - [InlineData(null)] // the header is absent - [InlineData("")] // the header is empty - [InlineData("not-a-number")] // the header is malformed - [InlineData("-1")] // a negative count is treated as absent - [InlineData("1.5")] // a fractional count is treated as absent + [InlineData(null)] // The header is absent. + [InlineData("")] // The header is empty. + [InlineData("not-a-number")] // The header is malformed. + [InlineData("-1")] // A negative count is treated as absent. + [InlineData("1.5")] // A fractional count is treated as absent. public async Task CreateAsync_WhenSegmentCountIsInvalid_ShouldReturnNull(string? segmentCount) { // Arrange @@ -90,9 +90,9 @@ public class ApiStreamResultTests } [Theory] - [InlineData("0")] // the first segment starts at the beginning of the track - [InlineData("6.5")] // a decimal with a dot is forwarded as the API wrote it - [InlineData("6,5")] // a decimal with a comma, which is not the invariant separator, is still forwarded verbatim + [InlineData("0")] // The first segment starts at the beginning of the track. + [InlineData("6.5")] // A decimal with a dot is forwarded as the API wrote it. + [InlineData("6,5")] // A decimal with a comma, which is not the invariant separator, is still forwarded verbatim. public async Task CreateAsync_WhenSegmentStartIsPresent_ShouldForwardItVerbatim(string segmentStart) { // Arrange @@ -120,8 +120,8 @@ public class ApiStreamResultTests } [Theory] - [InlineData("1")] // a one second production - [InlineData("300")] // a five minute production + [InlineData("1")] // A one second production. + [InlineData("300")] // A five minute production. public async Task CreateAsync_WhenTrackDurationIsPositive_ShouldExposeIt(string trackDuration) { // Arrange @@ -136,10 +136,10 @@ public class ApiStreamResultTests } [Theory] - [InlineData(null)] // the header is absent - [InlineData("0")] // a zero duration is treated as absent - [InlineData("-5")] // a negative duration is treated as absent - [InlineData("not-a-number")] // the header is malformed + [InlineData(null)] // The header is absent. + [InlineData("0")] // A zero duration is treated as absent. + [InlineData("-5")] // A negative duration is treated as absent. + [InlineData("not-a-number")] // The header is malformed. public async Task CreateAsync_WhenTrackDurationIsInvalid_ShouldReturnNull(string? trackDuration) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Api/StreamingApiHttpClientTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Api/StreamingApiHttpClientTests.cs index a80c0ff7..39656104 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Api/StreamingApiHttpClientTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Api/StreamingApiHttpClientTests.cs @@ -111,9 +111,9 @@ public class StreamingApiHttpClientTests } [Theory] - [InlineData(false, null)] // there is no HTTP context at all - [InlineData(true, null)] // the HTTP context has no token claim - [InlineData(true, "")] // the token claim is empty + [InlineData(false, null)] // There is no HTTP context at all. + [InlineData(true, null)] // The HTTP context has no token claim. + [InlineData(true, "")] // The token claim is empty. public async Task GetStreamAsync_WhenTokenIsUnavailable_ShouldNotSendAnAuthorizationHeader(bool hasHttpContext, string? token) { // Arrange @@ -181,8 +181,8 @@ public class StreamingApiHttpClientTests } [Theory] - [InlineData(HttpStatusCode.NotModified)] // a conditional request that the entity tag did not invalidate - [InlineData(HttpStatusCode.RequestedRangeNotSatisfiable)] // a ranged request that cannot be satisfied + [InlineData(HttpStatusCode.NotModified)] // A conditional request that the entity tag did not invalidate. + [InlineData(HttpStatusCode.RequestedRangeNotSatisfiable)] // A ranged request that cannot be satisfied. public async Task GetStreamAsync_WhenApiReturnsANonSuccessThatIsAValidOutcome_ShouldPassTheResponseThrough(HttpStatusCode statusCode) { // Arrange @@ -197,9 +197,9 @@ public class StreamingApiHttpClientTests } [Theory] - [InlineData(HttpStatusCode.BadRequest)] // a malformed request - [InlineData(HttpStatusCode.NotFound)] // the track does not exist - [InlineData(HttpStatusCode.InternalServerError)] // the API failed + [InlineData(HttpStatusCode.BadRequest)] // A malformed request. + [InlineData(HttpStatusCode.NotFound)] // The track does not exist. + [InlineData(HttpStatusCode.InternalServerError)] // The API failed. public async Task GetStreamAsync_WhenApiReturnsAnotherNonSuccess_ShouldThrowApiExceptionWithTheProblemDetails(HttpStatusCode statusCode) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/HealthChecks/ApiReachabilityHealthCheckTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/HealthChecks/ApiReachabilityHealthCheckTests.cs index d4998a32..b096bfc6 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/HealthChecks/ApiReachabilityHealthCheckTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/HealthChecks/ApiReachabilityHealthCheckTests.cs @@ -95,7 +95,7 @@ public class ApiReachabilityHealthCheckTests /// The created instance. private static HealthCheckContext CreateHealthCheckContext(IHealthCheck healthCheck) { - // the ApiReachabilityHealthCheck never reads the registration, so a bare context is sufficient + // The ApiReachabilityHealthCheck never reads the registration, so a bare context is sufficient. return new HealthCheckContext(); } diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Http/ApiStreamProxyTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Http/ApiStreamProxyTests.cs index fae8af76..72f7ef54 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Http/ApiStreamProxyTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Http/ApiStreamProxyTests.cs @@ -85,9 +85,9 @@ public class ApiStreamProxyTests } [Theory] - [InlineData("public, max-age=60", new[] { "private", "max-age=60" })] // the public instruction is dropped and the max age is preserved - [InlineData("no-store", new[] { "private", "no-store" })] // the no store instruction is preserved and privacy is added - [InlineData(null, new[] { "private" })] // an absent API instruction becomes a private instruction + [InlineData("public, max-age=60", new[] { "private", "max-age=60" })] // The public instruction is dropped and the max age is preserved. + [InlineData("no-store", new[] { "private", "no-store" })] // The no store instruction is preserved and privacy is added. + [InlineData(null, new[] { "private" })] // An absent API instruction becomes a private instruction. public async Task WriteAsync_WhenApiDeclaresCaching_ShouldAlwaysProduceAPrivateInstruction(string? apiCacheControl, string[] expectedFragments) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Playback/PlaybackDeliveryIdTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Playback/PlaybackDeliveryIdTests.cs index e0e63f53..2d95f814 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Playback/PlaybackDeliveryIdTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Playback/PlaybackDeliveryIdTests.cs @@ -13,10 +13,10 @@ namespace Lumina.Presentation.Web.UnitTests.Common.Playback; public class PlaybackDeliveryIdTests { [Theory] - [InlineData("0123456789abcdef0123456789abcdef")] // a lowercase hexadecimal handle - [InlineData("ffffffffffffffffffffffffffffffff")] // an all lowercase hexadecimal handle - [InlineData("00000000000000000000000000000000")] // an all zero handle - [InlineData("8f14e45fceea167a5a36dedd4bea2543")] // a random lowercase hexadecimal handle + [InlineData("0123456789abcdef0123456789abcdef")] // A lowercase hexadecimal handle. + [InlineData("ffffffffffffffffffffffffffffffff")] // An all lowercase hexadecimal handle. + [InlineData("00000000000000000000000000000000")] // An all zero handle. + [InlineData("8f14e45fceea167a5a36dedd4bea2543")] // A random lowercase hexadecimal handle. public void IsValid_WhenValueIsThirtyTwoLowercaseHexadecimalCharacters_ShouldReturnTrue(string value) { // Act @@ -27,15 +27,15 @@ public class PlaybackDeliveryIdTests } [Theory] - [InlineData(null)] // an absent handle is not valid - [InlineData("")] // an empty handle is not valid - [InlineData(" ")] // a whitespace only handle is not valid - [InlineData("0123456789abcdef0123456789abcde")] // a handle with 31 characters is too short - [InlineData("0123456789abcdef0123456789abcdef0")] // a handle with 33 characters is too long - [InlineData("0123456789ABCDEF0123456789ABCDEF")] // an uppercase handle is not accepted - [InlineData("01234567-89ab-cdef-0123-456789abcdef")] // a dashed GUID is not accepted - [InlineData("0123456789abcdef0123456789abcdeg")] // a non hexadecimal handle is not accepted - [InlineData("0123456789abcdef0123456789abcde ")] // a handle with a trailing space is not accepted + [InlineData(null)] // An absent handle is not valid. + [InlineData("")] // An empty handle is not valid. + [InlineData(" ")] // A whitespace only handle is not valid. + [InlineData("0123456789abcdef0123456789abcde")] // A handle with 31 characters is too short. + [InlineData("0123456789abcdef0123456789abcdef0")] // A handle with 33 characters is too long. + [InlineData("0123456789ABCDEF0123456789ABCDEF")] // An uppercase handle is not accepted. + [InlineData("01234567-89ab-cdef-0123-456789abcdef")] // A dashed GUID is not accepted. + [InlineData("0123456789abcdef0123456789abcdeg")] // A non hexadecimal handle is not accepted. + [InlineData("0123456789abcdef0123456789abcde ")] // A handle with a trailing space is not accepted. public void IsValid_WhenValueDoesNotMatchTheHandleFormat_ShouldReturnFalse(string? value) { // Act diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Validators/ServerConfigurationModelValidatorTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Validators/ServerConfigurationModelValidatorTests.cs index d0c80f92..b59b95f0 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Validators/ServerConfigurationModelValidatorTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Validators/ServerConfigurationModelValidatorTests.cs @@ -33,8 +33,8 @@ public class ServerConfigurationModelValidatorTests } [Theory] - [InlineData((ushort)0)] // minimum allowed value - [InlineData((ushort)65535)] // maximum allowed value + [InlineData((ushort)0)] // Minimum allowed value. + [InlineData((ushort)65535)] // Maximum allowed value. public void Validate_WhenPortIsAtBoundary_ShouldNotHaveValidationError(ushort port) { // Arrange @@ -48,8 +48,8 @@ public class ServerConfigurationModelValidatorTests } [Theory] - [InlineData((char)0)] // minimum allowed API version - [InlineData((char)255)] // maximum allowed API version + [InlineData((char)0)] // Minimum allowed API version. + [InlineData((char)255)] // Maximum allowed API version. public void Validate_WhenApiVersionIsAtBoundary_ShouldNotHaveValidationError(char apiVersion) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/DeleteTheme/DeleteThemeEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/DeleteTheme/DeleteThemeEndpointTests.cs index 9caca737..108787ba 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/DeleteTheme/DeleteThemeEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/DeleteTheme/DeleteThemeEndpointTests.cs @@ -66,9 +66,9 @@ public class DeleteThemeEndpointTests } [Theory] - [InlineData(null)] // missing theme id - [InlineData("")] // empty theme id - [InlineData(" ")] // whitespace theme id + [InlineData(null)] // Missing theme id. + [InlineData("")] // Empty theme id. + [InlineData(" ")] // Whitespace theme id. public async Task ExecuteAsync_WhenThemeIdIsBlank_ShouldReturnProblemWithBadRequest(string? themeId) { // Act diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/DownloadTheme/DownloadThemeEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/DownloadTheme/DownloadThemeEndpointTests.cs index f53865a0..89ee9ace 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/DownloadTheme/DownloadThemeEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/DownloadTheme/DownloadThemeEndpointTests.cs @@ -72,9 +72,9 @@ public class DownloadThemeEndpointTests } [Theory] - [InlineData(null)] // missing theme id - [InlineData("")] // empty theme id - [InlineData(" ")] // whitespace theme id + [InlineData(null)] // Missing theme id. + [InlineData("")] // Empty theme id. + [InlineData(" ")] // Whitespace theme id. public async Task ExecuteAsync_WhenThemeIdIsBlank_ShouldReturnProblemWithBadRequest(string? themeId) { // Act diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/InstallTheme/InstallThemeEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/InstallTheme/InstallThemeEndpointTests.cs index b7678639..4eaec47b 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/InstallTheme/InstallThemeEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/InstallTheme/InstallThemeEndpointTests.cs @@ -90,14 +90,14 @@ public class InstallThemeEndpointTests private void ConfigureFormWithArchive(byte[] content, string fileName) { - // the stream stays open for the duration of the test, since the endpoint reads it through the form file during execution + // The stream stays open for the duration of the test, since the endpoint reads it through the form file during execution. MemoryStream archiveStream = new(content); IFormFile formFile = new FormFile(archiveStream, 0, content.Length, "archive", fileName); FormFileCollection files = [formFile]; IFormCollection form = new FormCollection([], files); _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; - // a real FormFeature is used instead of a substitute, because the endpoint execution reads the form through the - // request machinery, which would bypass a mocked feature and parse the (empty) request body + // A real FormFeature is used instead of a substitute, because the endpoint execution reads the form through the + // request machinery, which would bypass a mocked feature and parse the (empty) request body. _sut.HttpContext.Features.Set(new FormFeature(form)); } } diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/RestoreTheme/RestoreThemeEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/RestoreTheme/RestoreThemeEndpointTests.cs index 83ece510..c14bcc8f 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/RestoreTheme/RestoreThemeEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/RestoreTheme/RestoreThemeEndpointTests.cs @@ -69,9 +69,9 @@ public class RestoreThemeEndpointTests } [Theory] - [InlineData(null)] // missing theme id - [InlineData("")] // empty theme id - [InlineData(" ")] // whitespace theme id + [InlineData(null)] // Missing theme id. + [InlineData("")] // Empty theme id. + [InlineData(" ")] // Whitespace theme id. public async Task ExecuteAsync_WhenThemeIdIsBlank_ShouldReturnProblemWithBadRequest(string? themeId) { // Act diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/SetCurrentTheme/SetCurrentThemeEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/SetCurrentTheme/SetCurrentThemeEndpointTests.cs index 9f029c82..c1c02dcc 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/SetCurrentTheme/SetCurrentThemeEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Admin/Themes/SetCurrentTheme/SetCurrentThemeEndpointTests.cs @@ -62,9 +62,9 @@ public class SetCurrentThemeEndpointTests } [Theory] - [InlineData(null)] // missing theme id - [InlineData("")] // empty theme id - [InlineData(" ")] // whitespace theme id + [InlineData(null)] // Missing theme id. + [InlineData("")] // Empty theme id. + [InlineData(" ")] // Whitespace theme id. public async Task ExecuteAsync_WhenThemeIdIsBlank_ShouldReturnProblemWithBadRequest(string? themeId) { // Act diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs index edd259b2..d75a5713 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Favorites/GetFavorites/GetFavoritesEndpointTests.cs @@ -145,8 +145,8 @@ public class GetFavoritesEndpointTests } [Theory] - [InlineData(2, 50, "users/me/favorites?currentPage=2&perPage=50")] // both the page and the size are supplied - [InlineData(-1, 0, "users/me/favorites?currentPage=-1&perPage=0")] // out of range values are preserved, so the API reports its own validation + [InlineData(2, 50, "users/me/favorites?currentPage=2&perPage=50")] // Both the page and the size are supplied. + [InlineData(-1, 0, "users/me/favorites?currentPage=-1&perPage=0")] // Out of range values are preserved, so the API reports its own validation. public async Task ExecuteAsync_WhenPaginationValuesAreSupplied_ShouldForwardTheNormalizedQueryString(int currentPage, int perPage, string expectedEndpoint) { // Arrange @@ -167,10 +167,10 @@ public class GetFavoritesEndpointTests } [Theory] - [InlineData(FavoriteMediaKind.MusicArtist, "users/me/favorites?currentPage=1&perPage=200&mediaKind=MusicArtist")] // artist favorites - [InlineData(FavoriteMediaKind.MusicAlbum, "users/me/favorites?currentPage=1&perPage=200&mediaKind=MusicAlbum")] // album favorites - [InlineData(FavoriteMediaKind.MusicTrack, "users/me/favorites?currentPage=1&perPage=200&mediaKind=MusicTrack")] // track favorites - [InlineData(FavoriteMediaKind.Book, "users/me/favorites?currentPage=1&perPage=200&mediaKind=Book")] // book favorites + [InlineData(FavoriteMediaKind.MusicArtist, "users/me/favorites?currentPage=1&perPage=200&mediaKind=MusicArtist")] // Artist favorites. + [InlineData(FavoriteMediaKind.MusicAlbum, "users/me/favorites?currentPage=1&perPage=200&mediaKind=MusicAlbum")] // Album favorites. + [InlineData(FavoriteMediaKind.MusicTrack, "users/me/favorites?currentPage=1&perPage=200&mediaKind=MusicTrack")] // Track favorites. + [InlineData(FavoriteMediaKind.Book, "users/me/favorites?currentPage=1&perPage=200&mediaKind=Book")] // Book favorites. public async Task ExecuteAsync_WhenMediaKindIsSupplied_ShouldAppendTheCanonicalKindToTheQueryString(FavoriteMediaKind mediaKind, string expectedEndpoint) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs index bc1569a3..73cc62c9 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Favorites/RemoveFavorite/RemoveFavoriteEndpointTests.cs @@ -56,13 +56,13 @@ public class RemoveFavoriteEndpointTests } [Theory] - [InlineData("MusicArtist", "MusicArtist")] // canonical member name - [InlineData("MusicAlbum", "MusicAlbum")] // another canonical member name - [InlineData("MusicTrack", "MusicTrack")] // another canonical member name - [InlineData("Book", "Book")] // another canonical member name - [InlineData("musictrack", "MusicTrack")] // lowercase member name - [InlineData("MUSICTRACK", "MusicTrack")] // uppercase member name - [InlineData("musicTrack", "MusicTrack")] // mixed case member name + [InlineData("MusicArtist", "MusicArtist")] // Canonical member name. + [InlineData("MusicAlbum", "MusicAlbum")] // Another canonical member name. + [InlineData("MusicTrack", "MusicTrack")] // Another canonical member name. + [InlineData("Book", "Book")] // Another canonical member name. + [InlineData("musictrack", "MusicTrack")] // Lowercase member name. + [InlineData("MUSICTRACK", "MusicTrack")] // Uppercase member name. + [InlineData("musicTrack", "MusicTrack")] // Mixed case member name. public async Task ExecuteAsync_WhenMediaKindNameIsValid_ShouldForwardTheCanonicalMemberName(string routeMediaKind, string expectedMediaKind) { // Arrange @@ -78,16 +78,16 @@ public class RemoveFavoriteEndpointTests } [Theory] - [InlineData("1")] // numeric enum value - [InlineData("0")] // numeric enum value - [InlineData("NotAFavoriteMediaKind")] // undefined member name - [InlineData("None")] // the default value is not a kind that can be favorited - [InlineData("none")] // the default value, matched case insensitively - [InlineData("MusicTrack,Book")] // comma separated member names - [InlineData("Music Track")] // member name with a space - [InlineData("MusicTrack/../..")] // path traversal attempt - [InlineData("..")] // dot segment - [InlineData("MusicTrack%2F..")] // encoded slash traversal attempt + [InlineData("1")] // Numeric enum value. + [InlineData("0")] // Numeric enum value. + [InlineData("NotAFavoriteMediaKind")] // Undefined member name. + [InlineData("None")] // The default value is not a kind that can be favorited. + [InlineData("none")] // The default value, matched case insensitively. + [InlineData("MusicTrack,Book")] // Comma separated member names. + [InlineData("Music Track")] // Member name with a space. + [InlineData("MusicTrack/../..")] // Path traversal attempt. + [InlineData("..")] // Dot segment. + [InlineData("MusicTrack%2F..")] // Encoded slash traversal attempt. public async Task ExecuteAsync_WhenMediaKindNameIsRejected_ShouldForwardTheInvalidPlaceholder(string routeMediaKind) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetPlaybackManifest/GetPlaybackManifestEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetPlaybackManifest/GetPlaybackManifestEndpointTests.cs index 13351596..d50c6fa6 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetPlaybackManifest/GetPlaybackManifestEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetPlaybackManifest/GetPlaybackManifestEndpointTests.cs @@ -83,8 +83,8 @@ public class GetPlaybackManifestEndpointTests } [Theory] - [InlineData(true)] // a null template means the delivery has no segment route - [InlineData(false)] // an empty template means the delivery has no segment route + [InlineData(true)] // A null template means the delivery has no segment route. + [InlineData(false)] // An empty template means the delivery has no segment route. public async Task ExecuteAsync_WhenSegmentPathTemplateIsEmpty_ShouldClearTheDeliveryIdAndTheTemplate(bool useNullTemplate) { // Arrange @@ -153,10 +153,10 @@ public class GetPlaybackManifestEndpointTests } [Theory] - [InlineData("mp3/mp3", "?capabilities=mp3%2Fmp3")] // the capabilities are forwarded and URL-escaped - [InlineData("flac/flac,mp3/mp3", "?capabilities=flac%2Fflac%2Cmp3%2Fmp3")] // a capability list is forwarded as one escaped value - [InlineData(" ", "")] // whitespace only capabilities are not forwarded - [InlineData(null, "")] // absent capabilities are not forwarded + [InlineData("mp3/mp3", "?capabilities=mp3%2Fmp3")] // The capabilities are forwarded and URL-escaped. + [InlineData("flac/flac,mp3/mp3", "?capabilities=flac%2Fflac%2Cmp3%2Fmp3")] // A capability list is forwarded as one escaped value. + [InlineData(" ", "")] // Whitespace only capabilities are not forwarded. + [InlineData(null, "")] // Absent capabilities are not forwarded. public async Task ExecuteAsync_WhenCapabilitiesAreProvided_ShouldForwardThemOnlyWhenTheyAreNotEmpty(string? capabilities, string expectedSuffix) { // Arrange @@ -211,9 +211,9 @@ public class GetPlaybackManifestEndpointTests } [Theory] - [InlineData("/lumina", "/lumina")] // a plain absolute path base is prefixed - [InlineData("//evil", "")] // a protocol relative path base would point the stream at another origin - [InlineData("/a?b", "")] // a path base with a query would truncate the built path + [InlineData("/lumina", "/lumina")] // A plain absolute path base is prefixed. + [InlineData("//evil", "")] // A protocol relative path base would point the stream at another origin. + [InlineData("/a?b", "")] // A path base with a query would truncate the built path. public async Task ExecuteAsync_WhenPathBaseIsPresent_ShouldUseItOnlyWhenItIsSafe(string pathBase, string expectedPrefix) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrack/StreamMusicTrackEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrack/StreamMusicTrackEndpointTests.cs index 708984c9..a8096c07 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrack/StreamMusicTrackEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrack/StreamMusicTrackEndpointTests.cs @@ -142,8 +142,8 @@ public class StreamMusicTrackEndpointTests } [Theory] - [InlineData(HttpStatusCode.ServiceUnavailable)] // a busy normalization pipeline is a transient condition - [InlineData(HttpStatusCode.TooManyRequests)] // the stream concurrency limit was reached + [InlineData(HttpStatusCode.ServiceUnavailable)] // A busy normalization pipeline is a transient condition. + [InlineData(HttpStatusCode.TooManyRequests)] // The stream concurrency limit was reached. public async Task ExecuteAsync_WhenApiReportsATransientCondition_ShouldReturnABareStatusWithoutThrowing(HttpStatusCode statusCode) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrackSegment/StreamMusicTrackSegmentEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrackSegment/StreamMusicTrackSegmentEndpointTests.cs index 4a0cc954..b5fd8c5d 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrackSegment/StreamMusicTrackSegmentEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/StreamMusicTrackSegment/StreamMusicTrackSegmentEndpointTests.cs @@ -46,9 +46,9 @@ public class StreamMusicTrackSegmentEndpointTests } [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("short")] // a handle that is shorter than the format allows + [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("short")] // A handle that is shorter than the format allows. public async Task ExecuteAsync_WhenDeliveryIdIsInvalid_ShouldReturnNotFoundWithoutCallingTheApi(string malformedHandleKind) { // Arrange @@ -104,9 +104,9 @@ public class StreamMusicTrackSegmentEndpointTests } [Theory] - [InlineData("artistId", "' OR '1'='1")] // an unparseable artist Id is normalized to an empty GUID - [InlineData("albumId", "'; DROP TABLE Tracks; --")] // an unparseable album Id is normalized to an empty GUID - [InlineData("trackId", "not-a-guid")] // an unparseable track Id is normalized to an empty GUID + [InlineData("artistId", "' OR '1'='1")] // An unparseable artist Id is normalized to an empty GUID. + [InlineData("albumId", "'; DROP TABLE Tracks; --")] // An unparseable album Id is normalized to an empty GUID. + [InlineData("trackId", "not-a-guid")] // An unparseable track Id is normalized to an empty GUID. public async Task ExecuteAsync_WhenRouteIdsAreNotParseable_ShouldForwardEmptyGuidsToTheApi(string routeValue, string invalidValue) { // Arrange @@ -137,8 +137,8 @@ public class StreamMusicTrackSegmentEndpointTests } [Theory] - [InlineData(HttpStatusCode.ServiceUnavailable)] // a busy normalization pipeline is a transient condition - [InlineData(HttpStatusCode.TooManyRequests)] // the stream concurrency limit was reached + [InlineData(HttpStatusCode.ServiceUnavailable)] // A busy normalization pipeline is a transient condition. + [InlineData(HttpStatusCode.TooManyRequests)] // The stream concurrency limit was reached. public async Task ExecuteAsync_WhenApiReportsATransientCondition_ShouldReturnABareStatusWithoutThrowing(HttpStatusCode statusCode) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/ClearConsumptionHistory/ClearConsumptionHistoryEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/ClearConsumptionHistory/ClearConsumptionHistoryEndpointTests.cs index 22a8e3b3..7be20da2 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/ClearConsumptionHistory/ClearConsumptionHistoryEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/ClearConsumptionHistory/ClearConsumptionHistoryEndpointTests.cs @@ -53,9 +53,9 @@ public class ClearConsumptionHistoryEndpointTests } [Theory] - [InlineData(null)] // no user selected, the current user is implied - [InlineData("")] // empty user selected - [InlineData(" ")] // whitespace user selected + [InlineData(null)] // No user selected, the current user is implied. + [InlineData("")] // Empty user selected. + [InlineData(" ")] // Whitespace user selected. public async Task ExecuteAsync_WhenUserIdIsNullOrWhitespace_ShouldDeleteCurrentUserHistory(string? userId) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearResumePointsEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearResumePointsEndpointTests.cs index 2b94fb6d..461f6a47 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearResumePointsEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/ClearResumePoints/ClearResumePointsEndpointTests.cs @@ -53,9 +53,9 @@ public class ClearResumePointsEndpointTests } [Theory] - [InlineData(null)] // no user selected, the current user is implied - [InlineData("")] // empty user selected - [InlineData(" ")] // whitespace user selected + [InlineData(null)] // No user selected, the current user is implied. + [InlineData("")] // Empty user selected. + [InlineData(" ")] // Whitespace user selected. public async Task ExecuteAsync_WhenUserIdIsNullOrWhitespaceAndLibraryIdIsNull_ShouldClearCurrentUserResumePointsWithoutFilter(string? userId) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs index a005b98a..38d041f3 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/DeleteConsumptionItemHistory/DeleteConsumptionItemHistoryEndpointTests.cs @@ -58,9 +58,9 @@ public class DeleteConsumptionItemHistoryEndpointTests } [Theory] - [InlineData(null)] // no user selected, the current user is implied - [InlineData("")] // empty user selected - [InlineData(" ")] // whitespace user selected + [InlineData(null)] // No user selected, the current user is implied. + [InlineData("")] // Empty user selected. + [InlineData(" ")] // Whitespace user selected. public async Task ExecuteAsync_WhenUserIdIsNullOrWhitespace_ShouldDeleteCurrentUserItemHistory(string? userId) { // Arrange @@ -81,9 +81,9 @@ public class DeleteConsumptionItemHistoryEndpointTests } [Theory] - [InlineData(MediaKind.MusicTrack, "MusicTrack")] // a music track - [InlineData(MediaKind.PodcastEpisode, "PodcastEpisode")] // a podcast episode - [InlineData(MediaKind.Book, "Book")] // a book + [InlineData(MediaKind.MusicTrack, "MusicTrack")] // A music track. + [InlineData(MediaKind.PodcastEpisode, "PodcastEpisode")] // A podcast episode. + [InlineData(MediaKind.Book, "Book")] // A book. public async Task ExecuteAsync_WhenMediaKindIsSet_ShouldUseTheMediaKindNameInTheUpstreamRoute(MediaKind mediaKind, string expectedMediaKind) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetConsumptionStatistics/GetConsumptionStatisticsEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetConsumptionStatistics/GetConsumptionStatisticsEndpointTests.cs index 0c89edd4..dd9c0a13 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetConsumptionStatistics/GetConsumptionStatisticsEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetConsumptionStatistics/GetConsumptionStatisticsEndpointTests.cs @@ -68,9 +68,9 @@ public class GetConsumptionStatisticsEndpointTests } [Theory] - [InlineData(null)] // no user selected, the current user is implied - [InlineData("")] // empty user selected - [InlineData(" ")] // whitespace user selected + [InlineData(null)] // No user selected, the current user is implied. + [InlineData("")] // Empty user selected. + [InlineData(" ")] // Whitespace user selected. public async Task ExecuteAsync_WhenUserIdIsNullOrWhitespace_ShouldRequestCurrentUserStatisticsWithoutQueryString(string? userId) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetGenreConsumption/GetGenreConsumptionEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetGenreConsumption/GetGenreConsumptionEndpointTests.cs index c64576de..151f6162 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetGenreConsumption/GetGenreConsumptionEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetGenreConsumption/GetGenreConsumptionEndpointTests.cs @@ -69,9 +69,9 @@ public class GetGenreConsumptionEndpointTests } [Theory] - [InlineData(null)] // no user selected, the current user is implied - [InlineData("")] // empty user selected - [InlineData(" ")] // whitespace user selected + [InlineData(null)] // No user selected, the current user is implied. + [InlineData("")] // Empty user selected. + [InlineData(" ")] // Whitespace user selected. public async Task ExecuteAsync_WhenUserIdIsNullOrWhitespace_ShouldRequestCurrentUserGenresWithoutQueryString(string? userId) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetMostConsumedEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetMostConsumedEndpointTests.cs index cda6bd8f..ed38e53a 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetMostConsumedEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetMostConsumed/GetMostConsumedEndpointTests.cs @@ -80,9 +80,9 @@ public class GetMostConsumedEndpointTests } [Theory] - [InlineData(null)] // no user selected, the current user is implied - [InlineData("")] // empty user selected - [InlineData(" ")] // whitespace user selected + [InlineData(null)] // No user selected, the current user is implied. + [InlineData("")] // Empty user selected. + [InlineData(" ")] // Whitespace user selected. public async Task ExecuteAsync_WhenUserIdIsNullOrWhitespaceAndNoFilterIsSupplied_ShouldRequestCurrentUserItemsWithDefaultPaging(string? userId) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetRecentlyConsumedEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetRecentlyConsumedEndpointTests.cs index e017a05d..7148c120 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetRecentlyConsumedEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetRecentlyConsumed/GetRecentlyConsumedEndpointTests.cs @@ -80,9 +80,9 @@ public class GetRecentlyConsumedEndpointTests } [Theory] - [InlineData(null)] // no user selected, the current user is implied - [InlineData("")] // empty user selected - [InlineData(" ")] // whitespace user selected + [InlineData(null)] // No user selected, the current user is implied. + [InlineData("")] // Empty user selected. + [InlineData(" ")] // Whitespace user selected. public async Task ExecuteAsync_WhenUserIdIsNullOrWhitespaceAndNoFilterIsSupplied_ShouldRequestCurrentUserItemsWithDefaultPaging(string? userId) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetTagConsumption/GetTagConsumptionEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetTagConsumption/GetTagConsumptionEndpointTests.cs index 6d109c18..1762f9f8 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetTagConsumption/GetTagConsumptionEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/GetTagConsumption/GetTagConsumptionEndpointTests.cs @@ -69,9 +69,9 @@ public class GetTagConsumptionEndpointTests } [Theory] - [InlineData(null)] // no user selected, the current user is implied - [InlineData("")] // empty user selected - [InlineData(" ")] // whitespace user selected + [InlineData(null)] // No user selected, the current user is implied. + [InlineData("")] // Empty user selected. + [InlineData(" ")] // Whitespace user selected. public async Task ExecuteAsync_WhenUserIdIsNullOrWhitespace_ShouldRequestCurrentUserTagsWithoutQueryString(string? userId) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/Index/StatisticsIndexViewEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/Index/StatisticsIndexViewEndpointTests.cs index 9f9e7613..beddf450 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/Index/StatisticsIndexViewEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/Statistics/Index/StatisticsIndexViewEndpointTests.cs @@ -190,9 +190,9 @@ public class StatisticsIndexViewEndpointTests } [Theory] - [InlineData(null)] // no identifier claim at all - [InlineData("")] // empty identifier claim - [InlineData("not-a-guid")] // identifier claim that is not a GUID + [InlineData(null)] // No identifier claim at all. + [InlineData("")] // Empty identifier claim. + [InlineData("not-a-guid")] // Identifier claim that is not a GUID. public async Task ExecuteAsync_WhenNameIdentifierIsMissingOrNotAGuid_ShouldLeaveCurrentUserIdNull(string? nameIdentifier) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs index 4db72ee3..b6929dc5 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/MediaConsumption/GetResumePoint/GetResumePointEndpointTests.cs @@ -149,15 +149,15 @@ public class GetResumePointEndpointTests } [Theory] - [InlineData("Book", "Book")] // canonical member name - [InlineData("book", "Book")] // lowercase member name - [InlineData("BOOK", "Book")] // uppercase member name - [InlineData("MusicTrack", "MusicTrack")] // another canonical member name - [InlineData("musicTrack", "MusicTrack")] // mixed case member name - [InlineData("TvEpisode", "TvEpisode")] // another canonical member name - [InlineData("tvEpisode", "TvEpisode")] // another mixed case member name - [InlineData("PodcastEpisode", "PodcastEpisode")] // another canonical member name - [InlineData("podcastepisode", "PodcastEpisode")] // another lowercase member name + [InlineData("Book", "Book")] // Canonical member name. + [InlineData("book", "Book")] // Lowercase member name. + [InlineData("BOOK", "Book")] // Uppercase member name. + [InlineData("MusicTrack", "MusicTrack")] // Another canonical member name. + [InlineData("musicTrack", "MusicTrack")] // Mixed case member name. + [InlineData("TvEpisode", "TvEpisode")] // Another canonical member name. + [InlineData("tvEpisode", "TvEpisode")] // Another mixed case member name. + [InlineData("PodcastEpisode", "PodcastEpisode")] // Another canonical member name. + [InlineData("podcastepisode", "PodcastEpisode")] // Another lowercase member name. public async Task ExecuteAsync_WhenMediaKindNameIsValid_ShouldForwardTheCanonicalMemberName(string routeMediaKind, string expectedMediaKind) { // Arrange @@ -175,14 +175,14 @@ public class GetResumePointEndpointTests } [Theory] - [InlineData("1")] // numeric enum value - [InlineData("0")] // numeric enum value, the None member - [InlineData("NotAMediaKind")] // undefined member name - [InlineData("MusicTrack,Book")] // comma separated member names - [InlineData("Music Track")] // member name with a space - [InlineData("MusicTrack/../..")] // path traversal attempt - [InlineData("..")] // dot segment - [InlineData("MusicTrack%2F..")] // encoded slash traversal attempt + [InlineData("1")] // Numeric enum value. + [InlineData("0")] // Numeric enum value, the None member. + [InlineData("NotAMediaKind")] // Undefined member name. + [InlineData("MusicTrack,Book")] // Comma separated member names. + [InlineData("Music Track")] // Member name with a space. + [InlineData("MusicTrack/../..")] // Path traversal attempt. + [InlineData("..")] // Dot segment. + [InlineData("MusicTrack%2F..")] // Encoded slash traversal attempt. public async Task ExecuteAsync_WhenMediaKindNameIsRejected_ShouldForwardTheInvalidPlaceholder(string routeMediaKind) { // Arrange @@ -249,9 +249,9 @@ public class GetResumePointEndpointTests } [Theory] - [InlineData("MediaResumePointNotFound")] // the user has no resume point for the media item - [InlineData("BookNotFound")] // the book of the resume point no longer exists - [InlineData("TrackNotFound")] // the track of the resume point no longer exists + [InlineData("MediaResumePointNotFound")] // The user has no resume point for the media item. + [InlineData("BookNotFound")] // The book of the resume point no longer exists. + [InlineData("TrackNotFound")] // The track of the resume point no longer exists. public async Task ExecuteAsync_WhenApiReportsAnAbsentResumePoint_ShouldReturnSuccessWithNullData(string detail) { // Arrange @@ -289,8 +289,8 @@ public class GetResumePointEndpointTests } [Theory] - [InlineData(HttpStatusCode.Forbidden)] // authorization failure reported by the API - [InlineData(HttpStatusCode.InternalServerError)] // unexpected API failure + [InlineData(HttpStatusCode.Forbidden)] // Authorization failure reported by the API. + [InlineData(HttpStatusCode.InternalServerError)] // Unexpected API failure. public async Task ExecuteAsync_WhenApiReturnsAnErrorOtherThanAnAbsentResumePoint_ShouldRethrow(HttpStatusCode httpStatusCode) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/MediaConsumption/StartConsumption/StartConsumptionEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/MediaConsumption/StartConsumption/StartConsumptionEndpointTests.cs index 6892d440..f3ccb08a 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/MediaConsumption/StartConsumption/StartConsumptionEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/MediaConsumption/StartConsumption/StartConsumptionEndpointTests.cs @@ -168,12 +168,12 @@ public class StartConsumptionEndpointTests } [Theory] - [InlineData("MusicTrack", "MusicTrack")] // canonical member name - [InlineData("musictrack", "MusicTrack")] // lowercase member name - [InlineData("MUSICTRACK", "MusicTrack")] // uppercase member name - [InlineData("tvEpisode", "TvEpisode")] // mixed case member name - [InlineData("Book", "Book")] // another canonical member name - [InlineData("podcastepisode", "PodcastEpisode")] // another lowercase member name + [InlineData("MusicTrack", "MusicTrack")] // Canonical member name. + [InlineData("musictrack", "MusicTrack")] // Lowercase member name. + [InlineData("MUSICTRACK", "MusicTrack")] // Uppercase member name. + [InlineData("tvEpisode", "TvEpisode")] // Mixed case member name. + [InlineData("Book", "Book")] // Another canonical member name. + [InlineData("podcastepisode", "PodcastEpisode")] // Another lowercase member name. public async Task ExecuteAsync_WhenMediaKindNameIsValid_ShouldForwardTheCanonicalMemberName(string routeMediaKind, string expectedMediaKind) { // Arrange @@ -193,14 +193,14 @@ public class StartConsumptionEndpointTests } [Theory] - [InlineData("1")] // numeric enum value - [InlineData("0")] // numeric enum value, the None member - [InlineData("NotAMediaKind")] // undefined member name - [InlineData("MusicTrack,Book")] // comma separated member names - [InlineData("Music Track")] // member name with a space - [InlineData("MusicTrack/../..")] // path traversal attempt - [InlineData("..")] // dot segment - [InlineData("MusicTrack%2F..")] // encoded slash traversal attempt + [InlineData("1")] // Numeric enum value. + [InlineData("0")] // Numeric enum value, the None member. + [InlineData("NotAMediaKind")] // Undefined member name. + [InlineData("MusicTrack,Book")] // Comma separated member names. + [InlineData("Music Track")] // Member name with a space. + [InlineData("MusicTrack/../..")] // Path traversal attempt. + [InlineData("..")] // Dot segment. + [InlineData("MusicTrack%2F..")] // Encoded slash traversal attempt. public async Task ExecuteAsync_WhenMediaKindNameIsRejected_ShouldForwardTheInvalidPlaceholder(string routeMediaKind) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistEntries/AddPlaylistEntriesEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistEntries/AddPlaylistEntriesEndpointTests.cs index 12c9df2c..f73d64fd 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistEntries/AddPlaylistEntriesEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistEntries/AddPlaylistEntriesEndpointTests.cs @@ -148,11 +148,11 @@ public class AddPlaylistEntriesEndpointTests } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection - [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // unicode payload + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // Unicode payload. public async Task ExecuteAsync_WhenPlaylistIdIsCrafted_ShouldNormalizeItAndNeverForwardTheRawValue(string payload) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs index f8f3674a..d7f1ad59 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistEntry/AddPlaylistEntryEndpointTests.cs @@ -153,11 +153,11 @@ public class AddPlaylistEntryEndpointTests } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection - [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // unicode payload + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // Unicode payload. public async Task ExecuteAsync_WhenPlaylistIdIsCrafted_ShouldNormalizeItAndNeverForwardTheRawValue(string payload) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs index da3c2f43..c3c76939 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/AddPlaylistScopeEntries/AddPlaylistScopeEntriesEndpointTests.cs @@ -182,11 +182,11 @@ public class AddPlaylistScopeEntriesEndpointTests } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection - [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // unicode payload + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // Unicode payload. public async Task ExecuteAsync_WhenPlaylistIdIsCrafted_ShouldNormalizeItAndNeverForwardTheRawValue(string payload) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs index 12ebd67b..a6a59d44 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/DeletePlaylist/DeletePlaylistEndpointTests.cs @@ -114,11 +114,11 @@ public class DeletePlaylistEndpointTests } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection - [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // unicode payload + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // Unicode payload. public async Task ExecuteAsync_WhenPlaylistIdIsCrafted_ShouldNormalizeItAndNeverForwardTheRawValue(string payload) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs index 14ab4a0d..61e9f9ed 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/GetPlaylist/GetPlaylistEndpointTests.cs @@ -239,11 +239,11 @@ public class GetPlaylistEndpointTests } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection - [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // unicode payload + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // Unicode payload. public async Task ExecuteAsync_WhenPlaylistIdIsCrafted_ShouldNormalizeItAndNeverForwardTheRawValue(string payload) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/Item/PlaylistItemViewEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/Item/PlaylistItemViewEndpointTests.cs index 516e116e..434b5e9d 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/Item/PlaylistItemViewEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/Item/PlaylistItemViewEndpointTests.cs @@ -318,11 +318,11 @@ public class PlaylistItemViewEndpointTests } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection - [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // unicode payload + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // Unicode payload. public async Task ExecuteAsync_WhenPlaylistIdIsCrafted_ShouldNormalizeItAndNeverForwardTheRawValue(string payload) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs index dd08f024..6c9ac2fa 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/MovePlaylistEntry/MovePlaylistEntryEndpointTests.cs @@ -150,11 +150,11 @@ public class MovePlaylistEntryEndpointTests } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection - [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // unicode payload + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // Unicode payload. public async Task ExecuteAsync_WhenRouteValuesAreCrafted_ShouldNormalizeThemAndNeverForwardTheRawValues(string payload) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs index b4522b7b..c28be1aa 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/RemovePlaylistEntry/RemovePlaylistEntryEndpointTests.cs @@ -116,11 +116,11 @@ public class RemovePlaylistEntryEndpointTests } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection - [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // unicode payload + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // Unicode payload. public async Task ExecuteAsync_WhenRouteValuesAreCrafted_ShouldNormalizeThemAndNeverForwardTheRawValues(string payload) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs index 64ae0cc8..99abaf52 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Playlists/UpdatePlaylist/UpdatePlaylistEndpointTests.cs @@ -151,11 +151,11 @@ public class UpdatePlaylistEndpointTests } [Theory] - [InlineData("' OR '1'='1")] // basic SQL injection - [InlineData("1;DROP TABLE")] // destructive injection - [InlineData("../../admin")] // path traversal - [InlineData("")] // markup injection - [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // unicode payload + [InlineData("' OR '1'='1")] // Basic SQL injection. + [InlineData("1;DROP TABLE")] // Destructive injection. + [InlineData("../../admin")] // Path traversal. + [InlineData("")] // Markup injection. + [InlineData("𝕡𝕝𝕒𝕪𝕝𝕚𝕤𝕥")] // Unicode payload. public async Task ExecuteAsync_WhenPlaylistIdIsCrafted_ShouldNormalizeItAndNeverForwardTheRawValue(string payload) { // Arrange diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs index c14a85c2..a38b7c05 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Plugins/InstallPlugin/InstallPluginEndpointTests.cs @@ -65,7 +65,7 @@ public class InstallPluginEndpointTests private void ConfigureFormWithArchive(byte[] content, string fileName) { - // the stream stays open for the duration of the test, since the endpoint reads it through the form file during execution + // The stream stays open for the duration of the test, since the endpoint reads it through the form file during execution. MemoryStream archiveStream = new(content); IFormFile formFile = new FormFile(archiveStream, 0, content.Length, "archive", fileName); FormFileCollection files = [formFile]; diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpointTests.cs index e47b977c..771a9761 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpointTests.cs @@ -59,7 +59,7 @@ public class LoginViewEndpointTests // Arrange ISession session = Substitute.For(); byte[] pendingBytes = Encoding.UTF8.GetBytes("true"); -#pragma warning disable CS8601 // possible null reference assignment in the NSubstitute out-argument stub +#pragma warning disable CS8601 // Possible null reference assignment in the NSubstitute out-argument stub. session.TryGetValue(HttpContextItemKeys.PENDING_SUPER_ADMIN_SETUP, out Arg.Any()).Returns(callInfo => { callInfo[1] = pendingBytes; diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeAudioPlayerBuilderTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeAudioPlayerBuilderTests.cs index bdd743da..4d0350a8 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeAudioPlayerBuilderTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeAudioPlayerBuilderTests.cs @@ -47,23 +47,23 @@ public class ThemeAudioPlayerBuilderTests } [Theory] - [InlineData("toggleExpanded", "ToggleExpanded")] // the expanded player toggle - [InlineData("previous", "AudioPlayerPrevious")] // the previous track control - [InlineData("next", "AudioPlayerNext")] // the next track control - [InlineData("stop", "AudioPlayerStop")] // the stop control - [InlineData("repeat", "AudioPlayerRepeat")] // the repeat control - [InlineData("repeatOff", "AudioPlayerRepeatOff")] // repeat turned off - [InlineData("repeatAll", "AudioPlayerRepeatAll")] // repeat of the whole queue - [InlineData("repeatOne", "AudioPlayerRepeatOne")] // repeat of a single track - [InlineData("queue", "AudioPlayerQueue")] // the play queue title - [InlineData("albumArtwork", "AudioPlayerAlbumArtwork")] // the album artwork placeholder - [InlineData("addQueueToPlaylist", "AudioPlayerAddQueueToPlaylist")] // adding the queue to a playlist - [InlineData("addToPlaylist", "PlaylistAddToPlaylist")] // adding a single track to a playlist - [InlineData("selectPlaylist", "AudioPlayerSelectPlaylist")] // the playlist selector - [InlineData("noPlaylists", "AudioPlayerNoPlaylists")] // no saved playlist is available - [InlineData("add", "AudioPlayerAdd")] // the add confirmation - [InlineData("playlistQueueAdded", "AudioPlayerPlaylistQueueAdded")] // the queue was added to a playlist - [InlineData("playlistQueueAddFailed", "AudioPlayerPlaylistQueueAddFailed")] // adding the queue to a playlist failed + [InlineData("toggleExpanded", "ToggleExpanded")] // The expanded player toggle. + [InlineData("previous", "AudioPlayerPrevious")] // The previous track control. + [InlineData("next", "AudioPlayerNext")] // The next track control. + [InlineData("stop", "AudioPlayerStop")] // The stop control. + [InlineData("repeat", "AudioPlayerRepeat")] // The repeat control. + [InlineData("repeatOff", "AudioPlayerRepeatOff")] // Repeat turned off. + [InlineData("repeatAll", "AudioPlayerRepeatAll")] // Repeat of the whole queue. + [InlineData("repeatOne", "AudioPlayerRepeatOne")] // Repeat of a single track. + [InlineData("queue", "AudioPlayerQueue")] // The play queue title. + [InlineData("albumArtwork", "AudioPlayerAlbumArtwork")] // The album artwork placeholder. + [InlineData("addQueueToPlaylist", "AudioPlayerAddQueueToPlaylist")] // Adding the queue to a playlist. + [InlineData("addToPlaylist", "PlaylistAddToPlaylist")] // Adding a single track to a playlist. + [InlineData("selectPlaylist", "AudioPlayerSelectPlaylist")] // The playlist selector. + [InlineData("noPlaylists", "AudioPlayerNoPlaylists")] // No saved playlist is available. + [InlineData("add", "AudioPlayerAdd")] // The add confirmation. + [InlineData("playlistQueueAdded", "AudioPlayerPlaylistQueueAdded")] // The queue was added to a playlist. + [InlineData("playlistQueueAddFailed", "AudioPlayerPlaylistQueueAddFailed")] // Adding the queue to a playlist failed. public void Build_WhenCalled_ShouldLocalizeThePlayerString(string modelKey, string resourceKey) { // Act diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeNavBuilderTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeNavBuilderTests.cs index 8829e8e4..91149c1d 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeNavBuilderTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeNavBuilderTests.cs @@ -244,7 +244,7 @@ public class ThemeNavBuilderTests // Assert ThemeNavSectionDto toolsSection = FindSection(result, "Localized-Tools", isMobile: false)!; Assert.Contains(toolsSection.Items, entry => entry.Label == "Localized-Settings" && entry.Url == "http://localhost/en-us/tools/settings"); - // the desktop tools section hosts the language submenu while the mobile menu has a dedicated language section + // The desktop tools section hosts the language submenu while the mobile menu has a dedicated language section. Assert.Contains(toolsSection.Items, entry => entry.Label == "Localized-Language" && entry.Children.Count == 10); } diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeTemplateEngineTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeTemplateEngineTests.cs index d824e70f..e25964a3 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeTemplateEngineTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeTemplateEngineTests.cs @@ -209,9 +209,9 @@ public class ThemeTemplateEngineTests } [Theory] - [InlineData(null)] // unresolved section - [InlineData(false)] // boolean false - [InlineData("")] // empty string + [InlineData(null)] // Unresolved section. + [InlineData(false)] // Boolean false. + [InlineData("")] // Empty string. public void RenderPage_WhenSectionIsFalsy_ShouldSkipChildren(object? sectionValue) { // Arrange @@ -487,9 +487,9 @@ public class ThemeTemplateEngineTests } [Theory] - [InlineData("{{bad-name}}")] // hyphen is not a valid name part character - [InlineData("{{two words}}")] // whitespace inside the expression - [InlineData("{{a..b}}")] // empty name part + [InlineData("{{bad-name}}")] // Hyphen is not a valid name part character. + [InlineData("{{two words}}")] // Whitespace inside the expression. + [InlineData("{{a..b}}")] // Empty name part. public void RenderPage_WhenExpressionIsInvalid_ShouldReturnTemplateError(string template) { // Act