public void WhenTransactionCreditAndDebtThenAccountSaldoAndTurnoverAreOk() { var acc = new Account("root"); acc.TransactCredit(10.0m); acc.TransactDebt(5.0m); Assert.AreEqual(10.0m, acc.CreditTurnover); Assert.AreEqual(5.0m, acc.DebtTurnover); Assert.AreEqual(15.0m, acc.GetTurnover()); Assert.AreEqual(5.0, acc.GetBalance()); }
public void WhenTransactionDebtOrCreditThenEventGenerated() { TurnoverEvent @event = null; Container.Resolve<IDomainEventBus>() .RegisterThreaded<TurnoverEvent>(x => { @event = x; }); var acc = new Account("root"); acc.TransactDebt(0.0m); Assert.IsNotNull(@event); Assert.AreEqual(TurnoverType.Debt, @event.TurnoverType); acc.TransactCredit(0.0m); Assert.IsNotNull(@event); Assert.AreEqual(TurnoverType.Credit, @event.TurnoverType); }