コード例 #1
0
        public void DeleteArticleTest()
        {
            Mock.Get(articleRepository).Setup(x => x.Get(54)).Returns(new Article()
            {
                Id = 54
            });
            blog.DeleteArticle(54);

            Mock.Get(articleRepository).Verify(x => x.Get(It.Is <int>(id => id == 54)), Times.Once);
            Mock.Get(articleRepository).Verify(x => x.Delete(It.Is <Article>(a => a.Id == 54)), Times.Once);
            Mock.Get(articleRepository).VerifyNoOtherCalls();

            uowMock.Verify(x => x.Commit(), Times.Once);
        }
コード例 #2
0
 /// <summary>
 /// Deletes article.
 /// </summary>
 /// <param name="articleId">Article identity</param>
 public void DeleteArticle(int articleId)
 {
     blog.DeleteArticle(articleId);
 }