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); }
public IActionResult WithdrawAmount(WithdrawAmountModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _bankAccountApplicationService.Withdraw(model); return(Ok()); }