Formats code comments as sentences in the tests.

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

No files matched your search

@@ -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
@@ -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
@@ -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);
}
@@ -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);
}
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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<IDirectoryInfo>();
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<string>(), Arg.Any<string>())
.Returns(callInfo => Path.Combine(callInfo.ArgAt<string>(0), callInfo.ArgAt<string>(1)));
@@ -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<WindowsRootItem>(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);
@@ -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<byte>(0, 100)];
SetupMockFileSystem(pathId, fileContent);
@@ -347,7 +347,7 @@ public class PathServiceTests
// Arrange
string validPath = @"C:\ValidPath\SubDir";
FileSystemPathId pathId = _fileSystemPathIdFixture.Create(validPath);
List<PathSegment> expectedSegments = _pathSegmentFixture.CreateMany(2); // Assuming parent path has 2 segments
List<PathSegment> 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
@@ -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<Rgba32> 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
@@ -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
@@ -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
@@ -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<IOperatingSystemInfo>();
sut = new(_mockPlatformContextFactory, mockOsInfo);
@@ -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
@@ -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,
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
}
@@ -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
@@ -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
@@ -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"));
}
}
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
@@ -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
@@ -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