コード例 #1
0
        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());
        }
コード例 #2
0
        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());
        }
コード例 #3
0
 public void ReturnTheCorrectPost_ForIdGiven()
 {
     var fakeBlogDbContext = new Mock<IDbContext>();
     var sut = new PostRepository(fakeBlogDbContext.Object);
 }