public void Process(Credited @event) { var accountOverview = _entityContext.Entities.Where(a => a.AccountNumber == @event.AccountNumber).Single(); accountOverview.Balance -= @event.Amount; _entityContext.Save(accountOverview); _accountBalanceChanged(accountOverview.AccountNumber, accountOverview.Balance); }
public void Given_a_bank_account_when_credited_with_100_via_direct_handle_method_invocation_then_expect_100_as_a_balance() { var ba = new BankAccount(); var e = new Credited(100); Action<object, EventArgs> method; if (new HandleMethodFastInvocation(typeof(BankAccount)).TryGetMethod(e, out method)) method(ba, e); Assert.AreEqual(100, ba.Balance); }