Esempio n. 1
0
        public void BuildShouldThrowExceptionIfCategoryIsNotSet()
        {
            // Assert
            var articleFactory = new ArticleFactory();

            // Act
            Action act = () => articleFactory
                         .WithTitle("Some Title")
                         .WithContent("Some Content")
                         .Build();

            // Assert
            act.Should().Throw <InvalidArticleException>();
        }
Esempio n. 2
0
        public void BuildShouldThrowExceptionIfTitleAreNotSet()
        {
            // Assert
            var articleFactory = new ArticleFactory();

            // Act
            Action act = () => articleFactory
                         .WithTitle("Test Title")
                         .WithCategory("TestCategory", "TestDescription")
                         .Build();

            // Assert
            act.Should().Throw <InvalidArticleException>();
        }
Esempio n. 3
0
        public void BuildShouldCreateArticleIfEveryPropertyIsSet()
        {
            // Assert
            var articleFactory = new ArticleFactory();

            // Act
            var article = articleFactory
                          .WithTitle("Title for Test")
                          .WithContent("Some text desctiption")
                          .WithCategory(CategoryFakes.ValidCategoryName, "TestCategoryDescription")
                          .WithImageUrl("http://test.image.url")
                          .Build();

            // Assert
            article.Should().NotBeNull();
        }