Esempio n. 1
0
        public void PostCredit_when_has_exception_in_credit_operation()
        {
            //Arrange
            var id = 1;
            var checkingAccount = new CheckingAccount();
            var money           = new Money();

            _checkingAccountServiceMock.FindById(id).Returns(checkingAccount);
            _checkingAccountServiceMock
            .When(c => c.Credit(checkingAccount, money.Value))
            .Do(x => { throw new Exception(); });

            //Act
            var result = _checkingAccountController.PostCredit(id, money);

            //Assert
            Assert.IsType <BadRequestObjectResult>(result);
        }