public void TestAddingListOfSongs() { EZPlaylist playlist = new EZPlaylist("My Awesome Playlist"); MediaLibrary lib = new MediaLibrary(); if (lib.Songs.Count > 1) { List<SongInfo> list = new List<SongInfo>(); Song song = lib.Songs[0]; SongInfo si1 = new SongInfo(song.Artist.Name, song.Album.Name, song.Name, song.Duration, song.TrackNumber); list.Add(si1); song = lib.Songs[1]; SongInfo si2 = new SongInfo(song.Artist.Name, song.Album.Name, song.Name, song.Duration, song.TrackNumber); list.Add(si2); playlist.AddList(list.AsReadOnly()); Assert.IsTrue(playlist.Count == 2); Assert.IsTrue(playlist.Songs.Contains(si1)); Assert.IsTrue(playlist.Songs.Contains(si2)); } else { Assert.Fail("Can't test adding a song because there are no songs to add or there is only one song."); } }
public void TestCreatingPlaylistOfEntireLibraryUsingAddListMethod() { EZPlaylist playlist = new EZPlaylist("My Awesome Playlist"); MediaLibrary lib = new MediaLibrary(); List<SongInfo> SIlist = new List<SongInfo>(); if (lib.Songs.Count > 0) { foreach (Song song in lib.Songs) { SongInfo si = new SongInfo(song.Artist.Name, song.Album.Name, song.Name, song.Duration, song.TrackNumber); SIlist.Add(si); } playlist.AddList(SIlist.AsReadOnly()); playlist.SavePlaylist(); playlist.Clear(); playlist = new EZPlaylist(); playlist.ReadFromFile("My Awesome Playlist"); foreach (SongInfo si in SIlist) { Assert.IsTrue(playlist.Contains(si)); } Assert.IsTrue(playlist.Count == SIlist.Count); Assert.IsTrue(playlist.Name == "My Awesome Playlist"); } else { Assert.Fail("Can't test adding a song because there are no songs to add."); } }