public void TestAddingSong() { EZPlaylist playlist = new EZPlaylist("My Awesome Playlist"); MediaLibrary lib = new MediaLibrary(); if (lib.Songs.Count > 0) { Song song = lib.Songs[0]; SongInfo si = new SongInfo(song.Artist.Name, song.Album.Name, song.Name, song.Duration, song.TrackNumber); playlist.Add(si); Assert.IsTrue(playlist.Count == 1); Assert.IsTrue(playlist.Songs.Contains(si)); } else { Assert.Fail("Can't test adding a song because there are no songs to add."); } }
public void TestCreatingPlaylistOfEntireLibrary() { 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); playlist.Add(si); SIlist.Add(si); } 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."); } }