public void IsSongDeleted() { songList = CDCatalogManager.GetSongs(); foreach (Song s in songList) { Assert.IsFalse(s.SongTitle.Equals(testSong.SongTitle)); } }
public void DeleteASong() { bool result = false; songList = CDCatalogManager.GetSongs(); foreach (Song s in songList) { if (s.SongTitle == testSong.SongTitle) { result = CDCatalogManager.DeleteSong(s); } } Assert.IsTrue(result); }
public void CheckSongs() { bool result = false; songList = CDCatalogManager.GetSongs(); foreach (Song s in songList) { if (s.SongTitle == testSong.SongTitle) { result = true; } } Assert.IsNotEmpty(songList); Assert.IsTrue(result); }
public void EditASong() { bool result = false; songList.Clear(); songList = CDCatalogManager.GetSongs(); foreach (Song s in songList) { if (s.SongTitle == editedTestSong.SongTitle) { s.SongTitle = "Foxed Song"; result = CDCatalogManager.UpdateSong(s); } } Assert.IsNotEmpty(songList); Assert.IsTrue(result); }
public void TearDown() { songList = CDCatalogManager.GetSongs(); foreach (Song s in songList) { if (s.SongTitle == "Foxed Song" || s.SongTitle == "Misspelled Snog") { CDCatalogManager.DeleteSong(s); } } albumList = CDCatalogManager.GetAlbums(); foreach (Album a in albumList) { if (a.AlbumTitle == "Fixed Album" || a.AlbumTitle == "Misspelled Ablum") { CDCatalogManager.DeleteAlbum(a); } } artistList = CDCatalogManager.GetArtists(); foreach (Artist a in artistList) { if (a.ArtistName == "Fixed Artist" || a.ArtistName == "Misspelled Test Atrist") { CDCatalogManager.DeleteArtist(a); } } genreList = CDCatalogManager.GetGenres(); foreach (Genre g in genreList) { if (g.GenreName == "Fixed Genre" || g.GenreName == "Misspelled Gerne") { CDCatalogManager.DeleteGenre(g); } } }
private void button4_Click(object sender, EventArgs e) { CDCatalogProcess.GeneratePlayList("Winforms Test Playlist", 120); Playlist playlist = CDCatalogManager.GetPlaylists().Where(p => p.PlaylistName.Equals("Winforms Test Playlist")).Last(); List <PlaylistSong> pl = CDCatalogManager.GetPlaylistSongs().Where(p => p.PlaylistID.Equals(playlist.PlaylistID)).ToList(); List <Song> songs = new List <Song>(); int totalDuration = 0; foreach (PlaylistSong pls in pl) { songs.Add(CDCatalogManager.GetSongs().Where(s => s.SongID.Equals(pls.SongID)).First()); totalDuration += (CDCatalogManager.GetSongs().Where(s => s.SongID.Equals(pls.SongID)).First()).TrackLength; } dataGridView1.DataSource = songs; textBox1.Text = "Total playlist duration is " + totalDuration.ToString() + " seconds."; //using (CDCatalogEntities db = new CDCatalogEntities()) //{ // Playlist playList = new Playlist(); // playList.PlaylistName = "Test Playlist"; // db.Playlists.Add(playList); // db.SaveChanges(); // List<PlaylistSong> playlistSongList = new List<PlaylistSong>(); // int targetMinutes = 12000; // int targetSeconds = (targetMinutes * 60); // List<Song> songList = db.Songs.OrderByDescending(s => s.TrackLength).ToList(); // playlistSongList = RandomPlaylist(songList, targetSeconds, playList); // List<PlaylistSong> pl = db.PlaylistSongs.Where(p => p.PlaylistID.Equals(playList.PlaylistID)).ToList(); // List<Song> songs = new List<Song>(); //} }