public void Checkout_WithDiscountCard_AmountOfSaleIsAddedToDiscountCard() { var sale = new Sale(); var discountCard = new DiscountCard(1000); sale.Add(new Product("A", 2000)); sale.AddDiscountCard(discountCard); Assert.Equal(1, discountCard.CurrentPercent()); Assert.Equal(1980, sale.Checkout()); Assert.Equal(3, discountCard.CurrentPercent()); }
public void Checkout_WithDiscountCard_DiscountAppliesToProductIfVolumeIsNotReached() { var sale1 = new Sale(); var discountCard = new DiscountCard(1000); var product = new Product("A", 2000, new VolumeDiscount(3000, 2)); sale1.Add(product); sale1.AddDiscountCard(discountCard); Assert.Equal(1, discountCard.CurrentPercent()); Assert.Equal(1980, sale1.Checkout()); Assert.Equal(3, discountCard.CurrentPercent()); }
public void Checkout_WithDiscountCard_NoDiscountForVolume() { var sale1 = new Sale(); var product = new Product("A", 2000, new VolumeDiscount(3000, 2)); var discountCard = new DiscountCard(1000); sale1.Add(product); sale1.Add(product); sale1.AddDiscountCard(discountCard); Assert.Equal(1, discountCard.CurrentPercent()); Assert.Equal(3000, sale1.Checkout()); Assert.Equal(1, discountCard.CurrentPercent()); }
public void Checkout_WithoutDiscountCard_DiscountCardDoesntApplyToNewSale() { var sale1 = new Sale(); var discountCard = new DiscountCard(1000); var product = new Product("A", 2000); sale1.Add(product); sale1.AddDiscountCard(discountCard); sale1.Checkout(); var sale2 = new Sale(); sale2.Add(product); Assert.Equal(3, discountCard.CurrentPercent()); Assert.Equal(2000, sale2.Checkout()); Assert.Equal(3, discountCard.CurrentPercent()); }