public void DELETE_GivenAnExistingReview_Id_DeleteTheReview() { //Arrange Review existingReview = new Review { Id = 2 }; //Act int result = repository.Delete(existingReview); repository.Commit(); //Assert Assert.IsInstanceOfType(result, typeof(int)); }
public void UPDATE_GivenAnExistingReview_UpdateTheReviewText() { //Arrange Review existingReview = new Review { Id = 1, CreateDateTime = DateTime.Now, CreatedByAuthor = "Mikey Mouse", ModifiedDateTime = DateTime.Now, Rating = 4, SubmittedBy = "Sam Smith", Text = "Not SOO TrickYY!!", Title = "Best Ever!!" }; //Act var result = repository.Update(existingReview); var updatedId = repository.Commit(); //Assert Assert.IsInstanceOfType(result, typeof(Review)); Assert.IsTrue(updatedId == Convert.ToInt32(existingReview.Id)); }
public void ADD_GivenAReview_WhenTheReviewIsAdded_EnsureThatItReturnsAnId() { //Arrange Review newReview = new Review { CreateDateTime = DateTime.Now, CreatedByAuthor = "Mikey Mouse", ModifiedDateTime = DateTime.Now, Rating = 4, SubmittedBy = "Sam Smith", Text = "Tricky but worth while recipe!!", Title = "Best Ever!!" }; //Act var result = repository.Add<Review>(newReview); repository.Commit(); //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(Review)); Assert.IsTrue(result.Id > 0); }