コード例 #1
0
        public void Withdraw_WhenAmountLessThanBalance_BalanceDecreasesWithTheAmount()
        {
            //arrange
            _context.Accounts.Add(new Account()
            {
                Balance = 12, Id = 1
            });
            _context.SaveChanges();

            //act
            _sut.Withdraw(new WithdrawAmountModel()
            {
                Amount = 5,
                Id     = 1
            });

            //assert
            _context.Accounts.Find(1).Balance.Should().Be(7);
        }
コード例 #2
0
        public IActionResult WithdrawAmount(WithdrawAmountModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _bankAccountApplicationService.Withdraw(model);

            return(Ok());
        }