Example #1
0
        public void SendTotalAmountToCreditCardProcessor()
        {
            var paymentProcessor    = new FakePaymentProcessor();
            var reservationService  = new FakeReservationService();
            var notificationService = new FakeNotificationService();

            _cart.Add(new OrderItem()
            {
                Quantity = 5, Sku = "B4GO_APPLE"
            });
            _cart.Add(new OrderItem()
            {
                Quantity = 6, Sku = "SPECIAL_CANDYBAR"
            });
            var paymentDetails = new PaymentDetails()
            {
                PaymentMethod = PaymentMethod.CreditCard
            };
            var order = new LosselyCoupled.OnlineOrder(_cart,
                                                       paymentDetails,
                                                       paymentProcessor,
                                                       reservationService,
                                                       notificationService);

            order.Checkout();

            Assert.IsTrue(paymentProcessor.WasCalled);
            Assert.AreEqual(_cart.TotalAmount(), paymentProcessor.AmountPassed);
        }
 public void FiveWithOneEachItem()
 {
     _cart.Add(new OrderItem()
     {
         Quantity = 1, Sku = "EACH_WIDGET"
     });
     Assert.AreEqual(5.0m, _cart.TotalAmount());
 }