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); }
/// <summary> /// Deletes article. /// </summary> /// <param name="articleId">Article identity</param> public void DeleteArticle(int articleId) { blog.DeleteArticle(articleId); }