Exemple #1
0
        public void Setup()
        {
            var builder = new ArticleBuilder();

            builder.SetProductCode(productCode: "A");
            builder.SetUnitPrice(unitPrice: 1.25M);
            builder.SetBulkPriceCondition(quantity: 3, price: 3.00M);
            article = builder.BuildArticle();
        }
Exemple #2
0
        public void testBulkPricingArticle()
        {
            var builder = new ArticleBuilder();

            builder.SetProductCode(productCode: "A");
            builder.SetUnitPrice(unitPrice: 1.25M);
            builder.SetBulkPriceCondition(quantity: 3, price: 3.00M);
            var article = builder.BuildArticle();

            Assert.AreEqual("A", article.productCode);
            Assert.AreEqual(3.0M, article.CalculatePrice(3));
        }
Exemple #3
0
        public void testOutOfRangeBulkPricingArticle()
        {
            Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                var builder = new ArticleBuilder();
                builder.SetProductCode(productCode: "A");
                builder.SetUnitPrice(unitPrice: 1.25M);
                builder.SetBulkPriceCondition(quantity: 1, price: 3.00M);
                builder.BuildArticle();
            }, "Bulk quantity should be > 1");

            Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                var builder = new ArticleBuilder();
                builder.SetProductCode(productCode: "A");
                builder.SetUnitPrice(unitPrice: 1.25M);
                builder.SetBulkPriceCondition(quantity: 2, price: 0.00M);
                builder.BuildArticle();
            }, "Bulk price should be > 0");
        }