public void SaveArticle(ArticleOld articleOld)
 {
     if (articleOld != null)
     {
         _articleEngineRepository.SaveArticle(articleOld);
     }
 }
 public void DeleteArticle(ArticleOld articleOld)
 {
     if (articleOld != null)
     {
         _articleEngineRepository.DeleteArticle(articleOld);
     }
 }
        public void TestDeleteArticle()
        {
            var articleService = new ArticleService(_articleRepository.Object);

            var article = new ArticleOld(ArticleType.Full, new FullArticleValidator(), new ArticlePublishingRules()) { Id = Guid.NewGuid(), Title = "my new article to be deleted" };
            int articleCount = articleService.GetArticles().Count;

            articleService.SaveArticle(article);
            Assert.AreEqual(articleCount + 1, articleService.GetArticles().Count);

            var testArticle = articleService.GetArticle(article.Id);
            Assert.IsNotNull(testArticle);

            articleService.DeleteArticle(article);
            Assert.AreEqual(articleCount, articleService.GetArticles().Count);
            Assert.IsNull(articleService.GetArticle(article.Id));
        }
 private ArticleSummary ConvertToSummary(ArticleOld articleOld)
 {
     return new ArticleSummary
     {
         Id = articleOld.Id,
         ArticleType =  articleOld.ArticleType,
         Description = articleOld.Description,
         SubTitle = articleOld.SubTitle,
         Tags = articleOld.Tags,
         Title = articleOld.Title
     };
 }
        public void TestAddArticle()
        {
            var articleService = new ArticleService(_articleRepository.Object);

            var article = new ArticleOld(ArticleType.Full, new FullArticleValidator(), new ArticlePublishingRules())
                {
                    Id = Guid.NewGuid()
                };

            Assert.IsNull(articleService.GetArticle(article.Id));

            articleService.SaveArticle(article);

            ArticleOld returnedArticleOld = articleService.GetArticle(article.Id);
            Assert.IsNotNull(returnedArticleOld);
            Assert.AreEqual(article.Id, returnedArticleOld.Id);
        }