public void EditReview() { // Arrange: int userId = 9; int bookId = 9; var newReview = new BookReviewViewModel { Rating = 4, Review = "geggjud bok" }; var prevCountAll = _reviewService.GetAllBookReviewsForAllBooks().Sum(i => i.Reviews.Count()); var prevCountUser = _reviewService.GetAllUserReviews(userId).Count(); var prevCountBook = _reviewService.GetAllBookReviews(bookId).Count(); // Act: _reviewService.EditReview(userId, bookId, newReview); // Assert: // Ensure that a new entity object has been updated and not just added to the list: var currentCountAll = _reviewService.GetAllBookReviewsForAllBooks().Sum(i => i.Reviews.Count()); var currentCountUser = _reviewService.GetAllUserReviews(userId).Count(); var currentCountBook = _reviewService.GetAllBookReviews(bookId).Count(); Assert.AreEqual(prevCountAll, currentCountAll); Assert.AreEqual(prevCountUser, currentCountUser); Assert.AreEqual(prevCountBook, currentCountBook); // Get access to the entity object and assert that // the properties have been set: var newEntity = _reviewService.GetUserReview(userId, bookId); Assert.AreEqual(8, newEntity.BookReviewId); Assert.AreEqual("9title", newEntity.BookTitle); Assert.AreEqual(4, newEntity.Rating); Assert.AreEqual("geggjud bok", newEntity.Review); Assert.AreEqual(new DateTime(1988, 10, 2), newEntity.DateOfReview); }