mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 12:11:10 +00:00
Separates application validation errors from domain business rules
Moves the user settings, user id, scheduler display preference and thumbnail quality validation errors to the application error catalogs, leaves only business-rule errors in the domain catalogs, and records the domain-expert test for error ownership.
This commit is contained in:
1 parent
6e1253d3d5
commit
7f701ea3cc
30 files changed
+311
-273
No files matched your search
@@ -71,10 +71,9 @@ public class ErrorsTests
|
||||
{
|
||||
// Assert
|
||||
// The count assertion fails when an error is added or removed, reminding to update the assertions below.
|
||||
Assert.Equal(3, typeof(DomainErrors.Users).GetProperties().Length);
|
||||
Assert.Equal(2, typeof(DomainErrors.Users).GetProperties().Length);
|
||||
AssertError(DomainErrors.Users.UserAlreadyExists, ErrorType.Conflict);
|
||||
AssertError(DomainErrors.Users.UserDoesNotExist, ErrorType.NotFound);
|
||||
AssertError(DomainErrors.Users.UserIdCannotBeEmpty, ErrorType.Validation);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -82,38 +81,9 @@ public class ErrorsTests
|
||||
{
|
||||
// Assert
|
||||
// The count assertion fails when an error is added or removed, reminding to update the assertions below.
|
||||
Assert.Equal(31, typeof(DomainErrors.UserSettings).GetProperties().Length);
|
||||
Assert.Equal(2, typeof(DomainErrors.UserSettings).GetProperties().Length);
|
||||
AssertError(DomainErrors.UserSettings.UserSettingsAlreadyExists, ErrorType.Conflict);
|
||||
AssertError(DomainErrors.UserSettings.UserSettingsNotFound, ErrorType.NotFound);
|
||||
AssertError(DomainErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VolumeCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VolumeMustBeBetweenZeroAndOne, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.IsMutedCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.ShouldKeepDownloadingWhilePausedCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.ShouldAutoplayCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.IsGaplessPlaybackEnabledCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.ReplayGainModeCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.StreamingQualityCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.InvalidReplayGainMode, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.InvalidStreamingQuality, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterOrientationCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.InvalidVuMeterOrientation, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterSegmentCountCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterSegmentGapCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterMediumThresholdCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterMediumThresholdMustBeBetweenZeroAndOne, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterHighThresholdCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterShowPeakCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterPeakHoldDurationCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterReleasePerSecondCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterPeakReleasePerSecondCannotBeNull, ErrorType.Validation);
|
||||
AssertError(DomainErrors.UserSettings.VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred, ErrorType.Validation);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -325,9 +295,8 @@ public class ErrorsTests
|
||||
{
|
||||
// Assert
|
||||
// The count assertion fails when an error is added or removed, reminding to update the assertions below.
|
||||
Assert.Equal(2, typeof(DomainErrors.Thumbnails).GetProperties().Length);
|
||||
Assert.Single(typeof(DomainErrors.Thumbnails).GetProperties());
|
||||
AssertError(DomainErrors.Thumbnails.NoThumbnail, ErrorType.Failure);
|
||||
AssertError(DomainErrors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred, ErrorType.Validation);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in new issue
Block a user