internal async void TrackNumber_ReturnsTrackNumberTag() { var mapper = new MapperID3(_fileSystem, _currentFile.ToString(), _track, true, 2); var tags = new TagLibTab(); await mapper.MapTags(tags); Assert.Equal(_track.Title, tags.Title); Assert.Equal(2u, tags.Track); }
internal async Task TrackNumber_ReturnsTrackNumberTag() { var userSettings = new UserSettings { OrderNumberInMediaTagEnabled = true, InternalOrderNumber = 2 }; var mapper = new MapperID3(_fileSystem, _currentFile.ToMediaFilePath(), _track, userSettings); var tags = new TagLibTab(); await mapper.MapTags(tags); Assert.Equal(_track.Title, tags.Title); Assert.Equal(2u, tags.Track); }
internal async void APITrack_ReturnsPartTags() { var track = new Track { Artist = "Artist", Title = "Song", AlbumPosition = 1, AlbumArtists = new[] { "Alpha", "Bravo", "Charlie" }, Performers = new[] { "Delta", "Echo", "Foxtrot" }, Album = "Golf", Genres = new[] { "Hotel", "India", "Juliet" }, Disc = 1u, Year = 2020u, ArtExtraLargeUrl = ART_LINK, ArtLargeUrl = ART_LINK, ArtMediumUrl = ART_LINK, ArtSmallUrl = ART_LINK }; var mp3Tags = new MP3Tags(_fileSystem) { CurrentFile = _currentFile.ToString(), Count = null, OrderNumberInMediaTagEnabled = false, Track = track }; var tags = new TagLibTab(); await mp3Tags.MapMediaTags(tags); Assert.Equal(track.ToString(), mp3Tags.Track.ToString()); Assert.Equal(track.AlbumPosition, (int?)tags.Track); Assert.Equal(track.Title, tags.Title); Assert.Equal(track.AlbumArtists, tags.AlbumArtists); Assert.Equal(track.Performers, tags.Performers); Assert.Equal(track.Album, tags.Album); Assert.Equal(track.Genres, tags.Genres); Assert.Equal(track.Disc, tags.Disc); Assert.Equal(track.Year, tags.Year); var arts = new[] { track.ArtExtraLarge, track.ArtLarge, track.ArtMedium, track.ArtSmall }; for (var index = 0; index < arts.Length; index++) { var pictureType = index == 0 ? TagLib.PictureType.FrontCover : TagLib.PictureType.Media; Assert.Equal(arts[index].Length, tags.Pictures[index].Data.Count); Assert.Equal(pictureType, tags.Pictures[index].Type); } }
internal async void TrackNumber_ReturnsTrackNumberTag() { var mp3Tags = new MP3Tags(_fileSystem) { CurrentFile = _currentFile.ToString(), Count = 2, OrderNumberInMediaTagEnabled = true, Track = _track }; var tags = new TagLibTab(); await mp3Tags.MapMediaTags(tags); Assert.Equal(_track.Title, tags.Title); Assert.Equal(2u, tags.Track); }
internal async Task APITrack_ReturnsPartTags() { var track = new Track { Artist = "Artist", Title = "Song", TitleExtendedSeparatorType = TitleSeparatorType.None, AlbumPosition = 1, AlbumArtists = new[] { "Alpha", "Bravo", "Charlie" }, Performers = new[] { "Delta", "Echo", "Foxtrot" }, Album = "Golf", Genres = new[] { "Hotel", "India", "Juliet" }, Disc = 1, Year = 2020, ArtLargeUrl = "www.google.com", ArtMediumUrl = ART_LINK1, ArtSmallUrl = ART_LINK2 }; var userSettings = new UserSettings() { OrderNumberInMediaTagEnabled = false }; var mapper = new MapperID3(_fileSystem, _currentFile.ToMediaFilePath(), track, userSettings); var tags = new TagLibTab(); await mapper.MapTags(tags); Assert.Equal("Alpha, Bravo, Charlie - Song", mapper.Track.ToString()); Assert.Equal(track.ToString(), mapper.Track.ToString()); Assert.Equal(track.ToTitleString(), mapper.Track.ToTitleString()); Assert.Equal(track.AlbumPosition, (int?)tags.Track); Assert.Equal(track.Title, tags.Title); Assert.Equal(track.TitleExtended, tags.Subtitle); Assert.Equal(track.AlbumArtists, tags.AlbumArtists); Assert.Equal(track.Performers, tags.Performers); Assert.Equal(track.Album, tags.Album); Assert.Equal(track.Genres, tags.Genres); Assert.Equal((uint)track.Disc, tags.Disc); Assert.Equal((uint)track.Year, tags.Year); Assert.Single(tags.Pictures); Assert.Equal(track.ArtMedium.Length, tags.Pictures[0].Data.Count); Assert.Equal(TagLib.PictureType.FrontCover, tags.Pictures[0].Type); }
internal async void DefaultTrack_ReturnsNoTags() { var mapper = new MapperID3(_fileSystem, _currentFile.ToString(), _track, false); var tags = new TagLibTab(); await mapper.MapTags(tags); Assert.Equal(_track.ToString(), mapper.Track.ToString()); Assert.Equal(_track.Title, tags.Title); Assert.Equal(_track.TitleExtended, tags.Subtitle); Assert.Equal(_track.Artist, tags.AlbumArtists.FirstOrDefault()); Assert.Equal(_track.Artist, tags.Performers.FirstOrDefault()); Assert.Null(tags.Album); Assert.Null(tags.Genres); Assert.Equal(0u, tags.Disc); Assert.Equal(0u, tags.Year); Assert.Null(tags.Pictures); }
internal async Task APITrack_WithParenthesisExtendedTitle_ReturnsPartTags() { var track = new Track { Artist = "Artist", Title = "Song", TitleExtended = "feat. Other", TitleExtendedSeparatorType = TitleSeparatorType.Parenthesis }; var userSettings = new UserSettings { OrderNumberInMediaTagEnabled = false }; var mapper = new MapperID3(_fileSystem, _currentFile.ToMediaFilePath(), track, userSettings); var tags = new TagLibTab(); await mapper.MapTags(tags); Assert.Equal("Artist - Song (feat. Other)", mapper.Track.ToString()); Assert.Equal(track.ToString(), mapper.Track.ToString()); Assert.Equal(track.ToTitleString(), mapper.Track.ToTitleString()); }
internal async Task DefaultTrack_ReturnsNoTags() { var userSettings = new UserSettings { OrderNumberInMediaTagEnabled = false }; var mapper = new MapperID3(_fileSystem, _currentFile.ToMediaFilePath(), _track, userSettings); var tags = new TagLibTab(); await mapper.MapTags(tags); Assert.Equal(_track.ToString(), mapper.Track.ToString()); Assert.Equal(_track.Title, tags.Title); Assert.Equal(_track.TitleExtended, tags.Subtitle); Assert.Equal(_track.Artist, tags.AlbumArtists.FirstOrDefault()); Assert.Equal(_track.Artist, tags.Performers.FirstOrDefault()); Assert.Null(tags.Album); Assert.Null(tags.Genres); Assert.Equal(0u, tags.Disc); Assert.Equal(0u, tags.Year); Assert.Null(tags.Pictures); }
internal async void DefaultTrack_ReturnsNoTags() { var mp3Tags = new MP3Tags(_fileSystem) { CurrentFile = _currentFile.ToString(), Count = null, OrderNumberInMediaTagEnabled = false, Track = _track }; var tags = new TagLibTab(); await mp3Tags.MapMediaTags(tags); Assert.Equal(_track.ToString(), mp3Tags.Track.ToString()); Assert.Equal(_track.Title, tags.Title); Assert.Equal(_track.Artist, tags.AlbumArtists.FirstOrDefault()); Assert.Equal(_track.Artist, tags.Performers.FirstOrDefault()); Assert.Null(tags.Album); Assert.Null(tags.Genres); Assert.Equal(0u, tags.Disc); Assert.Equal(0u, tags.Year); Assert.Equal(new TagLib.IPicture[] { }, tags.Pictures); }