public void BeBestDiscountedForShoppingCartWithEdgeCase001() { var potterClassifier = new PotterClassifier(); var shoppingCart = new ShoppingCart(new List <IClassifier> { potterClassifier }); // 2 del 1 shoppingCart.AddItem(new Book("111")); shoppingCart.AddItem(new Book("111")); // 2 del 2 shoppingCart.AddItem(new Book("222")); shoppingCart.AddItem(new Book("222")); // 2 del 3 shoppingCart.AddItem(new Book("333")); shoppingCart.AddItem(new Book("333")); //1 del 4 shoppingCart.AddItem(new Book("444")); //1 del 5 shoppingCart.AddItem(new Book("555")); var resultPrice = shoppingCart.GetCartTotalPrice(); resultPrice.Should().Be(new Money(2 * (UNIT_PRICE * 4 * 0.8m))); //resultPrice.Should().Be(new Money((UNIT_PRICE * 5 * 0.75m) + (8m * 3 * 0.9m))); }
public void BeZeroForNoBooks() { var potterClassifier = new PotterClassifier(); var shoppingCart = new ShoppingCart(new List <IClassifier> { potterClassifier }); var resultPrice = shoppingCart.GetCartTotalPrice(); resultPrice.Should().Be(new Money(0)); }
public void BeUnitPriceForOneBook(string ISBNCode) { var potterClassifier = new PotterClassifier(); var shoppingCart = new ShoppingCart(new List <IClassifier> { potterClassifier }); shoppingCart.AddItem(new Book(ISBNCode)); var resultPrice = shoppingCart.GetCartTotalPrice(); resultPrice.Should().Be(new Money(UNIT_PRICE)); }
public void BeDiscountedForShoppingCartWithTwoDifferentBooks(string ISBNCode1, string ISBNCode2) { var potterClassifier = new PotterClassifier(); var shoppingCart = new ShoppingCart(new List <IClassifier> { potterClassifier }); shoppingCart.AddItem(new Book(ISBNCode1)); shoppingCart.AddItem(new Book(ISBNCode2)); var resultPrice = shoppingCart.GetCartTotalPrice(); resultPrice.Should().Be(new Money((UNIT_PRICE * 2) * 0.95m)); }
public void BeRegularForShoppingCartWithTwoSameBooks(string ISBNCode) { var potterClassifier = new PotterClassifier(); var shoppingCart = new ShoppingCart(new List <IClassifier> { potterClassifier }); shoppingCart.AddItem(new Book(ISBNCode)); shoppingCart.AddItem(new Book(ISBNCode)); var resultPrice = shoppingCart.GetCartTotalPrice(); resultPrice.Should().Be(new Money(UNIT_PRICE * 2)); }