Exemple #1
0
        public async Task UpdateCommentAsyncShouldUpdateComment()
        {
            using (var context = new MusicDBContext(options))
            {
                IMusicRepoDB _repo       = new MusicRepoDB(context);
                Comments     testComment = new Comments();
                testComment.Id            = 4;
                testComment.Comment       = "First Comment";
                testComment.CommentData   = DateTime.Parse("2021-03-15 18:17:00");
                testComment.UserId        = 2;
                testComment.UploadMusicId = 1;
                var newComment = await _repo.AddCommentAsync(testComment);

                Assert.Equal("First Comment", newComment.Comment);
                testComment.Comment = "Edit: I was actually second.";
                var updatedComment = await _repo.UpdateCommentAsync(testComment);

                Assert.Equal("Edit: I was actually second.", updatedComment.Comment);
            }
        }