Esempio n. 1
0
        public void NotFailWithNoItemsNotificationNoCreditCard()
        {
            var paymentProcessor    = new FakePaymentProcessor();
            var reservationService  = new FakeReservationService();
            var notificationSerfice = new FakeNotificationService();
            var cart = new Cart {
                CustomerEmail = "*****@*****.**"
            };
            var paymentDetails = new PaymentDetails {
                PaymentMethod = PaymentMethod.CreditCard
            };
            var order = new OnlineOrder(cart, paymentDetails, paymentProcessor, reservationService, notificationSerfice);

            order.Checkout();
        }
Esempio n. 2
0
        public void SendTotalAmountToCreditCardProcessor()
        {
            var paymentProcessor    = new FakePaymentProcessor();
            var reservationService  = new FakeReservationService();
            var notificationService = new FakeNotificationService();
            var cart = new Cart {
                TotalAmount = 5.05m
            };
            var paymentDetails = new PaymentDetails
            {
                PaymentMethod = PaymentMethod.CreditCard
            };
            var order = new OnlineOrder(cart, paymentDetails, paymentProcessor, reservationService, notificationService);

            order.Checkout();

            Assert.True(paymentProcessor.WasCalled);
            Assert.Equal(cart.TotalAmount, paymentProcessor.AmountPassed);
        }