public void Execute_WithdrawDeposit_FromAccountUpdated() { var fromAccount = new Account() { Id = Guid.NewGuid(), Balance = 1000m }; var toAccount = new Account() { Id = Guid.NewGuid(), Balance = 0m }; var mock = MockingHelper.GetAccountRepositoryMock( new List <Account>() { fromAccount, toAccount }); var transfer = new TransferMoney(mock.Object); transfer.Execute(fromAccount.Id, toAccount.Id, 100); mock.Verify(m => m.Update(It.Is <Account>(a => a.Id.Equals(fromAccount.Id) && a.Balance == 900m)), Times.AtLeastOnce); }
public void Execute_Withdraw_FromAccountUpdated() { var account = new Account() { Id = Guid.NewGuid(), Balance = 1000m }; var mock = MockingHelper.GetAccountRepositoryMock( new List <Account>() { account }); var withdraw = new WithdrawMoney(mock.Object); withdraw.Execute(account.Id, 100m); mock.Verify(m => m.Update(It.Is <Account>(a => a.Id.Equals(account.Id) && a.Balance == 900m)), Times.AtLeastOnce); }