mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 13:11:10 +00:00
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:
1 parent
727aa33318
commit
057f557791
540 files changed
+3888
-3888
No files matched your search
+4
-4
@@ -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
|
||||
|
||||
+8
-8
@@ -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
|
||||
|
||||
+26
-26
@@ -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
|
||||
|
||||
+22
-22
@@ -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
|
||||
|
||||
+8
-8
@@ -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
|
||||
|
||||
+26
-26
@@ -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
|
||||
|
||||
+16
-16
@@ -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
|
||||
|
||||
+26
-26
@@ -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
|
||||
|
||||
+11
-11
@@ -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
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
+15
-15
@@ -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
|
||||
|
||||
+22
-22
@@ -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
|
||||
|
||||
+15
-15
@@ -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
|
||||
|
||||
+15
-15
@@ -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
|
||||
|
||||
+16
-16
@@ -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
|
||||
|
||||
+15
-15
@@ -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
|
||||
|
||||
Reference in new issue
Block a user