public void RemoveCommentLike_ValidLikeId_Test() { var init = new InitializeMockContext(); var mock = init.mock; var controller = new LikesService(mock.Object); controller.RemoveCommentLike(2, 1); mock.Verify(m => m.SaveChanges(), Times.Once()); }
public void RemoveCommentLike_Counting_Test() { var init = new InitializeMockContext(); var mock = init.mock; var commentId = 1; var expectedLikeCountInt = mock.Object.PostComments.Where(x => x.Id == commentId).First().LikeCount; var controller = new LikesService(mock.Object); controller.RemoveCommentLike(2, 1); mock.Verify(m => m.SaveChanges(), Times.Once()); Assert.AreEqual(expectedLikeCountInt - 1, mock.Object.PostComments.Where(x => x.Id == commentId).First().LikeCount); }