Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
        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);
                }
            }
        }