public void GetArticleResult_WithoutArticle_ShouldReturnPageWithoutArticle() { var repository = RepositoryTestHelper.GetMockRepository(); var articleResult = repository.GetArticleResult(TestArticleId); Assert.IsFalse(articleResult.HasArticle); }
public void GetArticleResult_ArticleWithoutArticleRevision_ShouldReturnPageWithNullRevision() { var article = new Article(TestArticleId); var repository = RepositoryTestHelper.GetMockRepository(article); var articleResult = repository.GetArticleResult(TestArticleId); Assert.IsNull(articleResult.ArticleRevision); }
public void GetArticleResult_WithArticle_ShouldReturnArticleView() { var article = new Article(TestArticleId); var articleRevision = new ArticleRevision(article.Id, string.Empty); var repository = RepositoryTestHelper.GetMockRepository(article, articleRevision); var articleResult = repository.GetArticleResult(TestArticleId); Assert.IsNotNull(articleResult); }
public void GetArticleResult_WithArticleWithRedirectToArticle_ShouldReturnPageWithRedirect() { var articleRedirect = new ArticleRedirect(TestArticleId, TestRedirectArticleId); var repository = RepositoryTestHelper.GetMockRepository(articleRedirect: articleRedirect); var articleResult = repository.GetArticleResult(TestArticleId); Assert.IsTrue(articleResult.HasRedirect); Assert.AreEqual(TestArticleId.Slug, articleResult.ArticleRedirect.OriginalArticleSlug); Assert.AreEqual(TestRedirectArticleId.Slug, articleResult.ArticleRedirectId.Slug); }
public void GetArticleResult_WithSlugContainingSpace_ShouldThrowArticleIdNotEnsuredException() { var repository = RepositoryTestHelper.GetMockRepository(); string urlContainingSpace = "URL WITH SPACE"; string exceptionEnsuredSlug = null; string exceptionOriginalSlug = null; try { repository.GetArticleResult(urlContainingSpace); } catch (ArticleIdNotEnsuredException ex) { exceptionEnsuredSlug = ex.EnsuredSlug; exceptionOriginalSlug = ex.OriginalSlug; } var expectedEnsuredId = new ArticleId(urlContainingSpace); Assert.AreEqual(expectedEnsuredId.Slug, exceptionEnsuredSlug); Assert.AreEqual(urlContainingSpace, exceptionOriginalSlug); }