mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Merge pull request #303 from BinaryAlley/refactor/classify-validation-error-ownership
Separates application validation errors from domain business rules
This commit is contained in:
30 files changed
+311
-273
No files matched your search
@@ -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<T>` and `Result<T>`. 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<T>` and `Result<T>`. 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
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Errors;
|
||||
|
||||
/// <summary>
|
||||
/// Application scheduling related error types.
|
||||
/// </summary>
|
||||
public static partial class Errors
|
||||
{
|
||||
/// <summary>
|
||||
/// Error types for application scheduling operations.
|
||||
/// </summary>
|
||||
public static class Scheduling
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the scheduler display time span must be a positive value.
|
||||
/// </summary>
|
||||
public static Error SchedulerDisplayTimeSpanMustBePositive => Error.Validation(description: nameof(SchedulerDisplayTimeSpanMustBePositive));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Errors;
|
||||
|
||||
/// <summary>
|
||||
/// Application thumbnails related error types.
|
||||
/// </summary>
|
||||
public static partial class Errors
|
||||
{
|
||||
/// <summary>
|
||||
/// Error types for application thumbnail operations.
|
||||
/// </summary>
|
||||
public static class Thumbnails
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the image quality must be between 0 and 100.
|
||||
/// </summary>
|
||||
public static Error ImageQualityMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(ImageQualityMustBeBetweenZeroAndOneHundred));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Errors;
|
||||
|
||||
/// <summary>
|
||||
/// Application user settings related error types.
|
||||
/// </summary>
|
||||
public static partial class Errors
|
||||
{
|
||||
/// <summary>
|
||||
/// Error types for application user settings operations.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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 <c>Domain/Common/Errors</c>.
|
||||
/// </remarks>
|
||||
public static class UserSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the number of items shown per page must be greater than zero.
|
||||
/// </summary>
|
||||
public static Error ItemsPerPageMustBeGreaterThanZero => Error.Validation(description: nameof(ItemsPerPageMustBeGreaterThanZero));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the playback volume cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VolumeCannotBeNull => Error.Validation(description: nameof(VolumeCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the playback volume must be between 0 and 1, inclusive.
|
||||
/// </summary>
|
||||
public static Error VolumeMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VolumeMustBeBetweenZeroAndOne));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the mute state cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error IsMutedCannotBeNull => Error.Validation(description: nameof(IsMutedCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the option to keep downloading while playback is paused cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error ShouldKeepDownloadingWhilePausedCannotBeNull => Error.Validation(description: nameof(ShouldKeepDownloadingWhilePausedCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the autoplay option cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error ShouldAutoplayCannotBeNull => Error.Validation(description: nameof(ShouldAutoplayCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the gapless playback option cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error IsGaplessPlaybackEnabledCannotBeNull => Error.Validation(description: nameof(IsGaplessPlaybackEnabledCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the replay gain mode cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error ReplayGainModeCannotBeNull => Error.Validation(description: nameof(ReplayGainModeCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the streaming quality cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error StreamingQualityCannotBeNull => Error.Validation(description: nameof(StreamingQualityCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the replay gain mode is not a recognized value.
|
||||
/// </summary>
|
||||
public static Error InvalidReplayGainMode => Error.Validation(description: nameof(InvalidReplayGainMode));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the streaming quality is not a recognized value.
|
||||
/// </summary>
|
||||
public static Error InvalidStreamingQuality => Error.Validation(description: nameof(InvalidStreamingQuality));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter orientation cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterOrientationCannotBeNull => Error.Validation(description: nameof(VuMeterOrientationCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter orientation is not a recognized value.
|
||||
/// </summary>
|
||||
public static Error InvalidVuMeterOrientation => Error.Validation(description: nameof(InvalidVuMeterOrientation));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter segment count cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterSegmentCountCannotBeNull => Error.Validation(description: nameof(VuMeterSegmentCountCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter segment count must be between 1 and 128, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight => Error.Validation(description: nameof(VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter segment gap cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterSegmentGapCannotBeNull => Error.Validation(description: nameof(VuMeterSegmentGapCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the gap between the VU meter segments, in pixels, must be between 0 and 32, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo => Error.Validation(description: nameof(VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter medium threshold cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterMediumThresholdCannotBeNull => Error.Validation(description: nameof(VuMeterMediumThresholdCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter medium threshold must be between 0 and 1, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterMediumThresholdMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VuMeterMediumThresholdMustBeBetweenZeroAndOne));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter high threshold cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterHighThresholdCannotBeNull => Error.Validation(description: nameof(VuMeterHighThresholdCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter high threshold must be between 0 and 1, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterHighThresholdMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VuMeterHighThresholdMustBeBetweenZeroAndOne));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter high threshold is lower than its medium threshold.
|
||||
/// </summary>
|
||||
public static Error VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold => Error.Validation(description: nameof(VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the option to show the VU meter peak cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterShowPeakCannotBeNull => Error.Validation(description: nameof(VuMeterShowPeakCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter peak hold duration cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterPeakHoldDurationCannotBeNull => Error.Validation(description: nameof(VuMeterPeakHoldDurationCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter peak hold duration, in milliseconds, must be between 0 and 10000, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds => Error.Validation(description: nameof(VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter release rate per second cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterReleasePerSecondCannotBeNull => Error.Validation(description: nameof(VuMeterReleasePerSecondCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter release rate per second must be between 0 and 100, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter peak release rate per second cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterPeakReleasePerSecondCannotBeNull => Error.Validation(description: nameof(VuMeterPeakReleasePerSecondCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter peak release rate per second must be between 0 and 100, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Errors;
|
||||
|
||||
/// <summary>
|
||||
/// Application users related error types.
|
||||
/// </summary>
|
||||
public static partial class Errors
|
||||
{
|
||||
/// <summary>
|
||||
/// Error types for application user operations.
|
||||
/// </summary>
|
||||
public static class Users
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the user identifier cannot be empty.
|
||||
/// </summary>
|
||||
public static Error UserIdCannotBeEmpty => Error.Validation(description: nameof(UserIdCannotBeEmpty));
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -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<GetThumbnailQuery>
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+2
-3
@@ -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<Up
|
||||
{
|
||||
RuleFor(command => 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)
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -78,10 +78,5 @@ public static partial class Errors
|
||||
/// Gets the error that reports that the schedule type is not a defined value.
|
||||
/// </summary>
|
||||
public static Error InvalidScheduleType => Error.Validation(description: nameof(InvalidScheduleType));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the scheduler display time span must be a positive value.
|
||||
/// </summary>
|
||||
public static Error SchedulerDisplayTimeSpanMustBePositive => Error.Validation(description: nameof(SchedulerDisplayTimeSpanMustBePositive));
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,5 @@ public static partial class Errors
|
||||
/// Gets the error that reports that no thumbnail is available for the requested media item.
|
||||
/// </summary>
|
||||
public static Error NoThumbnail => Error.Failure(description: nameof(NoThumbnail));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the image quality must be between 0 and 100.
|
||||
/// </summary>
|
||||
public static Error ImageQualityMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(ImageQualityMustBeBetweenZeroAndOneHundred));
|
||||
}
|
||||
}
|
||||
@@ -23,150 +23,5 @@ public static partial class Errors
|
||||
/// Gets the error that reports that no settings exist for the requested user.
|
||||
/// </summary>
|
||||
public static Error UserSettingsNotFound => Error.NotFound(description: nameof(UserSettingsNotFound));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the number of items shown per page must be greater than zero.
|
||||
/// </summary>
|
||||
public static Error ItemsPerPageMustBeGreaterThanZero => Error.Validation(description: nameof(ItemsPerPageMustBeGreaterThanZero));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the playback volume cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VolumeCannotBeNull => Error.Validation(description: nameof(VolumeCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the playback volume must be between 0 and 1, inclusive.
|
||||
/// </summary>
|
||||
public static Error VolumeMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VolumeMustBeBetweenZeroAndOne));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the mute state cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error IsMutedCannotBeNull => Error.Validation(description: nameof(IsMutedCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the option to keep downloading while playback is paused cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error ShouldKeepDownloadingWhilePausedCannotBeNull => Error.Validation(description: nameof(ShouldKeepDownloadingWhilePausedCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the autoplay option cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error ShouldAutoplayCannotBeNull => Error.Validation(description: nameof(ShouldAutoplayCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the gapless playback option cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error IsGaplessPlaybackEnabledCannotBeNull => Error.Validation(description: nameof(IsGaplessPlaybackEnabledCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the replay gain mode cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error ReplayGainModeCannotBeNull => Error.Validation(description: nameof(ReplayGainModeCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the streaming quality cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error StreamingQualityCannotBeNull => Error.Validation(description: nameof(StreamingQualityCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the replay gain mode is not a recognized value.
|
||||
/// </summary>
|
||||
public static Error InvalidReplayGainMode => Error.Validation(description: nameof(InvalidReplayGainMode));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the streaming quality is not a recognized value.
|
||||
/// </summary>
|
||||
public static Error InvalidStreamingQuality => Error.Validation(description: nameof(InvalidStreamingQuality));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter orientation cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterOrientationCannotBeNull => Error.Validation(description: nameof(VuMeterOrientationCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter orientation is not a recognized value.
|
||||
/// </summary>
|
||||
public static Error InvalidVuMeterOrientation => Error.Validation(description: nameof(InvalidVuMeterOrientation));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter segment count cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterSegmentCountCannotBeNull => Error.Validation(description: nameof(VuMeterSegmentCountCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter segment count must be between 1 and 128, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight => Error.Validation(description: nameof(VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter segment gap cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterSegmentGapCannotBeNull => Error.Validation(description: nameof(VuMeterSegmentGapCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the gap between the VU meter segments, in pixels, must be between 0 and 32, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo => Error.Validation(description: nameof(VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter medium threshold cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterMediumThresholdCannotBeNull => Error.Validation(description: nameof(VuMeterMediumThresholdCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter medium threshold must be between 0 and 1, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterMediumThresholdMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VuMeterMediumThresholdMustBeBetweenZeroAndOne));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter high threshold cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterHighThresholdCannotBeNull => Error.Validation(description: nameof(VuMeterHighThresholdCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter high threshold must be between 0 and 1, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterHighThresholdMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VuMeterHighThresholdMustBeBetweenZeroAndOne));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter high threshold is lower than its medium threshold.
|
||||
/// </summary>
|
||||
public static Error VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold => Error.Validation(description: nameof(VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the option to show the VU meter peak cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterShowPeakCannotBeNull => Error.Validation(description: nameof(VuMeterShowPeakCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter peak hold duration cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterPeakHoldDurationCannotBeNull => Error.Validation(description: nameof(VuMeterPeakHoldDurationCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter peak hold duration, in milliseconds, must be between 0 and 10000, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds => Error.Validation(description: nameof(VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter release rate per second cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterReleasePerSecondCannotBeNull => Error.Validation(description: nameof(VuMeterReleasePerSecondCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter release rate per second must be between 0 and 100, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter peak release rate per second cannot be <see langword="null"/>.
|
||||
/// </summary>
|
||||
public static Error VuMeterPeakReleasePerSecondCannotBeNull => Error.Validation(description: nameof(VuMeterPeakReleasePerSecondCannotBeNull));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the VU meter peak release rate per second must be between 0 and 100, inclusive.
|
||||
/// </summary>
|
||||
public static Error VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred => Error.Validation(description: nameof(VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred));
|
||||
}
|
||||
}
|
||||
@@ -23,10 +23,5 @@ public static partial class Errors
|
||||
/// Gets the error that reports that the requested user does not exist.
|
||||
/// </summary>
|
||||
public static Error UserDoesNotExist => Error.NotFound(description: nameof(UserDoesNotExist));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error that reports that the user identifier cannot be empty.
|
||||
/// </summary>
|
||||
public static Error UserIdCannotBeEmpty => Error.Validation(description: nameof(UserIdCannotBeEmpty));
|
||||
}
|
||||
}
|
||||
+8
-7
@@ -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<Error> result = _validator.TestValidate(query);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.FileSystemManagement.PathCannotBeEmpty);
|
||||
result.ShouldHaveValidationError(DomainErrors.FileSystemManagement.PathCannotBeEmpty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -42,7 +43,7 @@ public class GetThumbnailQueryValidatorTests
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.FileSystemManagement.PathCannotBeEmpty);
|
||||
result.ShouldHaveValidationError(DomainErrors.FileSystemManagement.PathCannotBeEmpty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -55,7 +56,7 @@ public class GetThumbnailQueryValidatorTests
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.FileSystemManagement.PathCannotBeEmpty);
|
||||
result.ShouldNotHaveValidationError(DomainErrors.FileSystemManagement.PathCannotBeEmpty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -68,7 +69,7 @@ public class GetThumbnailQueryValidatorTests
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -81,7 +82,7 @@ public class GetThumbnailQueryValidatorTests
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -94,7 +95,7 @@ public class GetThumbnailQueryValidatorTests
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.Thumbnails.ImageQualityMustBeBetweenZeroAndOneHundred);
|
||||
}
|
||||
|
||||
}
|
||||
+2
-3
@@ -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<UpdateSchedulerDisplayPreferencesCommand>())
|
||||
.Returns([DomainErrors.Scheduling.SchedulerDisplayTimeSpanMustBePositive]);
|
||||
.Returns([ApplicationErrors.Scheduling.SchedulerDisplayTimeSpanMustBePositive]);
|
||||
|
||||
// Act
|
||||
Result<Updated> 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<SchedulerDisplayPreferencesEntity>(), Arg.Any<CancellationToken>());
|
||||
await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+1
-2
@@ -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<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(DomainErrors.Users.UserIdCannotBeEmpty);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.Users.UserIdCannotBeEmpty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+2
-3
@@ -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<UpdatePlaybackStateCommand>())
|
||||
.Returns([DomainErrors.UserSettings.VolumeMustBeBetweenZeroAndOne]);
|
||||
.Returns([ApplicationErrors.UserSettings.VolumeMustBeBetweenZeroAndOne]);
|
||||
|
||||
// Act
|
||||
Result<Updated> 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<Guid>(), Arg.Any<CancellationToken>());
|
||||
await _mockUserSettingsRepository.DidNotReceive().InsertAsync(Arg.Any<UserSettingsEntity>(), Arg.Any<CancellationToken>());
|
||||
await _mockUserSettingsRepository.DidNotReceive().UpdateAsync(Arg.Any<UserSettingsEntity>(), Arg.Any<CancellationToken>());
|
||||
|
||||
+9
-9
@@ -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<Error> 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<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VolumeMustBeBetweenZeroAndOne);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VolumeMustBeBetweenZeroAndOne);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -62,7 +62,7 @@ public class UpdatePlaybackStateCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VolumeMustBeBetweenZeroAndOne);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VolumeMustBeBetweenZeroAndOne);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -78,8 +78,8 @@ public class UpdatePlaybackStateCommandValidatorTests
|
||||
List<Error> 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<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.IsMutedCannotBeNull);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.IsMutedCannotBeNull);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -107,7 +107,7 @@ public class UpdatePlaybackStateCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.IsMutedCannotBeNull);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.IsMutedCannotBeNull);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+2
-3
@@ -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<UpdateUserSettingsCommand>())
|
||||
.Returns([DomainErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero]);
|
||||
.Returns([ApplicationErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero]);
|
||||
|
||||
// Act
|
||||
Result<Updated> 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<Guid>(), Arg.Any<CancellationToken>());
|
||||
await _mockUserSettingsRepository.DidNotReceive().InsertAsync(Arg.Any<UserSettingsEntity>(), Arg.Any<CancellationToken>());
|
||||
await _mockUserSettingsRepository.DidNotReceive().UpdateAsync(Arg.Any<UserSettingsEntity>(), Arg.Any<CancellationToken>());
|
||||
|
||||
+32
-32
@@ -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<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -49,7 +49,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -62,7 +62,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterOrientationCannotBeNull);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterOrientationCannotBeNull);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -75,7 +75,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterSegmentCountCannotBeNull);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentCountCannotBeNull);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -88,7 +88,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterSegmentGapCannotBeNull);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentGapCannotBeNull);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -101,7 +101,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterMediumThresholdCannotBeNull);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterMediumThresholdCannotBeNull);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -114,7 +114,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterHighThresholdCannotBeNull);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdCannotBeNull);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -127,7 +127,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterShowPeakCannotBeNull);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterShowPeakCannotBeNull);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -140,7 +140,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterPeakHoldDurationCannotBeNull);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakHoldDurationCannotBeNull);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -153,7 +153,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterReleasePerSecondCannotBeNull);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterReleasePerSecondCannotBeNull);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -166,7 +166,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterPeakReleasePerSecondCannotBeNull);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakReleasePerSecondCannotBeNull);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -182,7 +182,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.InvalidVuMeterOrientation);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.InvalidVuMeterOrientation);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -197,7 +197,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.InvalidVuMeterOrientation);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.InvalidVuMeterOrientation);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -214,7 +214,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -230,7 +230,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -246,7 +246,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -262,7 +262,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -280,7 +280,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterMediumThresholdMustBeBetweenZeroAndOne);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterMediumThresholdMustBeBetweenZeroAndOne);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -298,7 +298,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterMediumThresholdMustBeBetweenZeroAndOne);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterMediumThresholdMustBeBetweenZeroAndOne);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -316,7 +316,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -331,7 +331,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -346,7 +346,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -361,7 +361,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -380,7 +380,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -395,7 +395,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterShowPeakCannotBeNull);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterShowPeakCannotBeNull);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -412,7 +412,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -429,7 +429,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -446,7 +446,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -463,7 +463,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -480,7 +480,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldHaveValidationError(Errors.UserSettings.VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred);
|
||||
result.ShouldHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -497,7 +497,7 @@ public class UpdateUserSettingsCommandValidatorTests
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
// Assert
|
||||
result.ShouldNotHaveValidationError(Errors.UserSettings.VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred);
|
||||
result.ShouldNotHaveValidationError(ApplicationErrors.UserSettings.VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -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]
|
||||
|
||||
+1
-2
@@ -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<UpdateSchedulerDisplayPreferencesCommand>(), Arg.Any<CancellationToken>())
|
||||
.Returns(expectedError);
|
||||
|
||||
|
||||
Reference in new issue
Block a user