예제 #1
0
        /// <summary>
        /// Adds article.
        /// </summary>
        /// <param name="article">article</param>
        public void AddArticle(ArticleDto article)
        {
            if (article == null)
            {
                throw new ArgumentNullException(nameof(article));
            }

            blog.AddArticle(article);
        }
예제 #2
0
        public void AddArticleTest()
        {
            var article = new ArticleDto()
            {
                Id      = 42,
                Header  = "Head",
                Content = "Content"
            };

            blog.AddArticle(article);

            Mock.Get(articleRepository)
            .Verify(repo => repo.Add(It.IsAny <Article>()), Times.Once);
            Mock.Get(articleRepository).VerifyNoOtherCalls();

            uowMock.Verify(x => x.Commit(), Times.Once);
        }