public void PaymentCommand_SalesControllerStart_StartPaymentCalled()
        {
            _fakeSalesController.MissingPaymentOnOrder().Returns(100);
            _uut.ViewProducts.Add(new SalesViewModel.ViewProduct("2", "Beer", "10"));
            var payment = _uut.PaytypeCommand;

            payment.Execute(PaymentType.Cash);
            _fakeSalesController.Received(1).StartPayment(100, Arg.Any <string>(), Arg.Any <PaymentType>());
        }
        public void StartPayment_ProductIsAddedToOrderExactAmountIsPayed_OrderDaoUpdateIsCalledTwice2()
        {
            var product = new Product("Beer", 18, true);

            _salesController.AddProductToOrder(product, 1, null);
            _salesController.StartPayment(10, "", PaymentType.Cash);
            _salesController.StartPayment(8, "", PaymentType.Cash);

            Assert.That(_salesController.MissingPaymentOnOrder(), Is.EqualTo(0));
        }
 public void SalesController_MissingPayment_OrderControllerMissingAmountIsCalled()
 {
     _uut.MissingPaymentOnOrder();
     _orderctrl.Received(1).MissingAmount();
 }
示例#4
0
        /// <summary>
        /// The logic for PaytypeCommand.
        /// </summary>
        /// <param name="paymentType"></param>
        private void PaytypeCommandExecute(PaymentType paymentType)
        {
            var amount = _salesController.MissingPaymentOnOrder();

            _salesController.StartPayment((int)amount, "", paymentType);
        }
        public void MissingPaymentOnOrder_CallsMissingAmountOnCurrentOrder_MissingAmountIsReturned()
        {
            var answer = _salesController.MissingPaymentOnOrder();

            Assert.AreEqual(_orderController.CurrentOrder.Total - _orderController.CurrentOrder.Transactions.Sum(t => t.Price), answer);
        }