Exemple #1
0
        public void UserPanel_NewPayment_Throw_Exception_If_Not_Enough_Money()
        {
            var senderBankAccount    = new BankAccount(Guid.NewGuid(), 1000);
            var recipientBankAccount = new BankAccount(Guid.NewGuid(), 1000);
            var paymentModel         = new NewPaymentViewModel()
            {
                Amount = 2000
            };

            _repository.GetBankAccount(Arg.Any <Guid>()).Returns(senderBankAccount);
            _repository.GetUserBankAccount(Arg.Any <string>()).Returns(recipientBankAccount);

            var viewResult = _userPanelController.NewPayment(paymentModel) as ViewResult;
        }
Exemple #2
0
        public void UserPanel_NewPayment_Throw_Exception_If_Not_Enough_Money()
        {
            var senderBankAccount    = new BankAccount(Guid.NewGuid(), 1000);
            var recipientBankAccount = new BankAccount(Guid.NewGuid(), 1000);
            var paymentModel         = new NewPaymentViewModel()
            {
                Amount = 2000
            };

            _repository.GetBankAccount(Arg.Any <Guid>()).Returns(senderBankAccount);
            _repository.GetUserBankAccount(Arg.Any <string>()).Returns(recipientBankAccount);

            Assert.Throws <ArgumentOutOfRangeException>(() => _userPanelController.NewPayment(paymentModel));
            Assert.Catch <ArgumentOutOfRangeException>(() => _userPanelController.NewPayment(paymentModel));
            Assert.That(() => _userPanelController.NewPayment(paymentModel), Throws.TypeOf <ArgumentOutOfRangeException>());
        }