Beispiel #1
0
        public void Discount_IsCorrect()
        {
            // arrange
            var product = new Product("Widget", 12345, Money.USDollar(12.35));
            var pr      = new PriceResult();

            pr.Product             = product;
            pr.DiscountRatePercent = 0.15M;

            // act
            var result = pr.Discount();

            // assert
            Assert.True(result == Money.USDollar(1.85));
        }
Beispiel #2
0
        public void TotalWithDiscountAndTax_IsCorrect()
        {
            // arrange
            var product = new Product("Widget", 12345, Money.USDollar(20.25));
            var pr      = new PriceResult();

            pr.Product             = product;
            pr.TaxRatePercent      = 0.20M;
            pr.DiscountRatePercent = 0.15M;

            // act

            // assert
            Assert.True(pr.Tax() == Money.USDollar(4.05));
            Assert.True(pr.Discount() == Money.USDollar(3.04));
            Assert.True(pr.Total() == Money.USDollar(21.26));
        }