Beispiel #1
0
        public void GetDescription_1FlatTaxDecorator_CorrectDescription()
        {
            //Arrange
            IProduct product          = new Product(1, 12.49m, "1 product", "product", false, CategoryType.Books);
            var      flatTaxDecorator = new FlatTaxDecorator(product, "Tax description", 0.1m);

            //Act
            var description = flatTaxDecorator.GetDescription();

            //Assert
            Assert.AreEqual("1 product, Tax description", description);
        }
Beispiel #2
0
        public void CalculateGrossAmount_TaxOver0Dot05_CorrectGrossAmountWithTaxRoundedUpToTheNearestFiveCent()
        {
            //Arrange
            IProduct product          = new Product(1, 12.51m, "1 product", "product", false, CategoryType.Books);
            var      flatTaxDecorator = new FlatTaxDecorator(product, "Tax description", 0.1m);

            //Act
            decimal grossAmount = flatTaxDecorator.CalculateGrossAmount();

            //Assert
            //tax: 1.251 --> 1.3
            //tax + price = 1.3 + 12.51 = 13.81
            Assert.AreEqual(13.81m, grossAmount);
        }