Example #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();
        }
        public void NotFailWithNoItemsNotificationNoCreditCard()
        {
            var paymentProcessor = new FakePaymentProcessor();
            var reservationService = new FakeReservationService();
            var notificationService = new FakeNotificationService();
            var cart = new Cart() { CustomerEmail = "*****@*****.**" };
            var paymentDetails = new PaymentDetails() { PaymentMethod = PaymentMethod.CreditCard };
            var order = new OnlineOrder(cart,
                                        paymentDetails,
                                        paymentProcessor,
                                        reservationService,
                                        notificationService);

            order.Checkout();

            // if I got here, I guess it worked...
        }
Example #3
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);
        }
        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.IsTrue(paymentProcessor.WasCalled);
            Assert.AreEqual(cart.TotalAmount, paymentProcessor.AmountPassed);
        }