public void DeleteByNullValue() { // Arrange CommentLikeRepository commentLikeRepository = new CommentLikeRepository(dbContext); // Act // Assert Assert.ThrowsException <ArgumentNullException>(() => commentLikeRepository.Delete(entityToDelete: null)); }
public void DeleteByNullKey_Exception() { // Arrange CommentLikeRepository commentLikeRepository = new CommentLikeRepository(dbContext); object wrongId = null; // Act // Assert Assert.ThrowsException <ArgumentNullException>(() => commentLikeRepository.Delete(wrongId)); }
public void DeleteByWrongKey_Exception() { // Arrange CommentLikeRepository commentLikeRepository = new CommentLikeRepository(dbContext); Guid wrongId = default(Guid); // Act // Assert Assert.ThrowsException <InvalidOperationException>(() => commentLikeRepository.Delete(wrongId)); }
public void DeleteByValue() { // Arrange CommentLikeRepository commentLikeRepository = new CommentLikeRepository(dbContext); CommentLike commentLikeToDelete = dbContext.CommentLike.First(); // Act commentLikeRepository.Delete(commentLikeToDelete); dbContext.SaveChanges(); // Assert CollectionAssert.DoesNotContain(dbContext.CommentLike.ToArray(), commentLikeToDelete); }
public void DeleteByKey() { // Arrange CommentLikeRepository commentLikeRepository = new CommentLikeRepository(dbContext); CommentLike expectedDeletedCommentLike = dbContext.CommentLike.First(); Guid idToDelete = expectedDeletedCommentLike.Id; // Act commentLikeRepository.Delete(idToDelete); dbContext.SaveChanges(); // Assert CollectionAssert.DoesNotContain(dbContext.CommentLike.ToArray(), expectedDeletedCommentLike); }
public void DeleteByChangedValue() { // Arrange CommentLikeRepository commentLikeRepository = new CommentLikeRepository(dbContext); CommentLike changedCommentLikeToDelete = dbContext.CommentLike.First(); changedCommentLikeToDelete.IsLiked = false; // Act commentLikeRepository.Delete(entityToDelete: changedCommentLikeToDelete); dbContext.SaveChanges(); // Assert CollectionAssert.DoesNotContain(dbContext.CommentLike.ToArray(), changedCommentLikeToDelete); }