mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Adds the music library commands and their validators
This commit is contained in:
1 parent
b7db29eee5
commit
1fad9316ce
30 files changed
+700
-256
No files matched your search
+10
-3
@@ -19,22 +19,29 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.
|
||||
/// <param name="ArtistId">The Id of the artist the album belongs to, taken from the route.</param>
|
||||
/// <param name="Metadata">The album metadata of the album.</param>
|
||||
/// <param name="MediaFormat">The physical or digital medium of the album, if applicable.</param>
|
||||
/// <param name="Packaging">The outermost physical packaging of the album, if applicable.</param>
|
||||
/// <param name="Barcode">The barcode of the album, if applicable.</param>
|
||||
/// <param name="CatalogNumber">The catalog number of the album, if applicable.</param>
|
||||
/// <param name="CatalogNumbers">The catalog numbers of the album, if applicable.</param>
|
||||
/// <param name="Label">The name of the label that issued the album, if applicable.</param>
|
||||
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the album, if applicable.</param>
|
||||
/// <param name="MusicBrainzReleaseId">The MusicBrainz identifier of the release, if applicable.</param>
|
||||
/// <param name="MusicBrainzReleaseGroupId">The MusicBrainz identifier of the release group, if applicable.</param>
|
||||
/// <param name="MusicBrainzReleaseArtistId">The MusicBrainz identifier of the release artist, if applicable.</param>
|
||||
/// <param name="Contributors">The list of media contributors that performed on the album.</param>
|
||||
/// <param name="Ratings">The list of ratings for this album.</param>
|
||||
/// <param name="Tracks">The list of tracks of the album.</param>
|
||||
/// <param name="AlbumId">The Id of the album, when the album already exists.</param>
|
||||
[DebuggerDisplay("Title: {Metadata.Title}")]
|
||||
public record AddAlbumCommand(
|
||||
string? LibraryId,
|
||||
string? ArtistId,
|
||||
AlbumMetadataDto? Metadata,
|
||||
MusicAlbumMetadataDto? Metadata,
|
||||
MusicMediaFormat? MediaFormat,
|
||||
MusicReleasePackaging? Packaging,
|
||||
string? Barcode,
|
||||
string? CatalogNumber,
|
||||
List<string>? CatalogNumbers,
|
||||
string? Label,
|
||||
string? ASIN,
|
||||
Guid? MusicBrainzReleaseId,
|
||||
Guid? MusicBrainzReleaseGroupId,
|
||||
Guid? MusicBrainzReleaseArtistId,
|
||||
|
||||
+29
-13
@@ -3,6 +3,7 @@ using Lumina.Application.Common.Infrastructure.Validation;
|
||||
using Lumina.Application.Common.Utilities;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using System;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
@@ -37,7 +38,7 @@ public class AddAlbumCommandValidator : AbstractValidator<AddAlbumCommand>
|
||||
.When(command => command.ArtistId is not null && command.ArtistId.Length > 0)
|
||||
.WithError(Errors.Music.ArtistIdCannotBeEmpty);
|
||||
|
||||
// Validates the metadata of the album: title, lengths, release type and status, disc and track counts, release information, languages, genres and tags.
|
||||
// Validates the metadata of the album: title, lengths, release types and status, disc and track counts, release information, languages, genres and tags.
|
||||
RuleFor(command => command.Metadata)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.MetadataCannotBeNull)
|
||||
@@ -60,9 +61,13 @@ public class AddAlbumCommandValidator : AbstractValidator<AddAlbumCommand>
|
||||
.When(m => m!.Description is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.ReleaseType)
|
||||
metadata.RuleFor(m => m!.Disambiguation)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.Disambiguation is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
metadata.RuleForEach(m => m!.ReleaseTypes)
|
||||
.IsInEnum()
|
||||
.When(m => m!.ReleaseType is not null)
|
||||
.WithError(Errors.Music.UnknownMusicReleaseType);
|
||||
|
||||
metadata.RuleFor(m => m!.ReleaseStatus)
|
||||
@@ -196,15 +201,20 @@ public class AddAlbumCommandValidator : AbstractValidator<AddAlbumCommand>
|
||||
.When(m => m!.OriginalLanguage is not null);
|
||||
});
|
||||
|
||||
// Validates the physical characteristics of the album: format and catalog number.
|
||||
// Validates the physical characteristics of the album: format, packaging, catalog number and barcode.
|
||||
RuleFor(command => command.MediaFormat)
|
||||
.IsInEnum()
|
||||
.When(command => command.MediaFormat is not null)
|
||||
.WithError(Errors.Music.UnknownMusicMediaFormat);
|
||||
|
||||
RuleFor(command => command.CatalogNumber)
|
||||
RuleFor(command => command.Packaging)
|
||||
.IsInEnum()
|
||||
.When(command => command.Packaging is not null)
|
||||
.WithError(Errors.Music.UnknownMusicReleasePackaging);
|
||||
|
||||
RuleForEach(command => command.CatalogNumbers)
|
||||
.MaximumLength(50)
|
||||
.When(command => command.CatalogNumber is not null)
|
||||
.When(command => command.CatalogNumbers is not null)
|
||||
.WithError(Errors.Music.CatalogNumberMustBeMaximum50CharactersLong);
|
||||
|
||||
RuleFor(command => command.Barcode)
|
||||
@@ -313,6 +323,11 @@ public class AddAlbumCommandValidator : AbstractValidator<AddAlbumCommand>
|
||||
.When(m => m!.Description is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
trackMetadata.RuleFor(m => m!.Disambiguation)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.Disambiguation is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
trackMetadata.RuleFor(m => m!.ReleaseInfo)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.ReleaseInfoCannotBeNull)
|
||||
@@ -440,11 +455,6 @@ public class AddAlbumCommandValidator : AbstractValidator<AddAlbumCommand>
|
||||
.When(t => t!.MusicBrainzTrackId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
track.RuleFor(t => t!.MusicBrainzWorkId)
|
||||
.Must(musicBrainzWorkId => musicBrainzWorkId != Guid.Empty)
|
||||
.When(t => t!.MusicBrainzWorkId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
// Validates the ordering and performance characteristics of the track.
|
||||
track.RuleFor(t => t!.TrackNumber)
|
||||
.NotNull()
|
||||
@@ -475,11 +485,17 @@ public class AddAlbumCommandValidator : AbstractValidator<AddAlbumCommand>
|
||||
.When(t => t!.Bpm.HasValue)
|
||||
.WithError(Errors.Music.BpmMustBeGreaterThanZero);
|
||||
|
||||
track.RuleFor(t => t!.Work)
|
||||
// Validates the work the track is a recording of.
|
||||
track.RuleFor(t => t!.Work!.Title)
|
||||
.MaximumLength(255)
|
||||
.When(t => t!.Work is not null)
|
||||
.When(t => t!.Work is not null && t.Work.Title is not null)
|
||||
.WithError(Errors.Music.WorkMustBeMaximum255CharactersLong);
|
||||
|
||||
track.RuleFor(t => t!.Work!.MusicBrainzWorkId)
|
||||
.Must(musicBrainzWorkId => musicBrainzWorkId is null || musicBrainzWorkId != Guid.Empty)
|
||||
.When(t => t!.Work is not null)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
// Validates the media contributors that performed on the track.
|
||||
track.RuleFor(t => t!.Contributors)
|
||||
.NotNull()
|
||||
|
||||
+9
-3
@@ -19,8 +19,11 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.
|
||||
/// <param name="AlbumId">The unique identifier of the album, taken from the route.</param>
|
||||
/// <param name="Metadata">The album metadata of the album.</param>
|
||||
/// <param name="MediaFormat">The physical or digital medium of the album, if applicable.</param>
|
||||
/// <param name="Packaging">The outermost physical packaging of the album, if applicable.</param>
|
||||
/// <param name="Barcode">The barcode of the album, if applicable.</param>
|
||||
/// <param name="CatalogNumber">The catalog number of the album, if applicable.</param>
|
||||
/// <param name="CatalogNumbers">The catalog numbers of the album, if applicable.</param>
|
||||
/// <param name="Label">The name of the label that issued the album, if applicable.</param>
|
||||
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the album, if applicable.</param>
|
||||
/// <param name="MusicBrainzReleaseId">The MusicBrainz identifier of the release, if applicable.</param>
|
||||
/// <param name="MusicBrainzReleaseGroupId">The MusicBrainz identifier of the release group, if applicable.</param>
|
||||
/// <param name="MusicBrainzReleaseArtistId">The MusicBrainz identifier of the release artist, if applicable.</param>
|
||||
@@ -31,10 +34,13 @@ public record UpdateAlbumCommand(
|
||||
string? LibraryId,
|
||||
string? ArtistId,
|
||||
string? AlbumId,
|
||||
AlbumMetadataDto? Metadata,
|
||||
MusicAlbumMetadataDto? Metadata,
|
||||
MusicMediaFormat? MediaFormat,
|
||||
MusicReleasePackaging? Packaging,
|
||||
string? Barcode,
|
||||
string? CatalogNumber,
|
||||
List<string>? CatalogNumbers,
|
||||
string? Label,
|
||||
string? ASIN,
|
||||
Guid? MusicBrainzReleaseId,
|
||||
Guid? MusicBrainzReleaseGroupId,
|
||||
Guid? MusicBrainzReleaseArtistId,
|
||||
|
||||
+15
-6
@@ -47,7 +47,7 @@ public class UpdateAlbumCommandValidator : AbstractValidator<UpdateAlbumCommand>
|
||||
.When(command => command.AlbumId is not null && command.AlbumId.Length > 0)
|
||||
.WithError(Errors.Music.AlbumIdCannotBeEmpty);
|
||||
|
||||
// Validates the metadata of the album: title, lengths, release type and status, disc and track counts, release information, languages, genres and tags.
|
||||
// Validates the metadata of the album: title, lengths, release types and status, disc and track counts, release information, languages, genres and tags.
|
||||
RuleFor(command => command.Metadata)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.MetadataCannotBeNull)
|
||||
@@ -70,9 +70,13 @@ public class UpdateAlbumCommandValidator : AbstractValidator<UpdateAlbumCommand>
|
||||
.When(m => m!.Description is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.ReleaseType)
|
||||
metadata.RuleFor(m => m!.Disambiguation)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.Disambiguation is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
metadata.RuleForEach(m => m!.ReleaseTypes)
|
||||
.IsInEnum()
|
||||
.When(m => m!.ReleaseType is not null)
|
||||
.WithError(Errors.Music.UnknownMusicReleaseType);
|
||||
|
||||
metadata.RuleFor(m => m!.ReleaseStatus)
|
||||
@@ -206,15 +210,20 @@ public class UpdateAlbumCommandValidator : AbstractValidator<UpdateAlbumCommand>
|
||||
.When(m => m!.OriginalLanguage is not null);
|
||||
});
|
||||
|
||||
// Validates the physical characteristics of the album: format and catalog number.
|
||||
// Validates the physical characteristics of the album: format, packaging, catalog number and barcode.
|
||||
RuleFor(command => command.MediaFormat)
|
||||
.IsInEnum()
|
||||
.When(command => command.MediaFormat is not null)
|
||||
.WithError(Errors.Music.UnknownMusicMediaFormat);
|
||||
|
||||
RuleFor(command => command.CatalogNumber)
|
||||
RuleFor(command => command.Packaging)
|
||||
.IsInEnum()
|
||||
.When(command => command.Packaging is not null)
|
||||
.WithError(Errors.Music.UnknownMusicReleasePackaging);
|
||||
|
||||
RuleForEach(command => command.CatalogNumbers)
|
||||
.MaximumLength(50)
|
||||
.When(command => command.CatalogNumber is not null)
|
||||
.When(command => command.CatalogNumbers is not null)
|
||||
.WithError(Errors.Music.CatalogNumberMustBeMaximum50CharactersLong);
|
||||
|
||||
RuleFor(command => command.Barcode)
|
||||
|
||||
+11
-3
@@ -2,6 +2,8 @@
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -13,17 +15,23 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists
|
||||
/// Command for adding an artist, together with the albums of the artist and the tracks of those albums.
|
||||
/// </summary>
|
||||
/// <param name="LibraryId">The unique identifier of the media library this artist belongs to, taken from the route.</param>
|
||||
/// <param name="Name">The name of the artist.</param>
|
||||
/// <param name="Metadata">The metadata of the artist.</param>
|
||||
/// <param name="Website">The website of the artist, if applicable.</param>
|
||||
/// <param name="MusicBrainzArtistId">The MusicBrainz identifier of the artist, if applicable.</param>
|
||||
/// <param name="Ipis">The list of IPI codes of the artist.</param>
|
||||
/// <param name="Isnis">The list of ISNI codes of the artist.</param>
|
||||
/// <param name="Contributors">The list of media contributors that make up the artist.</param>
|
||||
/// <param name="Ratings">The list of ratings for the artist.</param>
|
||||
/// <param name="Albums">The list of albums of the artist, each with its own list of tracks.</param>
|
||||
[DebuggerDisplay("Name: {Name}")]
|
||||
[DebuggerDisplay("Name: {Metadata.Name}")]
|
||||
public record AddArtistCommand(
|
||||
string? LibraryId,
|
||||
string? Name,
|
||||
MusicArtistMetadataDto? Metadata,
|
||||
string? Website,
|
||||
Guid? MusicBrainzArtistId,
|
||||
List<string>? Ipis,
|
||||
List<string>? Isnis,
|
||||
List<MediaContributorReferenceDto>? Contributors,
|
||||
List<AudioRatingDto>? Ratings,
|
||||
List<AddAlbumCommand>? Albums
|
||||
) : ICommand;
|
||||
+171
-18
@@ -28,13 +28,115 @@ public class AddArtistCommandValidator : AbstractValidator<AddArtistCommand>
|
||||
.WithError(Errors.Library.LibraryIdCannotBeEmpty);
|
||||
|
||||
// Validates the identifying details of the artist.
|
||||
RuleFor(command => command.Name)
|
||||
RuleFor(command => command.Metadata)
|
||||
.NotNull()
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.ArtistNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.ArtistNameMustBeMaximum255CharactersLong);
|
||||
.WithError(Errors.Metadata.MetadataCannotBeNull)
|
||||
.ChildRules(metadata =>
|
||||
{
|
||||
metadata.RuleFor(m => m!.Name)
|
||||
.NotNull()
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.ArtistNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.ArtistNameMustBeMaximum255CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.SortName)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.SortName is not null)
|
||||
.WithError(Errors.Music.ArtistNameMustBeMaximum255CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.Disambiguation)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.Disambiguation is not null)
|
||||
.WithError(Errors.Music.ArtistNameMustBeMaximum255CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.Type)
|
||||
.IsInEnum()
|
||||
.When(m => m!.Type is not null)
|
||||
.WithError(Errors.Music.UnknownMusicArtistType);
|
||||
|
||||
metadata.RuleFor(m => m!.Gender)
|
||||
.IsInEnum()
|
||||
.When(m => m!.Gender is not null)
|
||||
.WithError(Errors.Music.UnknownMusicArtistGender);
|
||||
|
||||
metadata.RuleFor(m => m!.Country)
|
||||
.Length(2)
|
||||
.When(m => m!.Country is not null)
|
||||
.WithError(Errors.Music.CountryMustBeMaximum2CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.Area!.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.AreaNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.AreaNameMustBeMaximum255CharactersLong)
|
||||
.When(m => m!.Area is not null);
|
||||
|
||||
metadata.RuleFor(m => m!.BeginArea!.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.AreaNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.AreaNameMustBeMaximum255CharactersLong)
|
||||
.When(m => m!.BeginArea is not null);
|
||||
|
||||
metadata.RuleFor(m => m!.EndArea!.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.AreaNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.AreaNameMustBeMaximum255CharactersLong)
|
||||
.When(m => m!.EndArea is not null);
|
||||
|
||||
metadata.RuleForEach(m => m!.Aliases)
|
||||
.ChildRules(alias =>
|
||||
{
|
||||
alias.RuleFor(a => a.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.ArtistAliasNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.ArtistAliasNameMustBeMaximum255CharactersLong);
|
||||
|
||||
alias.RuleFor(a => a.SortName)
|
||||
.MaximumLength(255)
|
||||
.When(a => a.SortName is not null)
|
||||
.WithError(Errors.Music.ArtistAliasNameMustBeMaximum255CharactersLong);
|
||||
|
||||
alias.RuleFor(a => a.Type)
|
||||
.MaximumLength(50)
|
||||
.When(a => a.Type is not null)
|
||||
.WithError(Errors.Music.ScriptMustBeMaximum50CharactersLong);
|
||||
|
||||
alias.RuleFor(a => a.Locale)
|
||||
.MaximumLength(20)
|
||||
.When(a => a.Locale is not null)
|
||||
.WithError(Errors.Music.ScriptMustBeMaximum50CharactersLong);
|
||||
});
|
||||
|
||||
metadata.RuleFor(m => m!.Genres)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.GenresListCannotBeNull);
|
||||
|
||||
metadata.RuleForEach(m => m!.Genres)
|
||||
.ChildRules(genre =>
|
||||
genre.RuleFor(g => g.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Metadata.GenreNameCannotBeEmpty)
|
||||
.MaximumLength(50)
|
||||
.WithError(Errors.Metadata.GenreNameMustBeMaximum50CharactersLong));
|
||||
|
||||
metadata.RuleFor(m => m!.Tags)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.TagsListCannotBeNull);
|
||||
|
||||
metadata.RuleForEach(m => m!.Tags)
|
||||
.ChildRules(tag =>
|
||||
tag.RuleFor(t => t.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Metadata.TagNameCannotBeEmpty)
|
||||
.MaximumLength(50)
|
||||
.WithError(Errors.Metadata.TagNameMustBeMaximum50CharactersLong));
|
||||
});
|
||||
|
||||
// Validates the website and the MusicBrainz identifiers of the artist.
|
||||
RuleFor(command => command.Website)
|
||||
.MaximumLength(2048)
|
||||
.When(command => command.Website is not null)
|
||||
@@ -45,6 +147,18 @@ public class AddArtistCommandValidator : AbstractValidator<AddArtistCommand>
|
||||
.When(command => command.MusicBrainzArtistId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
RuleForEach(command => command.Ipis)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.IpiValueCannotBeEmpty)
|
||||
.MaximumLength(20)
|
||||
.WithError(Errors.Music.IpiValueMustBeMaximum20CharactersLong);
|
||||
|
||||
RuleForEach(command => command.Isnis)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.IsniValueCannotBeEmpty)
|
||||
.MaximumLength(20)
|
||||
.WithError(Errors.Music.IsniValueMustBeMaximum20CharactersLong);
|
||||
|
||||
// Validates the media contributors that make up the artist.
|
||||
RuleFor(command => command.Contributors)
|
||||
.NotNull()
|
||||
@@ -64,6 +178,30 @@ public class AddArtistCommandValidator : AbstractValidator<AddArtistCommand>
|
||||
.WithError(Errors.MediaContributor.UnknownMediaContributorRole);
|
||||
});
|
||||
|
||||
// Validates the ratings of the artist.
|
||||
RuleFor(command => command.Ratings)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.RatingsListCannotBeNull);
|
||||
|
||||
RuleForEach(command => command.Ratings)
|
||||
.ChildRules(rating =>
|
||||
{
|
||||
rating.RuleFor(r => r.Value)
|
||||
.GreaterThan(0)
|
||||
.WithError(Errors.Metadata.RatingValueMustBePositive)
|
||||
.Must((ratingInstance, value) => value <= ratingInstance.MaxValue)
|
||||
.WithError(Errors.Metadata.RatingValueCannotBeGreaterThanMaxValue);
|
||||
|
||||
rating.RuleFor(r => r.MaxValue)
|
||||
.GreaterThan(0)
|
||||
.WithError(Errors.Metadata.RatingMaxValueMustBePositive);
|
||||
|
||||
rating.RuleFor(r => r.VoteCount)
|
||||
.GreaterThanOrEqualTo(0)
|
||||
.When(r => r.VoteCount.HasValue)
|
||||
.WithError(Errors.Metadata.RatingVoteCountMustBePositive);
|
||||
});
|
||||
|
||||
// Validates each album created together with the artist, when the request carries albums.
|
||||
RuleFor(command => command.Albums)
|
||||
.NotNull()
|
||||
@@ -72,7 +210,7 @@ public class AddArtistCommandValidator : AbstractValidator<AddArtistCommand>
|
||||
RuleForEach(command => command.Albums)
|
||||
.ChildRules(album =>
|
||||
{
|
||||
// Validates the metadata of the album: title, lengths, release type and status, and disc and track counts.
|
||||
// Validates the metadata of the album: title, lengths, release types and status, and disc and track counts.
|
||||
album.RuleFor(a => a!.Metadata)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.MetadataCannotBeNull)
|
||||
@@ -95,9 +233,13 @@ public class AddArtistCommandValidator : AbstractValidator<AddArtistCommand>
|
||||
.When(m => m!.Description is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.ReleaseType)
|
||||
metadata.RuleFor(m => m!.Disambiguation)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.Disambiguation is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
metadata.RuleForEach(m => m!.ReleaseTypes)
|
||||
.IsInEnum()
|
||||
.When(m => m!.ReleaseType is not null)
|
||||
.WithError(Errors.Music.UnknownMusicReleaseType);
|
||||
|
||||
metadata.RuleFor(m => m!.ReleaseStatus)
|
||||
@@ -231,15 +373,20 @@ public class AddArtistCommandValidator : AbstractValidator<AddArtistCommand>
|
||||
.When(m => m!.OriginalLanguage is not null);
|
||||
});
|
||||
|
||||
// Validates the physical characteristics of the album: format and catalog number.
|
||||
// Validates the physical characteristics of the album: format, packaging, catalog number and barcode.
|
||||
album.RuleFor(a => a!.MediaFormat)
|
||||
.IsInEnum()
|
||||
.When(a => a!.MediaFormat is not null)
|
||||
.WithError(Errors.Music.UnknownMusicMediaFormat);
|
||||
|
||||
album.RuleFor(a => a!.CatalogNumber)
|
||||
album.RuleFor(a => a!.Packaging)
|
||||
.IsInEnum()
|
||||
.When(a => a!.Packaging is not null)
|
||||
.WithError(Errors.Music.UnknownMusicReleasePackaging);
|
||||
|
||||
album.RuleForEach(a => a!.CatalogNumbers)
|
||||
.MaximumLength(50)
|
||||
.When(a => a!.CatalogNumber is not null)
|
||||
.When(a => a!.CatalogNumbers is not null)
|
||||
.WithError(Errors.Music.CatalogNumberMustBeMaximum50CharactersLong);
|
||||
|
||||
album.RuleFor(a => a!.Barcode)
|
||||
@@ -349,6 +496,11 @@ public class AddArtistCommandValidator : AbstractValidator<AddArtistCommand>
|
||||
.When(m => m!.Description is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
trackMetadata.RuleFor(m => m!.Disambiguation)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.Disambiguation is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
trackMetadata.RuleFor(m => m!.ReleaseInfo)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.ReleaseInfoCannotBeNull)
|
||||
@@ -476,11 +628,6 @@ public class AddArtistCommandValidator : AbstractValidator<AddArtistCommand>
|
||||
.When(t => t!.MusicBrainzTrackId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
track.RuleFor(t => t!.MusicBrainzWorkId)
|
||||
.Must(musicBrainzWorkId => musicBrainzWorkId != Guid.Empty)
|
||||
.When(t => t!.MusicBrainzWorkId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
// Validates the ordering and performance characteristics of the track.
|
||||
track.RuleFor(t => t!.TrackNumber)
|
||||
.NotNull()
|
||||
@@ -511,11 +658,17 @@ public class AddArtistCommandValidator : AbstractValidator<AddArtistCommand>
|
||||
.When(t => t!.Bpm.HasValue)
|
||||
.WithError(Errors.Music.BpmMustBeGreaterThanZero);
|
||||
|
||||
track.RuleFor(t => t!.Work)
|
||||
// Validates the work the track is a recording of.
|
||||
track.RuleFor(t => t!.Work!.Title)
|
||||
.MaximumLength(255)
|
||||
.When(t => t!.Work is not null)
|
||||
.When(t => t!.Work is not null && t.Work.Title is not null)
|
||||
.WithError(Errors.Music.WorkMustBeMaximum255CharactersLong);
|
||||
|
||||
track.RuleFor(t => t!.Work!.MusicBrainzWorkId)
|
||||
.Must(musicBrainzWorkId => musicBrainzWorkId is null || musicBrainzWorkId != Guid.Empty)
|
||||
.When(t => t!.Work is not null)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
// Validates the moods and the ISRC codes of the track.
|
||||
track.RuleForEach(t => t!.Moods)
|
||||
.ChildRules(mood =>
|
||||
|
||||
+11
-3
@@ -2,6 +2,8 @@
|
||||
using Lumina.Application.Common.CQRS;
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -14,18 +16,24 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists
|
||||
/// </summary>
|
||||
/// <param name="LibraryId">The unique identifier of the media library this artist belongs to, taken from the route.</param>
|
||||
/// <param name="ArtistId">The unique identifier of the artist, taken from the route.</param>
|
||||
/// <param name="Name">The name of the artist.</param>
|
||||
/// <param name="Metadata">The metadata of the artist.</param>
|
||||
/// <param name="Website">The website of the artist, if applicable.</param>
|
||||
/// <param name="MusicBrainzArtistId">The MusicBrainz identifier of the artist, if applicable.</param>
|
||||
/// <param name="Ipis">The list of IPI codes of the artist.</param>
|
||||
/// <param name="Isnis">The list of ISNI codes of the artist.</param>
|
||||
/// <param name="Contributors">The list of media contributors that make up the artist.</param>
|
||||
/// <param name="Ratings">The list of ratings for the artist.</param>
|
||||
/// <param name="Albums">The list of albums of the artist, each with its own list of tracks.</param>
|
||||
[DebuggerDisplay("Name: {Name}")]
|
||||
[DebuggerDisplay("Name: {Metadata.Name}")]
|
||||
public record UpdateArtistCommand(
|
||||
string? LibraryId,
|
||||
string? ArtistId,
|
||||
string? Name,
|
||||
MusicArtistMetadataDto? Metadata,
|
||||
string? Website,
|
||||
Guid? MusicBrainzArtistId,
|
||||
List<string>? Ipis,
|
||||
List<string>? Isnis,
|
||||
List<MediaContributorReferenceDto>? Contributors,
|
||||
List<AudioRatingDto>? Ratings,
|
||||
List<AddAlbumCommand>? Albums
|
||||
) : ICommand;
|
||||
+173
-20
@@ -17,7 +17,7 @@ public class UpdateArtistCommandValidator : AbstractValidator<UpdateArtistComman
|
||||
/// </summary>
|
||||
public UpdateArtistCommandValidator()
|
||||
{
|
||||
// Validates the identifier of the media library that owns the artist, taken from the route.
|
||||
// Validates the identifier of the media library that will own the artist, taken from the route.
|
||||
RuleFor(command => command.LibraryId)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Library.LibraryIdCannotBeEmpty);
|
||||
@@ -38,13 +38,115 @@ public class UpdateArtistCommandValidator : AbstractValidator<UpdateArtistComman
|
||||
.WithError(Errors.Music.ArtistIdCannotBeEmpty);
|
||||
|
||||
// Validates the identifying details of the artist.
|
||||
RuleFor(command => command.Name)
|
||||
RuleFor(command => command.Metadata)
|
||||
.NotNull()
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.ArtistNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.ArtistNameMustBeMaximum255CharactersLong);
|
||||
.WithError(Errors.Metadata.MetadataCannotBeNull)
|
||||
.ChildRules(metadata =>
|
||||
{
|
||||
metadata.RuleFor(m => m!.Name)
|
||||
.NotNull()
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.ArtistNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.ArtistNameMustBeMaximum255CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.SortName)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.SortName is not null)
|
||||
.WithError(Errors.Music.ArtistNameMustBeMaximum255CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.Disambiguation)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.Disambiguation is not null)
|
||||
.WithError(Errors.Music.ArtistNameMustBeMaximum255CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.Type)
|
||||
.IsInEnum()
|
||||
.When(m => m!.Type is not null)
|
||||
.WithError(Errors.Music.UnknownMusicArtistType);
|
||||
|
||||
metadata.RuleFor(m => m!.Gender)
|
||||
.IsInEnum()
|
||||
.When(m => m!.Gender is not null)
|
||||
.WithError(Errors.Music.UnknownMusicArtistGender);
|
||||
|
||||
metadata.RuleFor(m => m!.Country)
|
||||
.Length(2)
|
||||
.When(m => m!.Country is not null)
|
||||
.WithError(Errors.Music.CountryMustBeMaximum2CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.Area!.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.AreaNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.AreaNameMustBeMaximum255CharactersLong)
|
||||
.When(m => m!.Area is not null);
|
||||
|
||||
metadata.RuleFor(m => m!.BeginArea!.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.AreaNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.AreaNameMustBeMaximum255CharactersLong)
|
||||
.When(m => m!.BeginArea is not null);
|
||||
|
||||
metadata.RuleFor(m => m!.EndArea!.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.AreaNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.AreaNameMustBeMaximum255CharactersLong)
|
||||
.When(m => m!.EndArea is not null);
|
||||
|
||||
metadata.RuleForEach(m => m!.Aliases)
|
||||
.ChildRules(alias =>
|
||||
{
|
||||
alias.RuleFor(a => a.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.ArtistAliasNameCannotBeEmpty)
|
||||
.MaximumLength(255)
|
||||
.WithError(Errors.Music.ArtistAliasNameMustBeMaximum255CharactersLong);
|
||||
|
||||
alias.RuleFor(a => a.SortName)
|
||||
.MaximumLength(255)
|
||||
.When(a => a.SortName is not null)
|
||||
.WithError(Errors.Music.ArtistAliasNameMustBeMaximum255CharactersLong);
|
||||
|
||||
alias.RuleFor(a => a.Type)
|
||||
.MaximumLength(50)
|
||||
.When(a => a.Type is not null)
|
||||
.WithError(Errors.Music.ScriptMustBeMaximum50CharactersLong);
|
||||
|
||||
alias.RuleFor(a => a.Locale)
|
||||
.MaximumLength(20)
|
||||
.When(a => a.Locale is not null)
|
||||
.WithError(Errors.Music.ScriptMustBeMaximum50CharactersLong);
|
||||
});
|
||||
|
||||
metadata.RuleFor(m => m!.Genres)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.GenresListCannotBeNull);
|
||||
|
||||
metadata.RuleForEach(m => m!.Genres)
|
||||
.ChildRules(genre =>
|
||||
genre.RuleFor(g => g.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Metadata.GenreNameCannotBeEmpty)
|
||||
.MaximumLength(50)
|
||||
.WithError(Errors.Metadata.GenreNameMustBeMaximum50CharactersLong));
|
||||
|
||||
metadata.RuleFor(m => m!.Tags)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.TagsListCannotBeNull);
|
||||
|
||||
metadata.RuleForEach(m => m!.Tags)
|
||||
.ChildRules(tag =>
|
||||
tag.RuleFor(t => t.Name)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Metadata.TagNameCannotBeEmpty)
|
||||
.MaximumLength(50)
|
||||
.WithError(Errors.Metadata.TagNameMustBeMaximum50CharactersLong));
|
||||
});
|
||||
|
||||
// Validates the website and the MusicBrainz identifiers of the artist.
|
||||
RuleFor(command => command.Website)
|
||||
.MaximumLength(2048)
|
||||
.When(command => command.Website is not null)
|
||||
@@ -55,6 +157,18 @@ public class UpdateArtistCommandValidator : AbstractValidator<UpdateArtistComman
|
||||
.When(command => command.MusicBrainzArtistId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
RuleForEach(command => command.Ipis)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.IpiValueCannotBeEmpty)
|
||||
.MaximumLength(20)
|
||||
.WithError(Errors.Music.IpiValueMustBeMaximum20CharactersLong);
|
||||
|
||||
RuleForEach(command => command.Isnis)
|
||||
.NotEmpty()
|
||||
.WithError(Errors.Music.IsniValueCannotBeEmpty)
|
||||
.MaximumLength(20)
|
||||
.WithError(Errors.Music.IsniValueMustBeMaximum20CharactersLong);
|
||||
|
||||
// Validates the media contributors that make up the artist.
|
||||
RuleFor(command => command.Contributors)
|
||||
.NotNull()
|
||||
@@ -74,7 +188,31 @@ public class UpdateArtistCommandValidator : AbstractValidator<UpdateArtistComman
|
||||
.WithError(Errors.MediaContributor.UnknownMediaContributorRole);
|
||||
});
|
||||
|
||||
// Validates each album updated together with the artist, when the request carries albums.
|
||||
// Validates the ratings of the artist.
|
||||
RuleFor(command => command.Ratings)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.RatingsListCannotBeNull);
|
||||
|
||||
RuleForEach(command => command.Ratings)
|
||||
.ChildRules(rating =>
|
||||
{
|
||||
rating.RuleFor(r => r.Value)
|
||||
.GreaterThan(0)
|
||||
.WithError(Errors.Metadata.RatingValueMustBePositive)
|
||||
.Must((ratingInstance, value) => value <= ratingInstance.MaxValue)
|
||||
.WithError(Errors.Metadata.RatingValueCannotBeGreaterThanMaxValue);
|
||||
|
||||
rating.RuleFor(r => r.MaxValue)
|
||||
.GreaterThan(0)
|
||||
.WithError(Errors.Metadata.RatingMaxValueMustBePositive);
|
||||
|
||||
rating.RuleFor(r => r.VoteCount)
|
||||
.GreaterThanOrEqualTo(0)
|
||||
.When(r => r.VoteCount.HasValue)
|
||||
.WithError(Errors.Metadata.RatingVoteCountMustBePositive);
|
||||
});
|
||||
|
||||
// Validates each album created together with the artist, when the request carries albums.
|
||||
RuleFor(command => command.Albums)
|
||||
.NotNull()
|
||||
.WithError(Errors.Music.AlbumsListCannotBeNull);
|
||||
@@ -88,7 +226,7 @@ public class UpdateArtistCommandValidator : AbstractValidator<UpdateArtistComman
|
||||
.When(a => a!.AlbumId.HasValue)
|
||||
.WithError(Errors.Music.AlbumIdCannotBeEmpty);
|
||||
|
||||
// Validates the metadata of the album: title, lengths, release type and status, and disc and track counts.
|
||||
// Validates the metadata of the album: title, lengths, release types and status, and disc and track counts.
|
||||
album.RuleFor(a => a!.Metadata)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.MetadataCannotBeNull)
|
||||
@@ -111,9 +249,13 @@ public class UpdateArtistCommandValidator : AbstractValidator<UpdateArtistComman
|
||||
.When(m => m!.Description is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
metadata.RuleFor(m => m!.ReleaseType)
|
||||
metadata.RuleFor(m => m!.Disambiguation)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.Disambiguation is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
metadata.RuleForEach(m => m!.ReleaseTypes)
|
||||
.IsInEnum()
|
||||
.When(m => m!.ReleaseType is not null)
|
||||
.WithError(Errors.Music.UnknownMusicReleaseType);
|
||||
|
||||
metadata.RuleFor(m => m!.ReleaseStatus)
|
||||
@@ -247,15 +389,20 @@ public class UpdateArtistCommandValidator : AbstractValidator<UpdateArtistComman
|
||||
.When(m => m!.OriginalLanguage is not null);
|
||||
});
|
||||
|
||||
// Validates the physical characteristics of the album: format and catalog number.
|
||||
// Validates the physical characteristics of the album: format, packaging, catalog number and barcode.
|
||||
album.RuleFor(a => a!.MediaFormat)
|
||||
.IsInEnum()
|
||||
.When(a => a!.MediaFormat is not null)
|
||||
.WithError(Errors.Music.UnknownMusicMediaFormat);
|
||||
|
||||
album.RuleFor(a => a!.CatalogNumber)
|
||||
album.RuleFor(a => a!.Packaging)
|
||||
.IsInEnum()
|
||||
.When(a => a!.Packaging is not null)
|
||||
.WithError(Errors.Music.UnknownMusicReleasePackaging);
|
||||
|
||||
album.RuleForEach(a => a!.CatalogNumbers)
|
||||
.MaximumLength(50)
|
||||
.When(a => a!.CatalogNumber is not null)
|
||||
.When(a => a!.CatalogNumbers is not null)
|
||||
.WithError(Errors.Music.CatalogNumberMustBeMaximum50CharactersLong);
|
||||
|
||||
album.RuleFor(a => a!.Barcode)
|
||||
@@ -371,6 +518,11 @@ public class UpdateArtistCommandValidator : AbstractValidator<UpdateArtistComman
|
||||
.When(m => m!.Description is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
trackMetadata.RuleFor(m => m!.Disambiguation)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.Disambiguation is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
trackMetadata.RuleFor(m => m!.ReleaseInfo)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.ReleaseInfoCannotBeNull)
|
||||
@@ -498,11 +650,6 @@ public class UpdateArtistCommandValidator : AbstractValidator<UpdateArtistComman
|
||||
.When(t => t!.MusicBrainzTrackId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
track.RuleFor(t => t!.MusicBrainzWorkId)
|
||||
.Must(musicBrainzWorkId => musicBrainzWorkId != Guid.Empty)
|
||||
.When(t => t!.MusicBrainzWorkId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
// Validates the ordering and performance characteristics of the track.
|
||||
track.RuleFor(t => t!.TrackNumber)
|
||||
.NotNull()
|
||||
@@ -533,11 +680,17 @@ public class UpdateArtistCommandValidator : AbstractValidator<UpdateArtistComman
|
||||
.When(t => t!.Bpm.HasValue)
|
||||
.WithError(Errors.Music.BpmMustBeGreaterThanZero);
|
||||
|
||||
track.RuleFor(t => t!.Work)
|
||||
// Validates the work the track is a recording of.
|
||||
track.RuleFor(t => t!.Work!.Title)
|
||||
.MaximumLength(255)
|
||||
.When(t => t!.Work is not null)
|
||||
.When(t => t!.Work is not null && t.Work.Title is not null)
|
||||
.WithError(Errors.Music.WorkMustBeMaximum255CharactersLong);
|
||||
|
||||
track.RuleFor(t => t!.Work!.MusicBrainzWorkId)
|
||||
.Must(musicBrainzWorkId => musicBrainzWorkId is null || musicBrainzWorkId != Guid.Empty)
|
||||
.When(t => t!.Work is not null)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
// Validates the moods and the ISRC codes of the track.
|
||||
track.RuleForEach(t => t!.Moods)
|
||||
.ChildRules(mood =>
|
||||
|
||||
+4
-5
@@ -25,30 +25,29 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.
|
||||
/// <param name="Script">The script used by the language of the track, if applicable.</param>
|
||||
/// <param name="Key">The musical key of the track, if applicable.</param>
|
||||
/// <param name="Bpm">The tempo of the track in beats per minute, if applicable.</param>
|
||||
/// <param name="Work">The title of the work the track is a recording of, if applicable.</param>
|
||||
/// <param name="Work">The work the track is a recording of, if applicable.</param>
|
||||
/// <param name="MusicBrainzRecordingId">The MusicBrainz identifier of the recording, if applicable.</param>
|
||||
/// <param name="MusicBrainzTrackId">The MusicBrainz identifier of the track, if applicable.</param>
|
||||
/// <param name="MusicBrainzWorkId">The MusicBrainz identifier of the work, if applicable.</param>
|
||||
/// <param name="Moods">The list of moods of the track.</param>
|
||||
/// <param name="Isrcs">The list of ISRC of the track.</param>
|
||||
/// <param name="Contributors">The list of media contributors that performed on the track.</param>
|
||||
/// <param name="Ratings">The list of ratings for this track.</param>
|
||||
/// <param name="TrackId">The Id of the track, when the track already exists.</param>
|
||||
[DebuggerDisplay("Title: {Metadata.Title}")]
|
||||
public record AddTrackCommand(
|
||||
string? LibraryId,
|
||||
string? ArtistId,
|
||||
string? AlbumId,
|
||||
string? Path,
|
||||
AudioMetadataDto? Metadata,
|
||||
MusicTrackMetadataDto? Metadata,
|
||||
int? TrackNumber,
|
||||
int? DiscNumber,
|
||||
string? Script,
|
||||
MusicKey? Key,
|
||||
int? Bpm,
|
||||
string? Work,
|
||||
MusicWorkDto? Work,
|
||||
Guid? MusicBrainzRecordingId,
|
||||
Guid? MusicBrainzTrackId,
|
||||
Guid? MusicBrainzWorkId,
|
||||
List<MoodDto>? Moods,
|
||||
List<IsrcDto>? Isrcs,
|
||||
List<MediaContributorReferenceDto>? Contributors,
|
||||
|
||||
+13
-7
@@ -76,6 +76,11 @@ public class AddTrackCommandValidator : AbstractValidator<AddTrackCommand>
|
||||
.When(m => m!.Description is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
trackMetadata.RuleFor(m => m!.Disambiguation)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.Disambiguation is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
trackMetadata.RuleFor(m => m!.ReleaseInfo)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.ReleaseInfoCannotBeNull)
|
||||
@@ -203,11 +208,6 @@ public class AddTrackCommandValidator : AbstractValidator<AddTrackCommand>
|
||||
.When(command => command.MusicBrainzTrackId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
RuleFor(command => command.MusicBrainzWorkId)
|
||||
.Must(musicBrainzWorkId => musicBrainzWorkId != Guid.Empty)
|
||||
.When(command => command.MusicBrainzWorkId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
// Validates the ordering and performance characteristics of the track.
|
||||
RuleFor(command => command.TrackNumber)
|
||||
.NotNull()
|
||||
@@ -238,11 +238,17 @@ public class AddTrackCommandValidator : AbstractValidator<AddTrackCommand>
|
||||
.When(command => command.Bpm.HasValue)
|
||||
.WithError(Errors.Music.BpmMustBeGreaterThanZero);
|
||||
|
||||
RuleFor(command => command.Work)
|
||||
// Validates the work the track is a recording of.
|
||||
RuleFor(command => command.Work!.Title)
|
||||
.MaximumLength(255)
|
||||
.When(command => command.Work is not null)
|
||||
.When(command => command.Work is not null && command.Work.Title is not null)
|
||||
.WithError(Errors.Music.WorkMustBeMaximum255CharactersLong);
|
||||
|
||||
RuleFor(command => command.Work!.MusicBrainzWorkId)
|
||||
.Must(musicBrainzWorkId => musicBrainzWorkId is null || musicBrainzWorkId != Guid.Empty)
|
||||
.When(command => command.Work is not null)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
// Validates the moods and the ISRC codes of the track.
|
||||
RuleForEach(command => command.Moods)
|
||||
.ChildRules(mood =>
|
||||
|
||||
+3
-5
@@ -26,10 +26,9 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.
|
||||
/// <param name="Script">The script used by the language of the track, if applicable.</param>
|
||||
/// <param name="Key">The musical key of the track, if applicable.</param>
|
||||
/// <param name="Bpm">The tempo of the track in beats per minute, if applicable.</param>
|
||||
/// <param name="Work">The title of the work the track is a recording of, if applicable.</param>
|
||||
/// <param name="Work">The work the track is a recording of, if applicable.</param>
|
||||
/// <param name="MusicBrainzRecordingId">The MusicBrainz identifier of the recording, if applicable.</param>
|
||||
/// <param name="MusicBrainzTrackId">The MusicBrainz identifier of the track, if applicable.</param>
|
||||
/// <param name="MusicBrainzWorkId">The MusicBrainz identifier of the work, if applicable.</param>
|
||||
/// <param name="Moods">The list of moods of the track.</param>
|
||||
/// <param name="Isrcs">The list of ISRC of the track.</param>
|
||||
/// <param name="Contributors">The list of media contributors that performed on the track.</param>
|
||||
@@ -41,16 +40,15 @@ public record UpdateTrackCommand(
|
||||
string? AlbumId,
|
||||
string? TrackId,
|
||||
string? Path,
|
||||
AudioMetadataDto? Metadata,
|
||||
MusicTrackMetadataDto? Metadata,
|
||||
int? TrackNumber,
|
||||
int? DiscNumber,
|
||||
string? Script,
|
||||
MusicKey? Key,
|
||||
int? Bpm,
|
||||
string? Work,
|
||||
MusicWorkDto? Work,
|
||||
Guid? MusicBrainzRecordingId,
|
||||
Guid? MusicBrainzTrackId,
|
||||
Guid? MusicBrainzWorkId,
|
||||
List<MoodDto>? Moods,
|
||||
List<IsrcDto>? Isrcs,
|
||||
List<MediaContributorReferenceDto>? Contributors,
|
||||
|
||||
+13
-7
@@ -86,6 +86,11 @@ public class UpdateTrackCommandValidator : AbstractValidator<UpdateTrackCommand>
|
||||
.When(m => m!.Description is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
trackMetadata.RuleFor(m => m!.Disambiguation)
|
||||
.MaximumLength(255)
|
||||
.When(m => m!.Disambiguation is not null)
|
||||
.WithError(Errors.Metadata.DescriptionMustBeMaximum2000CharactersLong);
|
||||
|
||||
trackMetadata.RuleFor(m => m!.ReleaseInfo)
|
||||
.NotNull()
|
||||
.WithError(Errors.Metadata.ReleaseInfoCannotBeNull)
|
||||
@@ -213,11 +218,6 @@ public class UpdateTrackCommandValidator : AbstractValidator<UpdateTrackCommand>
|
||||
.When(command => command.MusicBrainzTrackId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
RuleFor(command => command.MusicBrainzWorkId)
|
||||
.Must(musicBrainzWorkId => musicBrainzWorkId != Guid.Empty)
|
||||
.When(command => command.MusicBrainzWorkId.HasValue)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
// Validates the ordering and performance characteristics of the track.
|
||||
RuleFor(command => command.TrackNumber)
|
||||
.NotNull()
|
||||
@@ -248,11 +248,17 @@ public class UpdateTrackCommandValidator : AbstractValidator<UpdateTrackCommand>
|
||||
.When(command => command.Bpm.HasValue)
|
||||
.WithError(Errors.Music.BpmMustBeGreaterThanZero);
|
||||
|
||||
RuleFor(command => command.Work)
|
||||
// Validates the work the track is a recording of.
|
||||
RuleFor(command => command.Work!.Title)
|
||||
.MaximumLength(255)
|
||||
.When(command => command.Work is not null)
|
||||
.When(command => command.Work is not null && command.Work.Title is not null)
|
||||
.WithError(Errors.Music.WorkMustBeMaximum255CharactersLong);
|
||||
|
||||
RuleFor(command => command.Work!.MusicBrainzWorkId)
|
||||
.Must(musicBrainzWorkId => musicBrainzWorkId is null || musicBrainzWorkId != Guid.Empty)
|
||||
.When(command => command.Work is not null)
|
||||
.WithError(Errors.Music.MusicBrainzIdInvalidFormat);
|
||||
|
||||
// Validates the moods and the ISRC codes of the track.
|
||||
RuleForEach(command => command.Moods)
|
||||
.ChildRules(mood =>
|
||||
|
||||
+22
-7
@@ -25,7 +25,7 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class AddAlbumCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
private readonly AddTrackCommandFixture _addTrackCommandFixture = new();
|
||||
@@ -37,8 +37,11 @@ public class AddAlbumCommandFixture
|
||||
/// <param name="artistId">Optional. The Id of the artist the album belongs to, taken from the route.</param>
|
||||
/// <param name="metadata">Optional. The album metadata of the album.</param>
|
||||
/// <param name="mediaFormat">Optional. The physical or digital medium of the album.</param>
|
||||
/// <param name="packaging">Optional. The outermost physical packaging of the album.</param>
|
||||
/// <param name="barcode">Optional. The barcode of the album.</param>
|
||||
/// <param name="catalogNumber">Optional. The catalog number of the album.</param>
|
||||
/// <param name="label">Optional. The name of the label that issued the album.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the album.</param>
|
||||
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release.</param>
|
||||
/// <param name="musicBrainzReleaseGroupId">Optional. The MusicBrainz identifier of the release group.</param>
|
||||
/// <param name="musicBrainzReleaseArtistId">Optional. The MusicBrainz identifier of the release artist.</param>
|
||||
@@ -50,8 +53,11 @@ public class AddAlbumCommandFixture
|
||||
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaFormat">Whether the media format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePackaging">Whether the packaging should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarcode">Whether the barcode should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCatalogNumber">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCatalogNumbers">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLabel">Whether the label should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseId">Whether the MusicBrainz release Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseGroupId">Whether the MusicBrainz release group Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseArtistId">Whether the MusicBrainz release artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -63,10 +69,13 @@ public class AddAlbumCommandFixture
|
||||
public AddAlbumCommand Create(
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
AlbumMetadataDto? metadata = null,
|
||||
MusicAlbumMetadataDto? metadata = null,
|
||||
MusicMediaFormat? mediaFormat = null,
|
||||
MusicReleasePackaging? packaging = null,
|
||||
string? barcode = null,
|
||||
string? catalogNumber = null,
|
||||
List<string>? catalogNumbers = null,
|
||||
string? label = null,
|
||||
string? asin = null,
|
||||
Guid? musicBrainzReleaseId = null,
|
||||
Guid? musicBrainzReleaseGroupId = null,
|
||||
Guid? musicBrainzReleaseArtistId = null,
|
||||
@@ -78,8 +87,11 @@ public class AddAlbumCommandFixture
|
||||
bool includeArtistId = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeMediaFormat = true,
|
||||
bool includePackaging = true,
|
||||
bool includeBarcode = true,
|
||||
bool includeCatalogNumber = true,
|
||||
bool includeCatalogNumbers = true,
|
||||
bool includeLabel = true,
|
||||
bool includeAsin = true,
|
||||
bool includeMusicBrainzReleaseId = true,
|
||||
bool includeMusicBrainzReleaseGroupId = true,
|
||||
bool includeMusicBrainzReleaseArtistId = true,
|
||||
@@ -94,10 +106,13 @@ public class AddAlbumCommandFixture
|
||||
return new AddAlbumCommand(
|
||||
resolvedLibraryId,
|
||||
resolvedArtistId,
|
||||
includeMetadata ? (metadata ?? _albumMetadataDtoFixture.Create()) : null,
|
||||
includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
|
||||
includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
|
||||
includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
|
||||
includeBarcode ? (barcode ?? _faker.Random.String2(_faker.Random.Int(12, 13), "0123456789")) : null,
|
||||
includeCatalogNumber ? (catalogNumber ?? _faker.Random.AlphaNumeric(_faker.Random.Int(1, 50))) : null,
|
||||
includeCatalogNumbers ? (catalogNumbers ?? [_faker.Random.AlphaNumeric(_faker.Random.Int(1, 50))]) : null,
|
||||
includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
|
||||
includeAsin ? (asin ?? _faker.Random.AlphaNumeric(10)) : null,
|
||||
includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
|
||||
|
||||
+22
-7
@@ -23,7 +23,7 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class UpdateAlbumCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
@@ -35,8 +35,11 @@ public class UpdateAlbumCommandFixture
|
||||
/// <param name="albumId">Optional. The Id of the album to update, taken from the route.</param>
|
||||
/// <param name="metadata">Optional. The album metadata of the album.</param>
|
||||
/// <param name="mediaFormat">Optional. The physical or digital medium of the album.</param>
|
||||
/// <param name="packaging">Optional. The outermost physical packaging of the album.</param>
|
||||
/// <param name="barcode">Optional. The barcode of the album.</param>
|
||||
/// <param name="catalogNumber">Optional. The catalog number of the album.</param>
|
||||
/// <param name="label">Optional. The name of the label that issued the album.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the album.</param>
|
||||
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release.</param>
|
||||
/// <param name="musicBrainzReleaseGroupId">Optional. The MusicBrainz identifier of the release group.</param>
|
||||
/// <param name="musicBrainzReleaseArtistId">Optional. The MusicBrainz identifier of the release artist.</param>
|
||||
@@ -47,8 +50,11 @@ public class UpdateAlbumCommandFixture
|
||||
/// <param name="includeAlbumId">Whether the album Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaFormat">Whether the media format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePackaging">Whether the packaging should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarcode">Whether the barcode should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCatalogNumber">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCatalogNumbers">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLabel">Whether the label should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseId">Whether the MusicBrainz release Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseGroupId">Whether the MusicBrainz release group Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseArtistId">Whether the MusicBrainz release artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -59,10 +65,13 @@ public class UpdateAlbumCommandFixture
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
string? albumId = null,
|
||||
AlbumMetadataDto? metadata = null,
|
||||
MusicAlbumMetadataDto? metadata = null,
|
||||
MusicMediaFormat? mediaFormat = null,
|
||||
MusicReleasePackaging? packaging = null,
|
||||
string? barcode = null,
|
||||
string? catalogNumber = null,
|
||||
List<string>? catalogNumbers = null,
|
||||
string? label = null,
|
||||
string? asin = null,
|
||||
Guid? musicBrainzReleaseId = null,
|
||||
Guid? musicBrainzReleaseGroupId = null,
|
||||
Guid? musicBrainzReleaseArtistId = null,
|
||||
@@ -73,8 +82,11 @@ public class UpdateAlbumCommandFixture
|
||||
bool includeAlbumId = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeMediaFormat = true,
|
||||
bool includePackaging = true,
|
||||
bool includeBarcode = true,
|
||||
bool includeCatalogNumber = true,
|
||||
bool includeCatalogNumbers = true,
|
||||
bool includeLabel = true,
|
||||
bool includeAsin = true,
|
||||
bool includeMusicBrainzReleaseId = true,
|
||||
bool includeMusicBrainzReleaseGroupId = true,
|
||||
bool includeMusicBrainzReleaseArtistId = true,
|
||||
@@ -85,10 +97,13 @@ public class UpdateAlbumCommandFixture
|
||||
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeAlbumId ? (albumId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeMetadata ? (metadata ?? _albumMetadataDtoFixture.Create()) : null,
|
||||
includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
|
||||
includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
|
||||
includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
|
||||
includeBarcode ? (barcode ?? _faker.Random.String2(_faker.Random.Int(12, 13), "0123456789")) : null,
|
||||
includeCatalogNumber ? (catalogNumber ?? _faker.Random.AlphaNumeric(_faker.Random.Int(1, 50))) : null,
|
||||
includeCatalogNumbers ? (catalogNumbers ?? [_faker.Random.AlphaNumeric(_faker.Random.Int(1, 50))]) : null,
|
||||
includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
|
||||
includeAsin ? (asin ?? _faker.Random.AlphaNumeric(10)) : null,
|
||||
includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
|
||||
|
||||
+26
-5
@@ -4,7 +4,11 @@ using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Comm
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.AddArtist;
|
||||
using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -20,47 +24,64 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class AddArtistCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly AddAlbumCommandFixture _addAlbumCommandFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid command to add an artist.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to, taken from the route.</param>
|
||||
/// <param name="name">Optional. The name of the artist.</param>
|
||||
/// <param name="metadata">Optional. The metadata of the artist.</param>
|
||||
/// <param name="website">Optional. The website of the artist.</param>
|
||||
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
|
||||
/// <param name="ipis">Optional. The IPI codes of the artist.</param>
|
||||
/// <param name="isnis">Optional. The ISNI codes of the artist.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that make up the artist.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the artist.</param>
|
||||
/// <param name="albums">Optional. The albums of the artist, each with its own tracks.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWebsite">Whether the website should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzArtistId">Whether the MusicBrainz identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIpis">Whether the IPI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsnis">Whether the ISNI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAlbums">Whether the albums should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created command to add an artist.</returns>
|
||||
public AddArtistCommand Create(
|
||||
string? libraryId = null,
|
||||
string? name = null,
|
||||
MusicArtistMetadataDto? metadata = null,
|
||||
string? website = null,
|
||||
Guid? musicBrainzArtistId = null,
|
||||
List<string>? ipis = null,
|
||||
List<string>? isnis = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<AddAlbumCommand>? albums = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeName = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeIpis = true,
|
||||
bool includeIsnis = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeAlbums = true)
|
||||
{
|
||||
string? resolvedLibraryId = includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null;
|
||||
|
||||
return new AddArtistCommand(
|
||||
resolvedLibraryId,
|
||||
includeName ? (name ?? _faker.Name.FullName()) : null,
|
||||
includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null,
|
||||
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
|
||||
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null,
|
||||
includeIpis ? (ipis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(9))]) : null,
|
||||
includeIsnis ? (isnis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(16))]) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeAlbums ? (albums ?? GenerateAlbums(resolvedLibraryId)) : null);
|
||||
}
|
||||
|
||||
|
||||
+26
-5
@@ -4,7 +4,11 @@ using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Comm
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtist;
|
||||
using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -20,41 +24,55 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class UpdateArtistCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly AddAlbumCommandFixture _addAlbumCommandFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid command to update an artist.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to, taken from the route.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist, taken from the route.</param>
|
||||
/// <param name="name">Optional. The name of the artist.</param>
|
||||
/// <param name="metadata">Optional. The metadata of the artist.</param>
|
||||
/// <param name="website">Optional. The website of the artist.</param>
|
||||
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
|
||||
/// <param name="ipis">Optional. The IPI codes of the artist.</param>
|
||||
/// <param name="isnis">Optional. The ISNI codes of the artist.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that make up the artist.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the artist.</param>
|
||||
/// <param name="albums">Optional. The albums of the artist, each with its own tracks.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWebsite">Whether the website should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzArtistId">Whether the MusicBrainz identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIpis">Whether the IPI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsnis">Whether the ISNI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAlbums">Whether the albums should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created command to update an artist.</returns>
|
||||
public UpdateArtistCommand Create(
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
string? name = null,
|
||||
MusicArtistMetadataDto? metadata = null,
|
||||
string? website = null,
|
||||
Guid? musicBrainzArtistId = null,
|
||||
List<string>? ipis = null,
|
||||
List<string>? isnis = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<AddAlbumCommand>? albums = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeArtistId = true,
|
||||
bool includeName = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeIpis = true,
|
||||
bool includeIsnis = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeAlbums = true)
|
||||
{
|
||||
string? resolvedLibraryId = includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null;
|
||||
@@ -62,10 +80,13 @@ public class UpdateArtistCommandFixture
|
||||
return new UpdateArtistCommand(
|
||||
resolvedLibraryId,
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeName ? (name ?? _faker.Name.FullName()) : null,
|
||||
includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null,
|
||||
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
|
||||
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null,
|
||||
includeIpis ? (ipis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(9))]) : null,
|
||||
includeIsnis ? (isnis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(16))]) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeAlbums ? (albums ?? GenerateAlbums(resolvedLibraryId)) : null);
|
||||
}
|
||||
|
||||
|
||||
+7
-11
@@ -26,7 +26,8 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class AddTrackCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly MoodDtoFixture _moodDtoFixture = new();
|
||||
private readonly IsrcDtoFixture _isrcDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
@@ -45,10 +46,9 @@ public class AddTrackCommandFixture
|
||||
/// <param name="script">Optional. The script used by the language of the track.</param>
|
||||
/// <param name="key">Optional. The musical key of the track.</param>
|
||||
/// <param name="bpm">Optional. The tempo of the track in beats per minute.</param>
|
||||
/// <param name="work">Optional. The title of the work the track is a recording of.</param>
|
||||
/// <param name="work">Optional. The work the track is a recording of.</param>
|
||||
/// <param name="musicBrainzRecordingId">Optional. The MusicBrainz identifier of the recording.</param>
|
||||
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz identifier of the track.</param>
|
||||
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work.</param>
|
||||
/// <param name="moods">Optional. The list of moods of the track.</param>
|
||||
/// <param name="isrcs">Optional. The list of ISRC of the track.</param>
|
||||
/// <param name="contributors">Optional. The list of media contributors that performed on the track.</param>
|
||||
@@ -67,7 +67,6 @@ public class AddTrackCommandFixture
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -78,16 +77,15 @@ public class AddTrackCommandFixture
|
||||
string? artistId = null,
|
||||
string? albumId = null,
|
||||
string? path = null,
|
||||
AudioMetadataDto? metadata = null,
|
||||
MusicTrackMetadataDto? metadata = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
string? script = null,
|
||||
MusicKey? key = null,
|
||||
int? bpm = null,
|
||||
string? work = null,
|
||||
MusicWorkDto? work = null,
|
||||
Guid? musicBrainzRecordingId = null,
|
||||
Guid? musicBrainzTrackId = null,
|
||||
Guid? musicBrainzWorkId = null,
|
||||
List<MoodDto>? moods = null,
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
@@ -106,7 +104,6 @@ public class AddTrackCommandFixture
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMusicBrainzWorkId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeContributors = true,
|
||||
@@ -117,16 +114,15 @@ public class AddTrackCommandFixture
|
||||
includeArtistId ? artistId ?? Guid.NewGuid().ToString() : null,
|
||||
includeAlbumId ? albumId ?? Guid.NewGuid().ToString() : null,
|
||||
includePath ? path ?? Path.Combine(Path.GetTempPath(), "lumina-tracks", _faker.System.FileName()) : null,
|
||||
includeMetadata ? metadata ?? _audioMetadataDtoFixture.Create() : null,
|
||||
includeMetadata ? metadata ?? _musicTrackMetadataDtoFixture.Create() : null,
|
||||
includeTrackNumber ? trackNumber ?? _faker.Random.Int(1, 30) : null,
|
||||
includeDiscNumber ? discNumber ?? _faker.Random.Int(1, 3) : null,
|
||||
includeScript ? script ?? _faker.Random.AlphaNumeric(4) : null,
|
||||
includeKey ? key ?? _faker.PickRandom<MusicKey>() : null,
|
||||
includeBpm ? bpm ?? _faker.Random.Int(40, 220) : null,
|
||||
includeWork ? work ?? _faker.Lorem.Sentence() : null,
|
||||
includeWork ? work ?? _musicWorkDtoFixture.Create() : null,
|
||||
includeMusicBrainzRecordingId ? musicBrainzRecordingId ?? _faker.Random.Guid() : null,
|
||||
includeMusicBrainzTrackId ? musicBrainzTrackId ?? _faker.Random.Guid() : null,
|
||||
includeMusicBrainzWorkId ? musicBrainzWorkId ?? _faker.Random.Guid() : null,
|
||||
includeMoods ? moods ?? _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeIsrcs ? isrcs ?? _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeContributors ? contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
|
||||
+7
-11
@@ -25,7 +25,8 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class UpdateTrackCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly MoodDtoFixture _moodDtoFixture = new();
|
||||
private readonly IsrcDtoFixture _isrcDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
@@ -45,10 +46,9 @@ public class UpdateTrackCommandFixture
|
||||
/// <param name="script">Optional. The script used by the language of the track.</param>
|
||||
/// <param name="key">Optional. The musical key of the track.</param>
|
||||
/// <param name="bpm">Optional. The tempo of the track in beats per minute.</param>
|
||||
/// <param name="work">Optional. The title of the work the track is a recording of.</param>
|
||||
/// <param name="work">Optional. The work the track is a recording of.</param>
|
||||
/// <param name="musicBrainzRecordingId">Optional. The MusicBrainz identifier of the recording.</param>
|
||||
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz identifier of the track.</param>
|
||||
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work.</param>
|
||||
/// <param name="moods">Optional. The moods of the track.</param>
|
||||
/// <param name="isrcs">Optional. The ISRC codes of the track.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that performed on the track.</param>
|
||||
@@ -60,7 +60,6 @@ public class UpdateTrackCommandFixture
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -79,16 +78,15 @@ public class UpdateTrackCommandFixture
|
||||
string? albumId = null,
|
||||
string? trackId = null,
|
||||
string? path = null,
|
||||
AudioMetadataDto? metadata = null,
|
||||
MusicTrackMetadataDto? metadata = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
string? script = null,
|
||||
MusicKey? key = null,
|
||||
int? bpm = null,
|
||||
string? work = null,
|
||||
MusicWorkDto? work = null,
|
||||
Guid? musicBrainzRecordingId = null,
|
||||
Guid? musicBrainzTrackId = null,
|
||||
Guid? musicBrainzWorkId = null,
|
||||
List<MoodDto>? moods = null,
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
@@ -100,7 +98,6 @@ public class UpdateTrackCommandFixture
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMusicBrainzWorkId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeMetadata = true,
|
||||
@@ -119,16 +116,15 @@ public class UpdateTrackCommandFixture
|
||||
includeAlbumId ? (albumId ?? _faker.Random.Guid().ToString()) : null,
|
||||
includeTrackId ? (trackId ?? _faker.Random.Guid().ToString()) : null,
|
||||
includePath ? (path ?? _faker.System.FilePath()) : null,
|
||||
includeMetadata ? (metadata ?? _audioMetadataDtoFixture.Create()) : null,
|
||||
includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null,
|
||||
includeTrackNumber ? (trackNumber ?? _faker.Random.Int(1, 20)) : null,
|
||||
includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
|
||||
includeScript ? (script ?? _faker.Random.String2(_faker.Random.Number(1, 50))) : null,
|
||||
includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
|
||||
includeBpm ? (bpm ?? _faker.Random.Int(40, 240)) : null,
|
||||
includeWork ? (work ?? _faker.Music.Genre()) : null,
|
||||
includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null,
|
||||
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzWorkId ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null,
|
||||
includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public class AddAlbumCommandHandlerTests
|
||||
private readonly AlbumEntityFixture _albumEntityFixture = new();
|
||||
private readonly LibraryEntityFixture _libraryEntityFixture = new();
|
||||
private readonly MediaContributorEntityFixture _mediaContributorEntityFixture = new();
|
||||
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
|
||||
|
||||
+24
-23
@@ -30,8 +30,9 @@ public class AddAlbumCommandValidatorTests
|
||||
{
|
||||
private readonly AddAlbumCommandFixture _addAlbumCommandFixture = new();
|
||||
private readonly AddAlbumCommandValidator _validator = new();
|
||||
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
private readonly TagDtoFixture _tagDtoFixture = new();
|
||||
@@ -228,7 +229,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenReleaseTypeIsNotDefined_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseType: (MusicReleaseType)999));
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseTypes: [(MusicReleaseType)999]));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -241,7 +242,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenReleaseTypeIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(includeReleaseType: false));
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(includeReleaseTypes: false));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -254,7 +255,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenReleaseTypeIsDefined_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseType: MusicReleaseType.Album));
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseTypes: [MusicReleaseType.Album]));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -925,7 +926,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenMediaFormatIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -951,7 +952,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenCatalogNumberExceeds50Characters_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(catalogNumber: new Faker().Random.String2(51));
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(catalogNumbers: [new Faker().Random.String2(51)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -964,7 +965,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenCatalogNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -977,7 +978,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenCatalogNumberIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(catalogNumber: new Faker().Random.String2(50));
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(catalogNumbers: [new Faker().Random.String2(50)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1035,7 +1036,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenBarcodeIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1087,7 +1088,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzIdsAreNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1780,7 +1781,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenTrackMusicBrainzWorkIdIsEmptyGuid_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(musicBrainzWorkId: Guid.Empty)]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(musicBrainzWorkId: Guid.Empty))]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1793,7 +1794,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenTrackMusicBrainzIdsAreNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1862,7 +1863,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenDiscNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1901,7 +1902,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenScriptIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1940,7 +1941,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenKeyIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1981,7 +1982,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenBpmIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2007,7 +2008,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenWorkExceeds255Characters_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: new Faker().Random.String2(256))]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(title: new Faker().Random.String2(256)))]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2020,7 +2021,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenWorkIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2033,7 +2034,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenWorkIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: new Faker().Random.String2(255))]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(title: new Faker().Random.String2(255)))]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2413,7 +2414,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenTrackMusicBrainzIdsAreValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(musicBrainzRecordingId: Guid.NewGuid(), musicBrainzTrackId: Guid.NewGuid(), musicBrainzWorkId: Guid.NewGuid())]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(musicBrainzRecordingId: Guid.NewGuid(), musicBrainzTrackId: Guid.NewGuid(), work: _musicWorkDtoFixture.Create(musicBrainzWorkId: Guid.NewGuid()))]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2690,7 +2691,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenMoodsIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2703,7 +2704,7 @@ public class AddAlbumCommandValidatorTests
|
||||
public void Validate_WhenIsrcsIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
AddAlbumCommand command = _addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ public class UpdateAlbumCommandHandlerTests
|
||||
private readonly AlbumEntityFixture _albumEntityFixture = new();
|
||||
private readonly LibraryEntityFixture _libraryEntityFixture = new();
|
||||
private readonly MediaContributorEntityFixture _mediaContributorEntityFixture = new();
|
||||
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
|
||||
+10
-10
@@ -28,7 +28,7 @@ public class UpdateAlbumCommandValidatorTests
|
||||
{
|
||||
private readonly UpdateAlbumCommandFixture _updateAlbumCommandFixture = new();
|
||||
private readonly UpdateAlbumCommandValidator _validator = new();
|
||||
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
private readonly TagDtoFixture _tagDtoFixture = new();
|
||||
@@ -240,7 +240,7 @@ public class UpdateAlbumCommandValidatorTests
|
||||
public void Validate_WhenReleaseTypeIsNotDefined_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseType: (MusicReleaseType)999));
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseTypes: [(MusicReleaseType)999]));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -253,7 +253,7 @@ public class UpdateAlbumCommandValidatorTests
|
||||
public void Validate_WhenReleaseTypeIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(includeReleaseType: false));
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(includeReleaseTypes: false));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -266,7 +266,7 @@ public class UpdateAlbumCommandValidatorTests
|
||||
public void Validate_WhenReleaseTypeIsDefined_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseType: MusicReleaseType.Album));
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseTypes: [MusicReleaseType.Album]));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -937,7 +937,7 @@ public class UpdateAlbumCommandValidatorTests
|
||||
public void Validate_WhenMediaFormatIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -963,7 +963,7 @@ public class UpdateAlbumCommandValidatorTests
|
||||
public void Validate_WhenCatalogNumberExceeds50Characters_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(catalogNumber: new Faker().Random.String2(51));
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(catalogNumbers: [new Faker().Random.String2(51)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -976,7 +976,7 @@ public class UpdateAlbumCommandValidatorTests
|
||||
public void Validate_WhenCatalogNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -989,7 +989,7 @@ public class UpdateAlbumCommandValidatorTests
|
||||
public void Validate_WhenCatalogNumberIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(catalogNumber: new Faker().Random.String2(50));
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(catalogNumbers: [new Faker().Random.String2(50)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1047,7 +1047,7 @@ public class UpdateAlbumCommandValidatorTests
|
||||
public void Validate_WhenBarcodeIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1099,7 +1099,7 @@ public class UpdateAlbumCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzIdsAreNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
UpdateAlbumCommand command = _updateAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
+4
-2
@@ -20,6 +20,7 @@ using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Al
|
||||
using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.AddArtist;
|
||||
using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Commands.AddTrack;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
@@ -53,6 +54,7 @@ public class AddArtistCommandHandlerTests
|
||||
private readonly AddArtistCommandHandler _sut;
|
||||
private readonly Guid _userId;
|
||||
private readonly AddArtistCommandFixture _addArtistCommandFixture = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly AddAlbumCommandFixture _addAlbumCommandFixture = new();
|
||||
private readonly AddTrackCommandFixture _addTrackCommandFixture = new();
|
||||
private readonly ArtistEntityFixture _artistEntityFixture = new();
|
||||
@@ -275,7 +277,7 @@ public class AddArtistCommandHandlerTests
|
||||
public async Task HandleAsync_WhenCommandDomainConversionFails_ShouldReturnFailureResultWithoutPersisting()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(name: string.Empty);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: string.Empty));
|
||||
|
||||
// Act
|
||||
Result<ArtistResponse> result = await _sut.HandleAsync(command, CancellationToken.None);
|
||||
@@ -384,7 +386,7 @@ public class AddArtistCommandHandlerTests
|
||||
Assert.NotNull(persistedArtist);
|
||||
Assert.Equal(insertedArtist!.Id, persistedArtist!.Id);
|
||||
Assert.Equal(persistedArtist.Id, result.Value.Id);
|
||||
Assert.Equal(persistedArtist.Name, result.Value.Name);
|
||||
Assert.Equal(persistedArtist.Name, result.Value.Metadata.Name);
|
||||
await _mockArtistRepository.Received(1).InsertAsync(Arg.Any<ArtistEntity>(), Arg.Any<CancellationToken>());
|
||||
await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
+28
-26
@@ -31,8 +31,10 @@ public class AddArtistCommandValidatorTests
|
||||
private readonly AddArtistCommandFixture _addArtistCommandFixture = new();
|
||||
private readonly AddArtistCommandValidator _validator = new();
|
||||
private readonly AddAlbumCommandFixture _addAlbumCommandFixture = new();
|
||||
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
private readonly TagDtoFixture _tagDtoFixture = new();
|
||||
@@ -65,7 +67,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenNameIsNull_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(includeName: false);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(includeName: false));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -80,7 +82,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenNameIsEmpty_ShouldHaveValidationError(string name)
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(name: name);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: name));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -93,7 +95,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenNameExceeds255Characters_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(name: new Faker().Random.String2(256));
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: new Faker().Random.String2(256)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -106,7 +108,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenNameIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(name: new Faker().Random.String2(255));
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: new Faker().Random.String2(255)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -359,7 +361,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumReleaseTypeIsNotDefined_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseType: (MusicReleaseType)999))]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseTypes: [(MusicReleaseType)999]))]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -372,7 +374,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumReleaseTypeIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(includeReleaseType: false))]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(includeReleaseTypes: false))]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -385,7 +387,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumReleaseTypeIsDefined_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseType: MusicReleaseType.Album))]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseTypes: [MusicReleaseType.Album]))]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -857,7 +859,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumMediaFormatIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -883,7 +885,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumCatalogNumberExceeds50Characters_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(catalogNumber: new Faker().Random.String2(51))]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(catalogNumbers: [new Faker().Random.String2(51)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -896,7 +898,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumCatalogNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -954,7 +956,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumBarcodeIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1006,7 +1008,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumMusicBrainzIdsAreNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1651,7 +1653,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackMusicBrainzWorkIdIsEmptyGuid_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(musicBrainzWorkId: Guid.Empty)])]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(musicBrainzWorkId: Guid.Empty))])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1748,7 +1750,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackWorkExceeds255Characters_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: new Faker().Random.String2(256))])]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(title: new Faker().Random.String2(256)))])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2187,7 +2189,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumCatalogNumberIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(catalogNumber: new Faker().Random.String2(50))]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(catalogNumbers: [new Faker().Random.String2(50)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2550,7 +2552,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackMusicBrainzIdsAreValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(musicBrainzRecordingId: Guid.NewGuid(), musicBrainzTrackId: Guid.NewGuid(), musicBrainzWorkId: Guid.NewGuid())])]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(musicBrainzRecordingId: Guid.NewGuid(), musicBrainzTrackId: Guid.NewGuid(), work: _musicWorkDtoFixture.Create(musicBrainzWorkId: Guid.NewGuid()))])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2576,7 +2578,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenDiscNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2602,7 +2604,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackScriptIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2628,7 +2630,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackKeyIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2654,7 +2656,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackBpmIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2680,7 +2682,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackWorkIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2693,7 +2695,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackWorkIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: new Faker().Random.String2(255))])]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(title: new Faker().Random.String2(255)))])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2719,7 +2721,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackMoodsIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2745,7 +2747,7 @@ public class AddArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackIsrcsIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
AddArtistCommand command = _addArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
+4
-2
@@ -19,6 +19,7 @@ using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Manage
|
||||
using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtist;
|
||||
using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Commands.AddTrack;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
@@ -52,6 +53,7 @@ public class UpdateArtistCommandHandlerTests
|
||||
private readonly UpdateArtistCommandHandler _sut;
|
||||
private readonly Guid _userId;
|
||||
private readonly UpdateArtistCommandFixture _updateArtistCommandFixture = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly AddAlbumCommandFixture _addAlbumCommandFixture = new();
|
||||
private readonly AddTrackCommandFixture _addTrackCommandFixture = new();
|
||||
private readonly ArtistEntityFixture _artistEntityFixture = new();
|
||||
@@ -383,7 +385,7 @@ public class UpdateArtistCommandHandlerTests
|
||||
Guid artistId = Guid.NewGuid();
|
||||
Guid albumId = Guid.NewGuid();
|
||||
ArtistEntity existingArtist = CreateExistingArtist(libraryId, artistId, albumId);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(libraryId: libraryId.ToString(), artistId: artistId.ToString(), name: string.Empty);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(libraryId: libraryId.ToString(), artistId: artistId.ToString(), metadata: _musicArtistMetadataDtoFixture.Create(name: string.Empty));
|
||||
StubArtistReads(existingArtist);
|
||||
|
||||
// Act
|
||||
@@ -530,7 +532,7 @@ public class UpdateArtistCommandHandlerTests
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.NotNull(updatedArtist);
|
||||
Assert.Equal(artistId, result.Value.Id);
|
||||
Assert.Equal(persistedArtist.Name, result.Value.Name);
|
||||
Assert.Equal(persistedArtist.Name, result.Value.Metadata.Name);
|
||||
await _mockArtistRepository.Received(1).UpdateAsync(Arg.Any<ArtistEntity>(), Arg.Any<CancellationToken>());
|
||||
await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
+28
-26
@@ -31,8 +31,10 @@ public class UpdateArtistCommandValidatorTests
|
||||
private readonly UpdateArtistCommandFixture _updateArtistCommandFixture = new();
|
||||
private readonly UpdateArtistCommandValidator _validator = new();
|
||||
private readonly AddAlbumCommandFixture _addAlbumCommandFixture = new();
|
||||
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
private readonly TagDtoFixture _tagDtoFixture = new();
|
||||
@@ -83,7 +85,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenNameIsNull_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(includeName: false);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(includeName: false));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -98,7 +100,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenNameIsEmpty_ShouldHaveValidationError(string name)
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(name: name);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: name));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -111,7 +113,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenNameExceeds255Characters_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(name: new Faker().Random.String2(256));
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: new Faker().Random.String2(256)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -124,7 +126,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenNameIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(name: new Faker().Random.String2(255));
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: new Faker().Random.String2(255)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -442,7 +444,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumReleaseTypeIsNotDefined_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseType: (MusicReleaseType)999))]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseTypes: [(MusicReleaseType)999]))]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -455,7 +457,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumReleaseTypeIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(includeReleaseType: false))]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(includeReleaseTypes: false))]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -468,7 +470,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumReleaseTypeIsDefined_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseType: MusicReleaseType.Album))]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(metadata: _albumMetadataDtoFixture.Create(releaseTypes: [MusicReleaseType.Album]))]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1074,7 +1076,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumMediaFormatIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1100,7 +1102,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumCatalogNumberExceeds50Characters_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(catalogNumber: new Faker().Random.String2(51))]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(catalogNumbers: [new Faker().Random.String2(51)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1113,7 +1115,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumCatalogNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1171,7 +1173,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumBarcodeIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1223,7 +1225,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumMusicBrainzIdsAreNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumber: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(includeMediaFormat: false, includeBarcode: false, includeCatalogNumbers: false, includeMusicBrainzReleaseId: false, includeMusicBrainzReleaseGroupId: false, includeMusicBrainzReleaseArtistId: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1938,7 +1940,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackMusicBrainzWorkIdIsEmptyGuid_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(musicBrainzWorkId: Guid.Empty)])]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(musicBrainzWorkId: Guid.Empty))])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2035,7 +2037,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackWorkExceeds255Characters_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: new Faker().Random.String2(256))])]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(title: new Faker().Random.String2(256)))])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2314,7 +2316,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenAlbumCatalogNumberIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(catalogNumber: new Faker().Random.String2(50))]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(catalogNumbers: [new Faker().Random.String2(50)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2632,7 +2634,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackMusicBrainzIdsAreValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(musicBrainzRecordingId: Guid.NewGuid(), musicBrainzTrackId: Guid.NewGuid(), musicBrainzWorkId: Guid.NewGuid())])]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(musicBrainzRecordingId: Guid.NewGuid(), musicBrainzTrackId: Guid.NewGuid(), work: _musicWorkDtoFixture.Create(musicBrainzWorkId: Guid.NewGuid()))])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2658,7 +2660,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenDiscNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2684,7 +2686,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackScriptIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2710,7 +2712,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackKeyIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2736,7 +2738,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackBpmIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2762,7 +2764,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackWorkIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2775,7 +2777,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackWorkIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: new Faker().Random.String2(255))])]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(title: new Faker().Random.String2(255)))])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2801,7 +2803,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackMoodsIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -2827,7 +2829,7 @@ public class UpdateArtistCommandValidatorTests
|
||||
public void Validate_WhenTrackIsrcsIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
UpdateArtistCommand command = _updateArtistCommandFixture.Create(albums: [_addAlbumCommandFixture.Create(tracks: [_addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false)])]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class GetArtistQueryHandlerTests
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.Equal(artistId, result.Value.Id);
|
||||
Assert.Equal(libraryId, result.Value.LibraryId);
|
||||
Assert.Equal(artist.Name, result.Value.Name);
|
||||
Assert.Equal(artist.Name, result.Value.Metadata.Name);
|
||||
Assert.Equal(artist.Website, result.Value.Website);
|
||||
Assert.NotNull(result.Value.Albums);
|
||||
Assert.Equal(artist.Albums.Count, result.Value.Albums!.Count);
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public class AddTrackCommandHandlerTests
|
||||
private readonly TrackEntityFixture _trackEntityFixture = new();
|
||||
private readonly LibraryEntityFixture _libraryEntityFixture = new();
|
||||
private readonly MediaContributorEntityFixture _mediaContributorEntityFixture = new();
|
||||
private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
|
||||
|
||||
+12
-11
@@ -27,7 +27,8 @@ public class AddTrackCommandValidatorTests
|
||||
{
|
||||
private readonly AddTrackCommandFixture _addTrackCommandFixture = new();
|
||||
private readonly AddTrackCommandValidator _validator = new();
|
||||
private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
private readonly TagDtoFixture _tagDtoFixture = new();
|
||||
@@ -943,7 +944,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzRecordingIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -969,7 +970,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzWorkIdIsEmptyGuid_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(musicBrainzWorkId: Guid.Empty);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(musicBrainzWorkId: Guid.Empty));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -985,7 +986,7 @@ public class AddTrackCommandValidatorTests
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(
|
||||
musicBrainzRecordingId: Guid.NewGuid(),
|
||||
musicBrainzTrackId: Guid.NewGuid(),
|
||||
musicBrainzWorkId: Guid.NewGuid());
|
||||
work: _musicWorkDtoFixture.Create(musicBrainzWorkId: Guid.NewGuid()));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1054,7 +1055,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenDiscNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1093,7 +1094,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenScriptIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1132,7 +1133,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenKeyIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1173,7 +1174,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenBpmIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1199,7 +1200,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenWorkExceeds255Characters_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(work: new Faker().Random.String2(256));
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(title: new Faker().Random.String2(256)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1212,7 +1213,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenWorkIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1225,7 +1226,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenWorkIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(work: new Faker().Random.String2(255));
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(title: new Faker().Random.String2(255)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
+14
-13
@@ -30,7 +30,8 @@ public class UpdateTrackCommandValidatorTests
|
||||
{
|
||||
private readonly UpdateTrackCommandFixture _updateTrackCommandFixture = new();
|
||||
private readonly UpdateTrackCommandValidator _validator = new();
|
||||
private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
private readonly TagDtoFixture _tagDtoFixture = new();
|
||||
@@ -1175,7 +1176,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzRecordingIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1214,7 +1215,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzTrackIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1227,7 +1228,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzWorkIdIsEmptyGuid_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(musicBrainzWorkId: Guid.Empty);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(musicBrainzWorkId: Guid.Empty));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1240,7 +1241,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzWorkIdIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(musicBrainzWorkId: Guid.NewGuid());
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(musicBrainzWorkId: Guid.NewGuid()));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1253,7 +1254,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzWorkIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1357,7 +1358,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenDiscNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1396,7 +1397,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenScriptIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1435,7 +1436,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenKeyIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1487,7 +1488,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenBpmIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1500,7 +1501,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenWorkExceeds255Characters_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(work: new Faker().Random.String2(256));
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(title: new Faker().Random.String2(256)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1513,7 +1514,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenWorkIs255Characters_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(work: new Faker().Random.String2(255));
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(work: _musicWorkDtoFixture.Create(title: new Faker().Random.String2(255)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1526,7 +1527,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenWorkIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
Reference in new issue
Block a user