public async Task AddMusicPlaylistAsyncShouldAddMusicPlaylist() { using (var context = new MusicDBContext(options)) { IMusicRepoDB _repo = new MusicRepoDB(context); MusicPlaylist testMusicPlaylist = new MusicPlaylist(); testMusicPlaylist.PlayListId = 2; testMusicPlaylist.MusicId = 1; var newMusicPlaylist = await _repo.AddMusicPlaylistAsync(testMusicPlaylist); Assert.NotNull(newMusicPlaylist); Assert.Equal(2, newMusicPlaylist.PlayListId); } }
public async Task UpdateMusicPlaylistAsyncShouldUpdateMusicPlaylist() { using (var context = new MusicDBContext(options)) { IMusicRepoDB _repo = new MusicRepoDB(context); MusicPlaylist testMusicPlaylist = new MusicPlaylist(); testMusicPlaylist.Id = 4; testMusicPlaylist.PlayListId = 2; testMusicPlaylist.MusicId = 1; var newMusicPlaylist = await _repo.AddMusicPlaylistAsync(testMusicPlaylist); testMusicPlaylist.PlayListId = 1; var updateMusicPlaylist = await _repo.UpdateMusicPlaylistAsync(testMusicPlaylist); Assert.Equal(1, updateMusicPlaylist.PlayListId); } }
public async Task GetMusicPlaylistByIDAsyncShouldReturnMusicPlaylist() { using (var context = new MusicDBContext(options)) { IMusicRepoDB _repo = new MusicRepoDB(context); MusicPlaylist testMusicPlaylist = new MusicPlaylist(); testMusicPlaylist.Id = 4; testMusicPlaylist.PlayListId = 2; testMusicPlaylist.MusicId = 1; var newMusicPlaylist = await _repo.AddMusicPlaylistAsync(testMusicPlaylist); var foundMusicPlaylist = await _repo.GetMusicPlaylistByIDAsync(4); Assert.NotNull(foundMusicPlaylist); Assert.Equal(4, foundMusicPlaylist.Id); } }
public async Task DeleteMusicPlaylistAsyncShouldDeleteMusicPlaylist() { using (var context = new MusicDBContext(options)) { IMusicRepoDB _repo = new MusicRepoDB(context); MusicPlaylist testMusicPlaylist = new MusicPlaylist(); testMusicPlaylist.Id = 4; testMusicPlaylist.PlayListId = 2; testMusicPlaylist.MusicId = 1; var newMusicPlaylist = await _repo.AddMusicPlaylistAsync(testMusicPlaylist); var deleteMusicPlaylist = await _repo.DeleteMusicPlaylistAsync(testMusicPlaylist); using (var assertContext = new MusicDBContext(options)) { var result = assertContext.MusicPlaylist.Find(4); Assert.Null(result); } } }