コード例 #1
0
        public void AddCurrentSale_AfterAddingLastSale_AppliesNewDiscountPercent()
        {
            var discountCard = new DiscountCard(1500);
            var totalPriceWithOnePercentDiscount = discountCard.Apply(1000);

            discountCard.AddCurrentSale(1000);

            Assert.Equal(990, totalPriceWithOnePercentDiscount);
            Assert.Equal(970, discountCard.Apply(1000));
        }
コード例 #2
0
        public void Apply_WithRoundings()
        {
            var discountCard      = new DiscountCard(7);
            var priceWithDiscount = discountCard.Apply(91.5m);

            priceWithDiscount.ShouldBe(85.10m);
        }
コード例 #3
0
        public void Apply_WithoutRoundings()
        {
            var discountCard      = new DiscountCard(10);
            var priceWithDiscount = discountCard.Apply(100m);

            priceWithDiscount.ShouldBe(90m);
        }
コード例 #4
0
        public void GetTotalPrice_WithoutDiscountPercent_ReturnsUnitPrice()
        {
            var discountCard = new DiscountCard();

            Assert.Equal(10, discountCard.Apply(10));
        }
コード例 #5
0
        public void GetTotalPrice_WithDiscountPercent_ReturnsReducedPrice()
        {
            var discountCard = new DiscountCard(1500);

            Assert.Equal(990, discountCard.Apply(1000));
        }