Adds the music library commands and their validators

This commit is contained in:
BinaryAlley committed 2026-10-09 07:34:00 +03:00
1 parent b7db29eee5
commit 1fad9316ce
30 files changed
+700 -256

No files matched your search

@@ -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();
@@ -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);
@@ -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>
@@ -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);
@@ -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>());
}
@@ -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);
@@ -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>());
}
@@ -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);
@@ -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);
@@ -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();
@@ -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);
@@ -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);