public void Throw_When_Product_Id_Changed_Before_Product_Built()
        {
            // Arrange
            ProductBuilder target = new ProductBuilderBuilder().Build();

            target.BuildProductData(1);
            target.BuildProductData(19);
        }
        public void Cannot_Build_Product_With_No_Product_Data()
        {
            // Arrange
            ProductBuilder target = new ProductBuilderBuilder().Build();

            // Act
            Product result = target.Build();

            // Assert
            Assert.IsNull(result);
        }
        public void Can_Reuse_Builder_After_Product_Built()
        {
            // Arrange
            int            productId     = 1;
            int            productIdNext = 2;
            ProductBuilder target        = new ProductBuilderBuilder().WithProductData().WithNoEligibity(productId).WithNoEligibity(productIdNext).Build(); // No eligibility to make the test simpler.

            target.BuildProductData(productId).Build();

            // Act
            Product result = target.BuildProductData(productIdNext).Build();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.ProductData.Id == 2);
        }
        public void Can_Build_Product_With_No_Eligibility()
        {
            // Arrange
            int            productId = 1;
            ProductBuilder target    = new ProductBuilderBuilder().WithProductData().WithNoEligibity(productId).Build();

            // Act
            Product result = target.BuildProductData(productId).BuildEligibility().Build();

            // Assert - result in general
            Assert.IsNotNull(result);
            // Assert - product data exists and contains correct data.
            Assert.IsNotNull(result.ProductData);
            Assert.IsTrue(result.ProductData.Id == 1);
            // Assert - lack of eligibility is signalled through Null Eligibility object.
            Assert.IsInstanceOfType(result.Eligibility, typeof(NullEligibility));
        }
        public void Can_Build_Product_With_Eligibility()
        {
            // Arrange
            int            productId = 1;
            ProductBuilder target    = new ProductBuilderBuilder().WithProductData().WithRuleSetEligibities(productId).Build();

            // Act
            Product result = target.BuildProductData(productId).BuildEligibility().Build();

            // Assert - result in general
            Assert.IsNotNull(result);
            // Assert - product data exists and contains correct data.
            Assert.IsNotNull(result.ProductData);
            Assert.IsTrue(result.ProductData.Id == 1);
            // Assert - eligibility
            Assert.IsNotNull(result.Eligibility);
            Assert.IsTrue(result.Eligibility.RuleSet == 1);
        }