Exemple #1
0
        public void GetArticleTest()
        {
            var artMock = Mock.Get(articleRepository);

            artMock.Setup(x => x.Get(21)).Returns(new Article()
            {
                Image = new Image()
                {
                    Id = 5
                }
            });

            var article = blog.GetArticle(21);

            artMock.Verify(x => x.Get(It.Is <int>(i => i == 21)), Times.Once);
            artMock.VerifyNoOtherCalls();
        }
Exemple #2
0
 /// <summary>
 /// Gets article.
 /// </summary>
 /// <param name="articleId">Article identity</param>
 /// <returns>Article object</returns>
 public ArticleDto GetArticle(int articleId)
 {
     return(blog.GetArticle(articleId));
 }