public void SetUp()
        {
            _cashPayment = new CashPayment();
            _nets        = Substitute.ForPartsOf <Nets>();
            _nets.When(x => x.TransferAmount(Arg.Any <int>(), Arg.Any <string>())).DoNotCallBase();
            _nets.TransferAmount(Arg.Any <int>(), Arg.Any <string>()).Returns(false);

            _paymentProviders = new List <IPaymentProvider> {
                _cashPayment, _nets
            };

            _fakePaymentDao        = Substitute.For <IPaymentDao>();
            _fakeReceiptController = Substitute.For <IReceiptController>();
            _fakeCashDrawer        = Substitute.For <ICashDrawer>();
            _fakeCashDrawer.CashChange.Returns(1000);

            _uut = new PaymentController(_paymentProviders, _fakeReceiptController, _fakePaymentDao, _fakeCashDrawer);

            _cashTransaction = new Transaction()
            {
                Description = "noget",
                PaymentType = PaymentType.Cash,
                Price       = 100,
            };

            _netTransaction = new Transaction()
            {
                Description = "noget",
                PaymentType = PaymentType.Nets,
                Price       = 100,
            };
        }
Example #2
0
 public void TransferAmount_ATransferOf100IsMade_RevenueIsUpdated()
 {
     _uut.TransferAmount(100, "Initial payment");
     Assert.That(_uut.Revenue, Is.EqualTo(100));
 }
        public void SetUp()
        {
            _cashPayment = new CashPayment();
            _nets = Substitute.ForPartsOf<Nets>();
            _nets.When(x => x.TransferAmount(Arg.Any<int>(), Arg.Any<string>())).DoNotCallBase();
            _nets.TransferAmount(Arg.Any<int>(), Arg.Any<string>()).Returns(false);

            _paymentProviders = new List<IPaymentProvider> {_cashPayment, _nets};

            _fakePaymentDao = Substitute.For<IPaymentDao>();
            _fakeReceiptController = Substitute.For<IReceiptController>();
            _fakeCashDrawer = Substitute.For<ICashDrawer>();
            _fakeCashDrawer.CashChange.Returns(1000);

            _uut = new PaymentController(_paymentProviders, _fakeReceiptController, _fakePaymentDao, _fakeCashDrawer);

            _cashTransaction = new Transaction()
            {

                Description = "noget",
                PaymentType = PaymentType.Cash,
                Price = 100,
            };

            _netTransaction = new Transaction()
            {
                Description = "noget",
                PaymentType = PaymentType.Nets,
                Price = 100,
            };
        }