diff --git a/tests/Common/Lumina.Plugins.ID3.Fixtures/Common/Models/DTO/Tags/Id3TagDtoFixture.cs b/tests/Common/Lumina.Plugins.ID3.Fixtures/Common/Models/DTO/Tags/Id3TagDtoFixture.cs index a79ce840..7d63f0ad 100644 --- a/tests/Common/Lumina.Plugins.ID3.Fixtures/Common/Models/DTO/Tags/Id3TagDtoFixture.cs +++ b/tests/Common/Lumina.Plugins.ID3.Fixtures/Common/Models/DTO/Tags/Id3TagDtoFixture.cs @@ -21,25 +21,18 @@ internal sealed class Id3TagDtoFixture /// Creates a new instance with randomized test data. /// /// Optional. The title of the track. - /// Whether the title should be included, or forced to . /// Optional. The title of the album the track belongs to. - /// Whether the album should be included, or forced to . /// Optional. The artists credited on the track. /// Optional. The artists credited on the album. /// Optional. The sort name of the album artist. - /// Whether the album artist sort name should be included, or forced to . /// Optional. The sort name of the track artist. - /// Whether the track artist sort name should be included, or forced to . /// Optional. The number of the track on its disc, or a random one when not supplied. /// Optional. The number of tracks on the disc, or a random one when not supplied. /// Optional. The number of the disc the track belongs to, or a random one when not supplied. /// Optional. The number of discs of the release, or a random one when not supplied. /// Optional. The year the track was released. - /// Whether the year should be included, or forced to . /// Optional. The original release date of the track. - /// Whether the original release date should be included, or forced to . /// Optional. The original release year of the track. - /// Whether the original release year should be included, or forced to . /// Optional. The genres the tags associate with the track. /// Optional. The composers credited on the track. /// Optional. The lyricists credited on the track. @@ -47,83 +40,85 @@ internal sealed class Id3TagDtoFixture /// Optional. The remixers credited on the track. /// Optional. The people credited on the track, each with their role. /// Optional. The language of the track. - /// Whether the language should be included, or forced to . /// Optional. The script used by the language of the track. - /// Whether the script should be included, or forced to . /// Optional. The label that issued the album. - /// Whether the label should be included, or forced to . /// Optional. The catalog numbers of the album. /// Optional. The barcode of the album. - /// Whether the barcode should be included, or forced to . /// Optional. The types of the release. /// Optional. The status of the release. - /// Whether the release status should be included, or forced to . /// Optional. The country the release was issued in. - /// Whether the release country should be included, or forced to . /// Optional. The medium of the release. - /// Whether the media format should be included, or forced to . /// Optional. The packaging of the release. - /// Whether the packaging should be included, or forced to . /// Optional. The ASIN of the album. - /// Whether the ASIN should be included, or forced to . /// Optional. The ISRCs of the track. /// Optional. The moods of the track. /// Optional. The title of the work the track is a recording of. - /// Whether the work title should be included, or forced to . /// Optional. The musical key of the track. - /// Whether the musical key should be included, or forced to . /// Optional. The tempo of the track in beats per minute. - /// Whether the tempo should be included, or forced to . /// Optional. The duration of the audio of the track in seconds. - /// Whether the duration should be included, or forced to . /// Optional. The sample rate of the audio of the track in Hz. - /// Whether the sample rate should be included, or forced to . /// Optional. The number of audio channels of the track. - /// Whether the channel count should be included, or forced to . /// Optional. The bit depth of the audio of the track. - /// Whether the bit depth should be included, or forced to . /// Optional. The bitrate of the audio of the track in kbps. - /// Whether the bitrate should be included, or forced to . /// Optional. The description of the audio codec of the track. - /// Whether the audio codec should be included, or forced to . + /// Optional. The container of the audio file of the track. /// Optional. The official website associated with the artist. - /// Whether the website should be included, or forced to . /// Optional. The MusicBrainz identifier of the artist. - /// Whether the MusicBrainz artist identifier should be included, or forced to . /// Optional. The MusicBrainz identifier of the release artist. - /// Whether the MusicBrainz release artist identifier should be included, or forced to . /// Optional. The MusicBrainz identifier of the release group. - /// Whether the MusicBrainz release group identifier should be included, or forced to . /// Optional. The MusicBrainz identifier of the release. - /// Whether the MusicBrainz release identifier should be included, or forced to . /// Optional. The MusicBrainz identifier of the recording of the track. - /// Whether the MusicBrainz recording identifier should be included, or forced to . /// Optional. The MusicBrainz identifier of the track on its release. - /// Whether the MusicBrainz release track identifier should be included, or forced to . /// Optional. The MusicBrainz identifier of the work the track is a recording of. + /// Whether the title should be included, or forced to . + /// Whether the album should be included, or forced to . + /// Whether the album artist sort name should be included, or forced to . + /// Whether the track artist sort name should be included, or forced to . + /// Whether the year should be included, or forced to . + /// Whether the original release date should be included, or forced to . + /// Whether the original release year should be included, or forced to . + /// Whether the language should be included, or forced to . + /// Whether the script should be included, or forced to . + /// Whether the label should be included, or forced to . + /// Whether the barcode should be included, or forced to . + /// Whether the release status should be included, or forced to . + /// Whether the release country should be included, or forced to . + /// Whether the media format should be included, or forced to . + /// Whether the packaging should be included, or forced to . + /// Whether the ASIN should be included, or forced to . + /// Whether the work title should be included, or forced to . + /// Whether the musical key should be included, or forced to . + /// Whether the tempo should be included, or forced to . + /// Whether the duration should be included, or forced to . + /// Whether the sample rate should be included, or forced to . + /// Whether the channel count should be included, or forced to . + /// Whether the bit depth should be included, or forced to . + /// Whether the bitrate should be included, or forced to . + /// Whether the audio codec should be included, or forced to . + /// Whether the container should be included, or forced to . + /// Whether the website should be included, or forced to . + /// Whether the MusicBrainz artist identifier should be included, or forced to . + /// Whether the MusicBrainz release artist identifier should be included, or forced to . + /// Whether the MusicBrainz release group identifier should be included, or forced to . + /// Whether the MusicBrainz release identifier should be included, or forced to . + /// Whether the MusicBrainz recording identifier should be included, or forced to . + /// Whether the MusicBrainz release track identifier should be included, or forced to . /// Whether the MusicBrainz work identifier should be included, or forced to . /// A configured instance. public Id3TagDto Create( string? title = null, - bool includeTitle = true, string? album = null, - bool includeAlbum = true, List? trackArtists = null, List? albumArtists = null, string? albumArtistSortName = null, - bool includeAlbumArtistSortName = true, string? trackArtistSortName = null, - bool includeTrackArtistSortName = true, uint? trackNumber = null, uint? trackCount = null, uint? discNumber = null, uint? discCount = null, int? year = null, - bool includeYear = true, DateOnly? originalReleaseDate = null, - bool includeOriginalReleaseDate = true, int? originalReleaseYear = null, - bool includeOriginalReleaseYear = true, List? genres = null, List? composers = null, List? lyricists = null, @@ -131,60 +126,69 @@ internal sealed class Id3TagDtoFixture List? remixers = null, List<(string Role, string Name)>? involvedPeople = null, string? language = null, - bool includeLanguage = true, string? script = null, - bool includeScript = true, string? label = null, - bool includeLabel = true, List? catalogNumbers = null, string? barcode = null, - bool includeBarcode = true, List? releaseTypes = null, string? releaseStatus = null, - bool includeReleaseStatus = true, string? releaseCountry = null, - bool includeReleaseCountry = true, string? mediaFormat = null, - bool includeMediaFormat = true, string? packaging = null, - bool includePackaging = true, string? asin = null, - bool includeAsin = true, List? isrcs = null, List? moods = null, string? workTitle = null, - bool includeWorkTitle = true, string? musicKey = null, - bool includeMusicKey = true, int? bpm = null, - bool includeBpm = true, int? durationInSeconds = null, - bool includeDurationInSeconds = true, int? sampleRate = null, - bool includeSampleRate = true, int? channels = null, - bool includeChannels = true, int? bitDepth = null, - bool includeBitDepth = true, int? bitrate = null, - bool includeBitrate = true, string? audioCodec = null, - bool includeAudioCodec = true, + string? container = null, string? website = null, - bool includeWebsite = true, string? musicBrainzArtistId = null, - bool includeMusicBrainzArtistId = true, string? musicBrainzReleaseArtistId = null, - bool includeMusicBrainzReleaseArtistId = true, string? musicBrainzReleaseGroupId = null, - bool includeMusicBrainzReleaseGroupId = true, string? musicBrainzReleaseId = null, - bool includeMusicBrainzReleaseId = true, string? musicBrainzRecordingId = null, - bool includeMusicBrainzRecordingId = true, string? musicBrainzReleaseTrackId = null, - bool includeMusicBrainzReleaseTrackId = true, string? musicBrainzWorkId = null, + bool includeTitle = true, + bool includeAlbum = true, + bool includeAlbumArtistSortName = true, + bool includeTrackArtistSortName = true, + bool includeYear = true, + bool includeOriginalReleaseDate = true, + bool includeOriginalReleaseYear = true, + bool includeLanguage = true, + bool includeScript = true, + bool includeLabel = true, + bool includeBarcode = true, + bool includeReleaseStatus = true, + bool includeReleaseCountry = true, + bool includeMediaFormat = true, + bool includePackaging = true, + bool includeAsin = true, + bool includeWorkTitle = true, + bool includeMusicKey = true, + bool includeBpm = true, + bool includeDurationInSeconds = true, + bool includeSampleRate = true, + bool includeChannels = true, + bool includeBitDepth = true, + bool includeBitrate = true, + bool includeAudioCodec = true, + bool includeContainer = true, + bool includeWebsite = true, + bool includeMusicBrainzArtistId = true, + bool includeMusicBrainzReleaseArtistId = true, + bool includeMusicBrainzReleaseGroupId = true, + bool includeMusicBrainzReleaseId = true, + bool includeMusicBrainzRecordingId = true, + bool includeMusicBrainzReleaseTrackId = true, bool includeMusicBrainzWorkId = true) { return new Id3TagDto @@ -230,6 +234,7 @@ internal sealed class Id3TagDtoFixture BitDepth = includeBitDepth ? bitDepth ?? _faker.PickRandom(16, 24, 32) : null, Bitrate = includeBitrate ? bitrate ?? _faker.Random.Int(128, 320) : null, AudioCodec = includeAudioCodec ? audioCodec ?? _faker.PickRandom("PCM Audio", "MPEG Audio") : null, + Container = includeContainer ? container ?? _faker.PickRandom("MP3", "FLAC", "OGG", "WAV") : null, Website = includeWebsite ? website ?? _faker.Internet.Url() : null, MusicBrainzArtistId = includeMusicBrainzArtistId ? musicBrainzArtistId ?? Guid.NewGuid().ToString() : null, MusicBrainzReleaseArtistId = includeMusicBrainzReleaseArtistId ? musicBrainzReleaseArtistId ?? Guid.NewGuid().ToString() : null, diff --git a/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Mapping/Id3TagMapperTests.cs b/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Mapping/Id3TagMapperTests.cs index e3013ff1..e5cb3314 100644 --- a/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Mapping/Id3TagMapperTests.cs +++ b/tests/UnitTests/Lumina.Plugins.ID3.UnitTests/Core/Mapping/Id3TagMapperTests.cs @@ -673,6 +673,7 @@ public class Id3TagMapperTests bitDepth: 24, bitrate: 320, audioCodec: "MPEG Audio", + container: "FLAC", originalReleaseDate: new DateOnly(1975, 11, 21), originalReleaseYear: 1975, releaseCountry: "US", @@ -719,6 +720,7 @@ public class Id3TagMapperTests Assert.Equal(24, result.BitDepth); Assert.Equal(320, result.Bitrate); Assert.Equal("MPEG Audio", result.AudioCodec); + Assert.Equal("FLAC", result.Container); Assert.Equal(recordingId, result.MusicBrainzRecordingId); Assert.Equal(releaseTrackId, result.MusicBrainzTrackId); Assert.Null(result.Ratings); @@ -749,6 +751,7 @@ public class Id3TagMapperTests includeBitDepth: false, includeBitrate: false, includeAudioCodec: false, + includeContainer: false, includeOriginalReleaseDate: false, includeOriginalReleaseYear: false, includeReleaseCountry: false, @@ -783,11 +786,25 @@ public class Id3TagMapperTests Assert.Null(result.BitDepth); Assert.Null(result.Bitrate); Assert.Null(result.AudioCodec); + Assert.Null(result.Container); Assert.Null(result.MusicBrainzRecordingId); Assert.Null(result.MusicBrainzTrackId); Assert.Null(result.Contributors); } + [Fact] + public void MapTrack_WhenTheContainerIsWhiteSpace_ShouldReturnNullContainer() + { + // Arrange + Id3TagDto data = _id3TagDtoFixture.Create(container: " "); + + // Act + AudioMetadataDto result = Id3TagMapper.MapTrack(data); + + // Assert + Assert.Null(result.Container); + } + [Fact] public void MapTrack_WhenThereIsNoReleaseInformation_ShouldReturnNullReleaseInfo() { diff --git a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Mapping/MusicBrainzMapperTests.cs b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Mapping/MusicBrainzMapperTests.cs index 91d8eb01..018ebdf2 100644 --- a/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Mapping/MusicBrainzMapperTests.cs +++ b/tests/UnitTests/Lumina.Plugins.MusicBrainz.UnitTests/Core/Mapping/MusicBrainzMapperTests.cs @@ -1051,6 +1051,7 @@ public class MusicBrainzMapperTests Assert.Null(result.Channels); Assert.Null(result.BitDepth); Assert.Null(result.AudioCodec); + Assert.Null(result.Container); // a metadata provider never supplies the container, which is captured locally from the file Assert.Null(result.Bitrate); Assert.Equal(recordingId, result.MusicBrainzRecordingId); Assert.Null(result.MusicBrainzTrackId);