public void Update_CallMethod_SetModified() { var fakeBlogDbContext = new Mock<IDbContext>(); var sut = new PostRepository(fakeBlogDbContext.Object); sut.Update(new Post()); fakeBlogDbContext.Verify(x => x.SetModified(It.IsAny<Post>()), Times.Once()); }
public void Add_CallMethod_Posts_SaveChanges() { var fakeBlogDbContext = new Mock<IDbContext>(); fakeBlogDbContext.Setup(x => x.Posts.Add(It.IsAny<Post>())); var sut = new PostRepository(fakeBlogDbContext.Object); sut.Add(new Post()); fakeBlogDbContext.Verify(x => x.SaveChanges(), Times.Once()); }
public void ReturnTheCorrectPost_ForIdGiven() { var fakeBlogDbContext = new Mock<IDbContext>(); var sut = new PostRepository(fakeBlogDbContext.Object); }