diff --git a/AGENTS.md b/AGENTS.md index 1b3e2a0c..193674ac 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -16,8 +16,8 @@ These rules apply to every agent, on every task, in this repository. For C# code - DataAccess persistence: repositories persist aggregate graphs only through the closed toolkit in `Lumina.DataAccess\Common\Persistence` (`EditableValuesCopier`, `CollectionReconciler`, `SharedReferenceResolver`). Those primitives must stay generic and entity-agnostic. Never add a per-entity helper to that folder, and never hand-roll an equivalent in a repository: generalize the primitive (generics plus a marker interface such as `ISharedReferenceEntity`) or keep the logic in the repository. - Presentation layer: immediately decouples API contracts with manual mapping: ToQuery or ToCommand. FastEndpoints adds authentication by default, only `AllowAnonymous` is free access. Errors are always `ProblemDetails`. -- Application layer: mapping classes are extension methods in `Common\Mapping`, and each mapping file should *only* extend the type the name of the mapping file uses, ex: `UserEntityMapping` contains *only* `UserEntity` extension methods to map to other types. The used names are: `ToQuery`, `ToCommand`, `ToRepositoryEntity`, `ToRequest`, `ToResponse`, `ToDto`, `ToDomainEntity`, `ToDomainValueObject`. Any deviation needed is confirmed with the user. Validators validate application concerns: null or empty strings, negative numbers, correct emails, etc, they do not do async work and they do not do business rules validation. They are the first thing invoked in handlers. The next check should be for authentication/authorization. -- Domain layer: no nullable types or exceptions thrown. Use `Optional` and `Result`. Validations resume to *business rules* validations and invariants, not application validation. +- Application layer: mapping classes are extension methods in `Common\Mapping`, and each mapping file should *only* extend the type the name of the mapping file uses, ex: `UserEntityMapping` contains *only* `UserEntity` extension methods to map to other types. The used names are: `ToQuery`, `ToCommand`, `ToRepositoryEntity`, `ToRequest`, `ToResponse`, `ToDto`, `ToDomainEntity`, `ToDomainValueObject`. Any deviation needed is confirmed with the user. Validators validate application concerns: null or empty strings, negative numbers, correct emails, etc, they do not do async work and they do not do business rules validation. They are the first thing invoked in handlers. The next check should be for authentication/authorization. Validation error ownership is decided by the domain-expert test, not by the shape of the check: when a domain expert of that bounded context would state the rule in their own words, it is a business rule and its error belongs in `Domain/Common/Errors`; otherwise its error belongs in `Application/Common/Errors`. +- Domain layer: no nullable types or exceptions thrown. Use `Optional` and `Result`. Validations resume to *business rules* validations and invariants, not application validation. An error belongs in `Domain/Common/Errors` only when a domain expert of that bounded context would state the rule in their own words, whatever its technical shape. A VAT ceiling, a maximum seat count, or a required customer on an invoice is a domain rule; a positive id or a required database column is not (unless the domain of activity is database management). - If a class or file is located or does things in a way that has no precedent in the code base, VALIDATE WITH THE USER FIRST! DO NOT introduce new patterns, styles and conventions without getting permission first! ## Documentation diff --git a/src/Lumina.Application/Common/Errors/Errors.Scheduling.cs b/src/Lumina.Application/Common/Errors/Errors.Scheduling.cs new file mode 100644 index 00000000..2bb6b831 --- /dev/null +++ b/src/Lumina.Application/Common/Errors/Errors.Scheduling.cs @@ -0,0 +1,22 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Domain.Common.Primitives; +#endregion + +namespace Lumina.Application.Common.Errors; + +/// +/// Application scheduling related error types. +/// +public static partial class Errors +{ + /// + /// Error types for application scheduling operations. + /// + public static class Scheduling + { + /// + /// Gets the error that reports that the scheduler display time span must be a positive value. + /// + public static Error SchedulerDisplayTimeSpanMustBePositive => Error.Validation(description: nameof(SchedulerDisplayTimeSpanMustBePositive)); + } +} diff --git a/src/Lumina.Application/Common/Errors/Errors.Thumbnails.cs b/src/Lumina.Application/Common/Errors/Errors.Thumbnails.cs new file mode 100644 index 00000000..e31e6d52 --- /dev/null +++ b/src/Lumina.Application/Common/Errors/Errors.Thumbnails.cs @@ -0,0 +1,22 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Domain.Common.Primitives; +#endregion + +namespace Lumina.Application.Common.Errors; + +/// +/// Application thumbnails related error types. +/// +public static partial class Errors +{ + /// + /// Error types for application thumbnail operations. + /// + public static class Thumbnails + { + /// + /// Gets the error that reports that the image quality must be between 0 and 100. + /// + public static Error ImageQualityMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(ImageQualityMustBeBetweenZeroAndOneHundred)); + } +} diff --git a/src/Lumina.Application/Common/Errors/Errors.UserSettings.cs b/src/Lumina.Application/Common/Errors/Errors.UserSettings.cs new file mode 100644 index 00000000..a5e0da86 --- /dev/null +++ b/src/Lumina.Application/Common/Errors/Errors.UserSettings.cs @@ -0,0 +1,167 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Domain.Common.Primitives; +#endregion + +namespace Lumina.Application.Common.Errors; + +/// +/// Application user settings related error types. +/// +public static partial class Errors +{ + /// + /// Error types for application user settings operations. + /// + /// + /// The playback and VU meter bounds in this catalog are deliberately application-level validation: they constrain the shape and presentation range of the + /// settings a caller submits, not business invariants of the user settings aggregate. A rule that becomes a business invariant must move to the aggregate + /// and its error back to Domain/Common/Errors. + /// + public static class UserSettings + { + /// + /// Gets the error that reports that the number of items shown per page must be greater than zero. + /// + public static Error ItemsPerPageMustBeGreaterThanZero => Error.Validation(description: nameof(ItemsPerPageMustBeGreaterThanZero)); + + /// + /// Gets the error that reports that the playback volume cannot be . + /// + public static Error VolumeCannotBeNull => Error.Validation(description: nameof(VolumeCannotBeNull)); + + /// + /// Gets the error that reports that the playback volume must be between 0 and 1, inclusive. + /// + public static Error VolumeMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VolumeMustBeBetweenZeroAndOne)); + + /// + /// Gets the error that reports that the mute state cannot be . + /// + public static Error IsMutedCannotBeNull => Error.Validation(description: nameof(IsMutedCannotBeNull)); + + /// + /// Gets the error that reports that the option to keep downloading while playback is paused cannot be . + /// + public static Error ShouldKeepDownloadingWhilePausedCannotBeNull => Error.Validation(description: nameof(ShouldKeepDownloadingWhilePausedCannotBeNull)); + + /// + /// Gets the error that reports that the autoplay option cannot be . + /// + public static Error ShouldAutoplayCannotBeNull => Error.Validation(description: nameof(ShouldAutoplayCannotBeNull)); + + /// + /// Gets the error that reports that the gapless playback option cannot be . + /// + public static Error IsGaplessPlaybackEnabledCannotBeNull => Error.Validation(description: nameof(IsGaplessPlaybackEnabledCannotBeNull)); + + /// + /// Gets the error that reports that the replay gain mode cannot be . + /// + public static Error ReplayGainModeCannotBeNull => Error.Validation(description: nameof(ReplayGainModeCannotBeNull)); + + /// + /// Gets the error that reports that the streaming quality cannot be . + /// + public static Error StreamingQualityCannotBeNull => Error.Validation(description: nameof(StreamingQualityCannotBeNull)); + + /// + /// Gets the error that reports that the replay gain mode is not a recognized value. + /// + public static Error InvalidReplayGainMode => Error.Validation(description: nameof(InvalidReplayGainMode)); + + /// + /// Gets the error that reports that the streaming quality is not a recognized value. + /// + public static Error InvalidStreamingQuality => Error.Validation(description: nameof(InvalidStreamingQuality)); + + /// + /// Gets the error that reports that the VU meter orientation cannot be . + /// + public static Error VuMeterOrientationCannotBeNull => Error.Validation(description: nameof(VuMeterOrientationCannotBeNull)); + + /// + /// Gets the error that reports that the VU meter orientation is not a recognized value. + /// + public static Error InvalidVuMeterOrientation => Error.Validation(description: nameof(InvalidVuMeterOrientation)); + + /// + /// Gets the error that reports that the VU meter segment count cannot be . + /// + public static Error VuMeterSegmentCountCannotBeNull => Error.Validation(description: nameof(VuMeterSegmentCountCannotBeNull)); + + /// + /// Gets the error that reports that the VU meter segment count must be between 1 and 128, inclusive. + /// + public static Error VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight => Error.Validation(description: nameof(VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight)); + + /// + /// Gets the error that reports that the VU meter segment gap cannot be . + /// + public static Error VuMeterSegmentGapCannotBeNull => Error.Validation(description: nameof(VuMeterSegmentGapCannotBeNull)); + + /// + /// Gets the error that reports that the gap between the VU meter segments, in pixels, must be between 0 and 32, inclusive. + /// + public static Error VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo => Error.Validation(description: nameof(VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo)); + + /// + /// Gets the error that reports that the VU meter medium threshold cannot be . + /// + public static Error VuMeterMediumThresholdCannotBeNull => Error.Validation(description: nameof(VuMeterMediumThresholdCannotBeNull)); + + /// + /// Gets the error that reports that the VU meter medium threshold must be between 0 and 1, inclusive. + /// + public static Error VuMeterMediumThresholdMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VuMeterMediumThresholdMustBeBetweenZeroAndOne)); + + /// + /// Gets the error that reports that the VU meter high threshold cannot be . + /// + public static Error VuMeterHighThresholdCannotBeNull => Error.Validation(description: nameof(VuMeterHighThresholdCannotBeNull)); + + /// + /// Gets the error that reports that the VU meter high threshold must be between 0 and 1, inclusive. + /// + public static Error VuMeterHighThresholdMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VuMeterHighThresholdMustBeBetweenZeroAndOne)); + + /// + /// Gets the error that reports that the VU meter high threshold is lower than its medium threshold. + /// + public static Error VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold => Error.Validation(description: nameof(VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold)); + + /// + /// Gets the error that reports that the option to show the VU meter peak cannot be . + /// + public static Error VuMeterShowPeakCannotBeNull => Error.Validation(description: nameof(VuMeterShowPeakCannotBeNull)); + + /// + /// Gets the error that reports that the VU meter peak hold duration cannot be . + /// + public static Error VuMeterPeakHoldDurationCannotBeNull => Error.Validation(description: nameof(VuMeterPeakHoldDurationCannotBeNull)); + + /// + /// Gets the error that reports that the VU meter peak hold duration, in milliseconds, must be between 0 and 10000, inclusive. + /// + public static Error VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds => Error.Validation(description: nameof(VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds)); + + /// + /// Gets the error that reports that the VU meter release rate per second cannot be . + /// + public static Error VuMeterReleasePerSecondCannotBeNull => Error.Validation(description: nameof(VuMeterReleasePerSecondCannotBeNull)); + + /// + /// Gets the error that reports that the VU meter release rate per second must be between 0 and 100, inclusive. + /// + public static Error VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred)); + + /// + /// Gets the error that reports that the VU meter peak release rate per second cannot be . + /// + public static Error VuMeterPeakReleasePerSecondCannotBeNull => Error.Validation(description: nameof(VuMeterPeakReleasePerSecondCannotBeNull)); + + /// + /// Gets the error that reports that the VU meter peak release rate per second must be between 0 and 100, inclusive. + /// + public static Error VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred)); + } +} diff --git a/src/Lumina.Application/Common/Errors/Errors.Users.cs b/src/Lumina.Application/Common/Errors/Errors.Users.cs new file mode 100644 index 00000000..76774320 --- /dev/null +++ b/src/Lumina.Application/Common/Errors/Errors.Users.cs @@ -0,0 +1,22 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Domain.Common.Primitives; +#endregion + +namespace Lumina.Application.Common.Errors; + +/// +/// Application users related error types. +/// +public static partial class Errors +{ + /// + /// Error types for application user operations. + /// + public static class Users + { + /// + /// Gets the error that reports that the user identifier cannot be empty. + /// + public static Error UserIdCannotBeEmpty => Error.Validation(description: nameof(UserIdCannotBeEmpty)); + } +} diff --git a/src/Lumina.Application/Core/FileSystemManagement/Thumbnails/Queries/GetThumbnail/GetThumbnailQueryValidator.cs b/src/Lumina.Application/Core/FileSystemManagement/Thumbnails/Queries/GetThumbnail/GetThumbnailQueryValidator.cs index d65311cb..3edb4591 100644 --- a/src/Lumina.Application/Core/FileSystemManagement/Thumbnails/Queries/GetThumbnail/GetThumbnailQueryValidator.cs +++ b/src/Lumina.Application/Core/FileSystemManagement/Thumbnails/Queries/GetThumbnail/GetThumbnailQueryValidator.cs @@ -1,7 +1,8 @@ #region ========================================================================= USING ===================================================================================== using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Utilities; -using Lumina.Domain.Common.Errors; +using ApplicationErrors = Lumina.Application.Common.Errors.Errors; +using DomainErrors = Lumina.Domain.Common.Errors.Errors; #endregion namespace Lumina.Application.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail; @@ -18,10 +19,10 @@ public class GetThumbnailQueryValidator : AbstractValidator { RuleFor(query => query.Path) .NotEmpty() - .WithError(Errors.FileSystemManagement.PathCannotBeEmpty); + .WithError(DomainErrors.FileSystemManagement.PathCannotBeEmpty); RuleFor(query => query.Quality) .InclusiveBetween(0, 100) - .WithError(Errors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred); + .WithError(ApplicationErrors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred); } } diff --git a/src/Lumina.Application/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidator.cs b/src/Lumina.Application/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidator.cs index 6dea97e1..af726d8b 100644 --- a/src/Lumina.Application/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidator.cs +++ b/src/Lumina.Application/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidator.cs @@ -1,7 +1,7 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.Errors; using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Utilities; -using Lumina.Domain.Common.Errors; #endregion namespace Lumina.Application.Core.Scheduling.Commands.UpdateSchedulerDisplayPreferences; diff --git a/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidator.cs b/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidator.cs index 6f1dd7d6..45622b39 100644 --- a/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidator.cs +++ b/src/Lumina.Application/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidator.cs @@ -3,7 +3,6 @@ using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Utilities; using System; using ApplicationErrors = Lumina.Application.Common.Errors.Errors; -using DomainErrors = Lumina.Domain.Common.Errors.Errors; #endregion namespace Lumina.Application.Core.UsersManagement.Authorization.Commands.UpdateUserRoleAndPermissions; @@ -20,9 +19,9 @@ public class UpdateUserRoleAndPermissionsCommandValidator : AbstractValidator command.UserId) .NotEmpty() - .WithError(DomainErrors.Users.UserIdCannotBeEmpty) + .WithError(ApplicationErrors.Users.UserIdCannotBeEmpty) .Must(id => id != Guid.Empty) - .WithError(DomainErrors.Users.UserIdCannotBeEmpty); + .WithError(ApplicationErrors.Users.UserIdCannotBeEmpty); // Validate each permission Id when the list is provided. RuleForEach(command => command.Permissions) diff --git a/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetAuthorization/GetAuthorizationQueryValidator.cs b/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetAuthorization/GetAuthorizationQueryValidator.cs index 8eba2012..879b46d2 100644 --- a/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetAuthorization/GetAuthorizationQueryValidator.cs +++ b/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetAuthorization/GetAuthorizationQueryValidator.cs @@ -1,7 +1,7 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.Errors; using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Utilities; -using Lumina.Domain.Common.Errors; using System; #endregion diff --git a/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetUserPermissions/GetUserPermissionsQueryValidator.cs b/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetUserPermissions/GetUserPermissionsQueryValidator.cs index dadcd455..6c9b66ff 100644 --- a/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetUserPermissions/GetUserPermissionsQueryValidator.cs +++ b/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetUserPermissions/GetUserPermissionsQueryValidator.cs @@ -1,7 +1,7 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.Errors; using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Utilities; -using Lumina.Domain.Common.Errors; using System; #endregion diff --git a/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetUserRole/GetUserRoleQueryValidator.cs b/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetUserRole/GetUserRoleQueryValidator.cs index b237326c..d96101b2 100644 --- a/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetUserRole/GetUserRoleQueryValidator.cs +++ b/src/Lumina.Application/Core/UsersManagement/Authorization/Queries/GetUserRole/GetUserRoleQueryValidator.cs @@ -1,7 +1,7 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.Errors; using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Utilities; -using Lumina.Domain.Common.Errors; using System; #endregion diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidator.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidator.cs index 43edb206..77a31104 100644 --- a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidator.cs +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidator.cs @@ -1,7 +1,7 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.Errors; using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Utilities; -using Lumina.Domain.Common.Errors; #endregion namespace Lumina.Application.Core.UsersManagement.Settings.Commands.UpdatePlaybackState; diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidator.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidator.cs index 328d3f6f..9ade6bef 100644 --- a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidator.cs +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidator.cs @@ -1,7 +1,7 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.Errors; using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Utilities; -using Lumina.Domain.Common.Errors; #endregion namespace Lumina.Application.Core.UsersManagement.Settings.Commands.UpdateUserSettings; diff --git a/src/Lumina.Domain/Common/Errors/Errors.Scheduling.cs b/src/Lumina.Domain/Common/Errors/Errors.Scheduling.cs index 010121ea..971bfa57 100644 --- a/src/Lumina.Domain/Common/Errors/Errors.Scheduling.cs +++ b/src/Lumina.Domain/Common/Errors/Errors.Scheduling.cs @@ -78,10 +78,5 @@ public static partial class Errors /// Gets the error that reports that the schedule type is not a defined value. /// public static Error InvalidScheduleType => Error.Validation(description: nameof(InvalidScheduleType)); - - /// - /// Gets the error that reports that the scheduler display time span must be a positive value. - /// - public static Error SchedulerDisplayTimeSpanMustBePositive => Error.Validation(description: nameof(SchedulerDisplayTimeSpanMustBePositive)); } } diff --git a/src/Lumina.Domain/Common/Errors/Errors.Thumbnails.cs b/src/Lumina.Domain/Common/Errors/Errors.Thumbnails.cs index d7aba89f..a533db22 100644 --- a/src/Lumina.Domain/Common/Errors/Errors.Thumbnails.cs +++ b/src/Lumina.Domain/Common/Errors/Errors.Thumbnails.cs @@ -18,10 +18,5 @@ public static partial class Errors /// Gets the error that reports that no thumbnail is available for the requested media item. /// public static Error NoThumbnail => Error.Failure(description: nameof(NoThumbnail)); - - /// - /// Gets the error that reports that the image quality must be between 0 and 100. - /// - public static Error ImageQualityMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(ImageQualityMustBeBetweenZeroAndOneHundred)); } } diff --git a/src/Lumina.Domain/Common/Errors/Errors.UserSettings.cs b/src/Lumina.Domain/Common/Errors/Errors.UserSettings.cs index b8e15404..e00e7929 100644 --- a/src/Lumina.Domain/Common/Errors/Errors.UserSettings.cs +++ b/src/Lumina.Domain/Common/Errors/Errors.UserSettings.cs @@ -23,150 +23,5 @@ public static partial class Errors /// Gets the error that reports that no settings exist for the requested user. /// public static Error UserSettingsNotFound => Error.NotFound(description: nameof(UserSettingsNotFound)); - - /// - /// Gets the error that reports that the number of items shown per page must be greater than zero. - /// - public static Error ItemsPerPageMustBeGreaterThanZero => Error.Validation(description: nameof(ItemsPerPageMustBeGreaterThanZero)); - - /// - /// Gets the error that reports that the playback volume cannot be . - /// - public static Error VolumeCannotBeNull => Error.Validation(description: nameof(VolumeCannotBeNull)); - - /// - /// Gets the error that reports that the playback volume must be between 0 and 1, inclusive. - /// - public static Error VolumeMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VolumeMustBeBetweenZeroAndOne)); - - /// - /// Gets the error that reports that the mute state cannot be . - /// - public static Error IsMutedCannotBeNull => Error.Validation(description: nameof(IsMutedCannotBeNull)); - - /// - /// Gets the error that reports that the option to keep downloading while playback is paused cannot be . - /// - public static Error ShouldKeepDownloadingWhilePausedCannotBeNull => Error.Validation(description: nameof(ShouldKeepDownloadingWhilePausedCannotBeNull)); - - /// - /// Gets the error that reports that the autoplay option cannot be . - /// - public static Error ShouldAutoplayCannotBeNull => Error.Validation(description: nameof(ShouldAutoplayCannotBeNull)); - - /// - /// Gets the error that reports that the gapless playback option cannot be . - /// - public static Error IsGaplessPlaybackEnabledCannotBeNull => Error.Validation(description: nameof(IsGaplessPlaybackEnabledCannotBeNull)); - - /// - /// Gets the error that reports that the replay gain mode cannot be . - /// - public static Error ReplayGainModeCannotBeNull => Error.Validation(description: nameof(ReplayGainModeCannotBeNull)); - - /// - /// Gets the error that reports that the streaming quality cannot be . - /// - public static Error StreamingQualityCannotBeNull => Error.Validation(description: nameof(StreamingQualityCannotBeNull)); - - /// - /// Gets the error that reports that the replay gain mode is not a recognized value. - /// - public static Error InvalidReplayGainMode => Error.Validation(description: nameof(InvalidReplayGainMode)); - - /// - /// Gets the error that reports that the streaming quality is not a recognized value. - /// - public static Error InvalidStreamingQuality => Error.Validation(description: nameof(InvalidStreamingQuality)); - - /// - /// Gets the error that reports that the VU meter orientation cannot be . - /// - public static Error VuMeterOrientationCannotBeNull => Error.Validation(description: nameof(VuMeterOrientationCannotBeNull)); - - /// - /// Gets the error that reports that the VU meter orientation is not a recognized value. - /// - public static Error InvalidVuMeterOrientation => Error.Validation(description: nameof(InvalidVuMeterOrientation)); - - /// - /// Gets the error that reports that the VU meter segment count cannot be . - /// - public static Error VuMeterSegmentCountCannotBeNull => Error.Validation(description: nameof(VuMeterSegmentCountCannotBeNull)); - - /// - /// Gets the error that reports that the VU meter segment count must be between 1 and 128, inclusive. - /// - public static Error VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight => Error.Validation(description: nameof(VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight)); - - /// - /// Gets the error that reports that the VU meter segment gap cannot be . - /// - public static Error VuMeterSegmentGapCannotBeNull => Error.Validation(description: nameof(VuMeterSegmentGapCannotBeNull)); - - /// - /// Gets the error that reports that the gap between the VU meter segments, in pixels, must be between 0 and 32, inclusive. - /// - public static Error VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo => Error.Validation(description: nameof(VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo)); - - /// - /// Gets the error that reports that the VU meter medium threshold cannot be . - /// - public static Error VuMeterMediumThresholdCannotBeNull => Error.Validation(description: nameof(VuMeterMediumThresholdCannotBeNull)); - - /// - /// Gets the error that reports that the VU meter medium threshold must be between 0 and 1, inclusive. - /// - public static Error VuMeterMediumThresholdMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VuMeterMediumThresholdMustBeBetweenZeroAndOne)); - - /// - /// Gets the error that reports that the VU meter high threshold cannot be . - /// - public static Error VuMeterHighThresholdCannotBeNull => Error.Validation(description: nameof(VuMeterHighThresholdCannotBeNull)); - - /// - /// Gets the error that reports that the VU meter high threshold must be between 0 and 1, inclusive. - /// - public static Error VuMeterHighThresholdMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VuMeterHighThresholdMustBeBetweenZeroAndOne)); - - /// - /// Gets the error that reports that the VU meter high threshold is lower than its medium threshold. - /// - public static Error VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold => Error.Validation(description: nameof(VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold)); - - /// - /// Gets the error that reports that the option to show the VU meter peak cannot be . - /// - public static Error VuMeterShowPeakCannotBeNull => Error.Validation(description: nameof(VuMeterShowPeakCannotBeNull)); - - /// - /// Gets the error that reports that the VU meter peak hold duration cannot be . - /// - public static Error VuMeterPeakHoldDurationCannotBeNull => Error.Validation(description: nameof(VuMeterPeakHoldDurationCannotBeNull)); - - /// - /// Gets the error that reports that the VU meter peak hold duration, in milliseconds, must be between 0 and 10000, inclusive. - /// - public static Error VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds => Error.Validation(description: nameof(VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds)); - - /// - /// Gets the error that reports that the VU meter release rate per second cannot be . - /// - public static Error VuMeterReleasePerSecondCannotBeNull => Error.Validation(description: nameof(VuMeterReleasePerSecondCannotBeNull)); - - /// - /// Gets the error that reports that the VU meter release rate per second must be between 0 and 100, inclusive. - /// - public static Error VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred)); - - /// - /// Gets the error that reports that the VU meter peak release rate per second cannot be . - /// - public static Error VuMeterPeakReleasePerSecondCannotBeNull => Error.Validation(description: nameof(VuMeterPeakReleasePerSecondCannotBeNull)); - - /// - /// Gets the error that reports that the VU meter peak release rate per second must be between 0 and 100, inclusive. - /// - public static Error VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred)); } } diff --git a/src/Lumina.Domain/Common/Errors/Errors.Users.cs b/src/Lumina.Domain/Common/Errors/Errors.Users.cs index a0fb2c7d..ae2c4f22 100644 --- a/src/Lumina.Domain/Common/Errors/Errors.Users.cs +++ b/src/Lumina.Domain/Common/Errors/Errors.Users.cs @@ -23,10 +23,5 @@ public static partial class Errors /// Gets the error that reports that the requested user does not exist. /// public static Error UserDoesNotExist => Error.NotFound(description: nameof(UserDoesNotExist)); - - /// - /// Gets the error that reports that the user identifier cannot be empty. - /// - public static Error UserIdCannotBeEmpty => Error.Validation(description: nameof(UserIdCannotBeEmpty)); } } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Thumbnails/Queries/GetThumbnail/GetThumbnailQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Thumbnails/Queries/GetThumbnail/GetThumbnailQueryValidatorTests.cs index 880376f2..c8d626a8 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Thumbnails/Queries/GetThumbnail/GetThumbnailQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/FileSystemManagement/Thumbnails/Queries/GetThumbnail/GetThumbnailQueryValidatorTests.cs @@ -2,10 +2,11 @@ using Lumina.Application.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail; using Lumina.Application.Fixtures.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail; using Lumina.Application.UnitTests.Common.Setup; -using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using ApplicationErrors = Lumina.Application.Common.Errors.Errors; +using DomainErrors = Lumina.Domain.Common.Errors.Errors; #endregion namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail; @@ -29,7 +30,7 @@ public class GetThumbnailQueryValidatorTests List result = _validator.TestValidate(query); // Assert - result.ShouldHaveValidationError(Errors.FileSystemManagement.PathCannotBeEmpty); + result.ShouldHaveValidationError(DomainErrors.FileSystemManagement.PathCannotBeEmpty); } [Fact] @@ -42,7 +43,7 @@ public class GetThumbnailQueryValidatorTests List result = _validator.TestValidate(query); // Assert - result.ShouldHaveValidationError(Errors.FileSystemManagement.PathCannotBeEmpty); + result.ShouldHaveValidationError(DomainErrors.FileSystemManagement.PathCannotBeEmpty); } [Fact] @@ -55,7 +56,7 @@ public class GetThumbnailQueryValidatorTests List result = _validator.TestValidate(query); // Assert - result.ShouldNotHaveValidationError(Errors.FileSystemManagement.PathCannotBeEmpty); + result.ShouldNotHaveValidationError(DomainErrors.FileSystemManagement.PathCannotBeEmpty); } [Fact] @@ -68,7 +69,7 @@ public class GetThumbnailQueryValidatorTests List result = _validator.TestValidate(query); // Assert - result.ShouldHaveValidationError(Errors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred); + result.ShouldHaveValidationError(ApplicationErrors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred); } [Fact] @@ -81,7 +82,7 @@ public class GetThumbnailQueryValidatorTests List result = _validator.TestValidate(query); // Assert - result.ShouldHaveValidationError(Errors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred); + result.ShouldHaveValidationError(ApplicationErrors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred); } [Fact] @@ -94,7 +95,7 @@ public class GetThumbnailQueryValidatorTests List result = _validator.TestValidate(query); // Assert - result.ShouldNotHaveValidationError(Errors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred); + result.ShouldNotHaveValidationError(ApplicationErrors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred); } } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandHandlerTests.cs index 3e579bc9..c1f52747 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandHandlerTests.cs @@ -15,7 +15,6 @@ using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using ApplicationErrors = Lumina.Application.Common.Errors.Errors; -using DomainErrors = Lumina.Domain.Common.Errors.Errors; #endregion namespace Lumina.Application.UnitTests.Core.Scheduling.Commands.UpdateSchedulerDisplayPreferences; @@ -89,14 +88,14 @@ public class UpdateSchedulerDisplayPreferencesCommandHandlerTests // Arrange UpdateSchedulerDisplayPreferencesCommand command = _updateSchedulerDisplayPreferencesCommandFixture.Create(displayTimeSpan: 0); _mockValidator.Validate(Arg.Any()) - .Returns([DomainErrors.Scheduling.SchedulerDisplayTimeSpanMustBePositive]); + .Returns([ApplicationErrors.Scheduling.SchedulerDisplayTimeSpanMustBePositive]); // Act Result result = await _sut.HandleAsync(command, CancellationToken.None); // Assert Assert.True(result.IsFailure); - Assert.Equal(DomainErrors.Scheduling.SchedulerDisplayTimeSpanMustBePositive, result.FirstError); + Assert.Equal(ApplicationErrors.Scheduling.SchedulerDisplayTimeSpanMustBePositive, result.FirstError); await _mockSchedulerDisplayPreferencesRepository.DidNotReceive().UpsertAsync(Arg.Any(), Arg.Any()); await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidatorTests.cs index f7be3f43..10e96a93 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/Scheduling/Commands/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesCommandValidatorTests.cs @@ -1,8 +1,8 @@ #region ========================================================================= USING ===================================================================================== using Lumina.Application.Core.Scheduling.Commands.UpdateSchedulerDisplayPreferences; using Lumina.Application.Fixtures.Core.Scheduling.Commands.UpdateSchedulerDisplayPreferences; +using Lumina.Application.Common.Errors; using Lumina.Application.UnitTests.Common.Setup; -using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidatorTests.cs index 8f8a391f..093458e2 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Commands/UpdateUserRoleAndPermissions/UpdateUserRoleAndPermissionsCommandValidatorTests.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using ApplicationErrors = Lumina.Application.Common.Errors.Errors; -using DomainErrors = Lumina.Domain.Common.Errors.Errors; #endregion namespace Lumina.Application.UnitTests.Core.UsersManagement.Authorization.Commands.UpdateUserRoleAndPermissions; @@ -34,7 +33,7 @@ public class UpdateUserRoleAndPermissionsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(DomainErrors.Users.UserIdCannotBeEmpty); + result.ShouldHaveValidationError(ApplicationErrors.Users.UserIdCannotBeEmpty); } [Fact] diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetAuthorization/GetAuthorizationQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetAuthorization/GetAuthorizationQueryValidatorTests.cs index 4831a89b..3f725fb4 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetAuthorization/GetAuthorizationQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetAuthorization/GetAuthorizationQueryValidatorTests.cs @@ -1,8 +1,8 @@ #region ========================================================================= USING ===================================================================================== using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetAuthorization; using Lumina.Application.Fixtures.Core.UsersManagement.Authorization.Queries.GetAuthorization; +using Lumina.Application.Common.Errors; using Lumina.Application.UnitTests.Common.Setup; -using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; using System; using System.Collections.Generic; diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetUserPermissions/GetUserPermissionsQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetUserPermissions/GetUserPermissionsQueryValidatorTests.cs index 435de5eb..532092dc 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetUserPermissions/GetUserPermissionsQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetUserPermissions/GetUserPermissionsQueryValidatorTests.cs @@ -1,8 +1,8 @@ #region ========================================================================= USING ===================================================================================== using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserPermissions; using Lumina.Application.Fixtures.Core.UsersManagement.Authorization.Queries.GetUserPermissions; +using Lumina.Application.Common.Errors; using Lumina.Application.UnitTests.Common.Setup; -using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; using System; using System.Collections.Generic; diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetUserRole/GetUserRoleQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetUserRole/GetUserRoleQueryValidatorTests.cs index 5aa9f6e4..9073936c 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetUserRole/GetUserRoleQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Authorization/Queries/GetUserRole/GetUserRoleQueryValidatorTests.cs @@ -1,8 +1,8 @@ #region ========================================================================= USING ===================================================================================== using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserRole; using Lumina.Application.Fixtures.Core.UsersManagement.Authorization.Queries.GetUserRole; +using Lumina.Application.Common.Errors; using Lumina.Application.UnitTests.Common.Setup; -using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; using System; using System.Collections.Generic; diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandHandlerTests.cs index 4bfffd87..d0e99e7c 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandHandlerTests.cs @@ -14,7 +14,6 @@ using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using ApplicationErrors = Lumina.Application.Common.Errors.Errors; -using DomainErrors = Lumina.Domain.Common.Errors.Errors; #endregion namespace Lumina.Application.UnitTests.Core.UsersManagement.Settings.Commands.UpdatePlaybackState; @@ -60,14 +59,14 @@ public class UpdatePlaybackStateCommandHandlerTests // Arrange UpdatePlaybackStateCommand command = _updatePlaybackStateCommandFixture.Create(); _mockValidator.Validate(Arg.Any()) - .Returns([DomainErrors.UserSettings.VolumeMustBeBetweenZeroAndOne]); + .Returns([ApplicationErrors.UserSettings.VolumeMustBeBetweenZeroAndOne]); // Act Result result = await _sut.HandleAsync(command, CancellationToken.None); // Assert Assert.True(result.IsFailure); - Assert.Equal(DomainErrors.UserSettings.VolumeMustBeBetweenZeroAndOne, result.FirstError); + Assert.Equal(ApplicationErrors.UserSettings.VolumeMustBeBetweenZeroAndOne, result.FirstError); await _mockUserSettingsRepository.DidNotReceive().GetByUserIdAsync(Arg.Any(), Arg.Any()); await _mockUserSettingsRepository.DidNotReceive().InsertAsync(Arg.Any(), Arg.Any()); await _mockUserSettingsRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidatorTests.cs index 13dde851..62388aee 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidatorTests.cs @@ -2,10 +2,10 @@ using Lumina.Application.Core.UsersManagement.Settings.Commands.UpdatePlaybackState; using Lumina.Application.Fixtures.Core.UsersManagement.Settings.Commands.UpdatePlaybackState; using Lumina.Application.UnitTests.Common.Setup; -using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using ApplicationErrors = Lumina.Application.Common.Errors.Errors; #endregion namespace Lumina.Application.UnitTests.Core.UsersManagement.Settings.Commands.UpdatePlaybackState; @@ -29,8 +29,8 @@ public class UpdatePlaybackStateCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VolumeCannotBeNull); - result.ShouldNotHaveValidationError(Errors.UserSettings.VolumeMustBeBetweenZeroAndOne); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VolumeCannotBeNull); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VolumeMustBeBetweenZeroAndOne); } [Theory] @@ -46,7 +46,7 @@ public class UpdatePlaybackStateCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VolumeMustBeBetweenZeroAndOne); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VolumeMustBeBetweenZeroAndOne); } [Theory] @@ -62,7 +62,7 @@ public class UpdatePlaybackStateCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VolumeMustBeBetweenZeroAndOne); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VolumeMustBeBetweenZeroAndOne); } [Theory] @@ -78,8 +78,8 @@ public class UpdatePlaybackStateCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.VolumeMustBeBetweenZeroAndOne); - result.ShouldNotHaveValidationError(Errors.UserSettings.VolumeCannotBeNull); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VolumeMustBeBetweenZeroAndOne); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VolumeCannotBeNull); } [Fact] @@ -92,7 +92,7 @@ public class UpdatePlaybackStateCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.IsMutedCannotBeNull); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.IsMutedCannotBeNull); } [Theory] @@ -107,7 +107,7 @@ public class UpdatePlaybackStateCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.IsMutedCannotBeNull); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.IsMutedCannotBeNull); } [Fact] diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandlerTests.cs index 5994d7c0..2536fc73 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandlerTests.cs @@ -14,7 +14,6 @@ using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using ApplicationErrors = Lumina.Application.Common.Errors.Errors; -using DomainErrors = Lumina.Domain.Common.Errors.Errors; #endregion namespace Lumina.Application.UnitTests.Core.UsersManagement.Settings.Commands.UpdateUserSettings; @@ -137,14 +136,14 @@ public class UpdateUserSettingsCommandHandlerTests // Arrange UpdateUserSettingsCommand command = _updateUserSettingsCommandFixture.Create(); _mockValidator.Validate(Arg.Any()) - .Returns([DomainErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero]); + .Returns([ApplicationErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero]); // Act Result result = await _sut.HandleAsync(command, CancellationToken.None); // Assert Assert.True(result.IsFailure); - Assert.Equal(DomainErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero, result.FirstError); + Assert.Equal(ApplicationErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero, result.FirstError); await _mockUserSettingsRepository.DidNotReceive().GetByUserIdAsync(Arg.Any(), Arg.Any()); await _mockUserSettingsRepository.DidNotReceive().InsertAsync(Arg.Any(), Arg.Any()); await _mockUserSettingsRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidatorTests.cs index 293f9e35..83456b76 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidatorTests.cs @@ -2,11 +2,11 @@ using Lumina.Application.Core.UsersManagement.Settings.Commands.UpdateUserSettings; using Lumina.Application.Fixtures.Core.UsersManagement.Settings.Commands.UpdateUserSettings; using Lumina.Application.UnitTests.Common.Setup; -using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using ApplicationErrors = Lumina.Application.Common.Errors.Errors; #endregion namespace Lumina.Application.UnitTests.Core.UsersManagement.Settings.Commands.UpdateUserSettings; @@ -33,7 +33,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero); } [Theory] @@ -49,7 +49,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero); } [Fact] @@ -62,7 +62,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterOrientationCannotBeNull); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterOrientationCannotBeNull); } [Fact] @@ -75,7 +75,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterSegmentCountCannotBeNull); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentCountCannotBeNull); } [Fact] @@ -88,7 +88,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterSegmentGapCannotBeNull); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentGapCannotBeNull); } [Fact] @@ -101,7 +101,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterMediumThresholdCannotBeNull); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterMediumThresholdCannotBeNull); } [Fact] @@ -114,7 +114,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterHighThresholdCannotBeNull); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdCannotBeNull); } [Fact] @@ -127,7 +127,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterShowPeakCannotBeNull); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterShowPeakCannotBeNull); } [Fact] @@ -140,7 +140,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterPeakHoldDurationCannotBeNull); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakHoldDurationCannotBeNull); } [Fact] @@ -153,7 +153,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterReleasePerSecondCannotBeNull); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterReleasePerSecondCannotBeNull); } [Fact] @@ -166,7 +166,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterPeakReleasePerSecondCannotBeNull); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakReleasePerSecondCannotBeNull); } [Theory] @@ -182,7 +182,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.InvalidVuMeterOrientation); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.InvalidVuMeterOrientation); } [Theory] @@ -197,7 +197,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.InvalidVuMeterOrientation); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.InvalidVuMeterOrientation); } [Theory] @@ -214,7 +214,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight); } [Theory] @@ -230,7 +230,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight); } [Theory] @@ -246,7 +246,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo); } [Theory] @@ -262,7 +262,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo); } [Theory] @@ -280,7 +280,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterMediumThresholdMustBeBetweenZeroAndOne); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterMediumThresholdMustBeBetweenZeroAndOne); } [Theory] @@ -298,7 +298,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterMediumThresholdMustBeBetweenZeroAndOne); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterMediumThresholdMustBeBetweenZeroAndOne); } [Theory] @@ -316,7 +316,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne); } [Fact] @@ -331,7 +331,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne); } [Fact] @@ -346,7 +346,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne); } [Fact] @@ -361,7 +361,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold); } [Theory] @@ -380,7 +380,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold); } [Theory] @@ -395,7 +395,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterShowPeakCannotBeNull); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterShowPeakCannotBeNull); } [Theory] @@ -412,7 +412,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds); } [Theory] @@ -429,7 +429,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds); } [Theory] @@ -446,7 +446,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred); } [Theory] @@ -463,7 +463,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred); } [Theory] @@ -480,7 +480,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldHaveValidationError(Errors.UserSettings.VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred); + result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred); } [Theory] @@ -497,7 +497,7 @@ public class UpdateUserSettingsCommandValidatorTests List result = _validator.TestValidate(command); // Assert - result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred); + result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred); } [Fact] diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Common/Errors/ErrorsTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Common/Errors/ErrorsTests.cs index 94aa7d31..a7763e40 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Common/Errors/ErrorsTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Common/Errors/ErrorsTests.cs @@ -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] diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Scheduling/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Scheduling/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesEndpointTests.cs index b5889653..835a00fc 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Scheduling/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Scheduling/UpdateSchedulerDisplayPreferences/UpdateSchedulerDisplayPreferencesEndpointTests.cs @@ -13,7 +13,6 @@ using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using ApplicationErrors = Lumina.Application.Common.Errors.Errors; -using DomainErrors = Lumina.Domain.Common.Errors.Errors; #endregion namespace Lumina.Presentation.Api.UnitTests.Core.Endpoints.Scheduling.UpdateSchedulerDisplayPreferences; @@ -60,7 +59,7 @@ public class UpdateSchedulerDisplayPreferencesEndpointTests // Arrange UpdateSchedulerDisplayPreferencesRequest request = _updateSchedulerDisplayPreferencesRequestFixture.Create(); CancellationToken cancellationToken = CancellationToken.None; - Error expectedError = DomainErrors.Scheduling.SchedulerDisplayTimeSpanMustBePositive; + Error expectedError = ApplicationErrors.Scheduling.SchedulerDisplayTimeSpanMustBePositive; _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) .Returns(expectedError);