Beispiel #1
0
        public async Task AddUploadedMusicAsyncShouldAddUploadedMusic()
        {
            using (var context = new MusicDBContext(options))
            {
                IMusicRepoDB _repo           = new MusicRepoDB(context);
                UploadMusic  testUploadMusic = new UploadMusic();
                testUploadMusic.UserId        = 1;
                testUploadMusic.MusicFilePath = "cool_song";
                testUploadMusic.Name          = "Jumping Jacks";
                testUploadMusic.UploadDate    = DateTime.Parse("2021-03-15 18:17:00");
                testUploadMusic.Likes         = 3409;
                testUploadMusic.Plays         = 9084;
                var newUploadMusic = await _repo.AddUploadedMusicAsync(testUploadMusic);

                Assert.Equal("Jumping Jacks", newUploadMusic.Name);
            }
        }
Beispiel #2
0
        public async Task DeleteUploadedMusicAsyncShouldDeleteUploadedMusic()
        {
            using (var context = new MusicDBContext(options))
            {
                IMusicRepoDB _repo           = new MusicRepoDB(context);
                UploadMusic  testUploadMusic = new UploadMusic();
                testUploadMusic.Id            = 4;
                testUploadMusic.UserId        = 1;
                testUploadMusic.MusicFilePath = "cool_song";
                testUploadMusic.Name          = "Jumping Jacks";
                testUploadMusic.UploadDate    = DateTime.Parse("2021-03-15 18:17:00");
                testUploadMusic.Likes         = 3409;
                testUploadMusic.Plays         = 9084;
                var newUploadMusic = await _repo.AddUploadedMusicAsync(testUploadMusic);

                var deletedUploadMusic = await _repo.DeleteUploadedMusicAsync(testUploadMusic);

                using (var assertContext = new MusicDBContext(options))
                {
                    var result = assertContext.UploadMusic.Find(4);
                    Assert.Null(result);
                }
            }
        }