public void TransferMoney_LowBalanceSendNotification_Suscessfully() { Account toAccount = new Account(Guid.NewGuid(), new User(Guid.NewGuid(), "alice", "*****@*****.**"), 100m, 90m, 0m); Account fromAccount = new Account(Guid.NewGuid(), new User(Guid.NewGuid(), "bob", "*****@*****.**"), toAccount.NotificationThresold, 80m, 0m); toAccount.TransferMoney(fromAccount, 150); AggregateTest.AssertSingleDomainEvent <AccountWithdrawnDomainEvent>(fromAccount, x => { Assert.Equal(150m, x.Amount); Assert.Equal(fromAccount, x.Account); }); AggregateTest.AssertSingleDomainEvent <FundsLowDomainEvent>(fromAccount, x => { Assert.Equal(fromAccount, x.Account); }); /* * Assert.Collection(fromAccount.DomainEvents, * x => Assert.Equal(typeof(AccountWithdrawnDomainEvent), x.GetType()), * x => Assert.Equal(typeof(FundsLowDomainEvent), x.GetType()));*/ }
public void TransferMoney_ApprocahingPaidInSendNotification_Suscessfully() { Account fromAccount = new Account(Guid.NewGuid(), new User(Guid.NewGuid(), "bob", "*****@*****.**"), 80m, 80m, 0m); Account toAccount = new Account(Guid.NewGuid(), new User(Guid.NewGuid(), "alice", "*****@*****.**"), 100m, 90m, fromAccount.PayInLimit - 10); toAccount.TransferMoney(fromAccount, 5); AggregateTest.AssertSingleDomainEvent <AccountPaidInDomainEvent>(toAccount, x => { Assert.Equal(5m, x.Amount); Assert.Equal(toAccount, x.Account); }); AggregateTest.AssertSingleDomainEvent <ApproachingPayInLimitDomainEvent>(toAccount, x => { Assert.Equal(toAccount, x.Account); }); /* * Assert.Collection(toAccount.DomainEvents, * x => Assert.Equal(typeof(AccountPaidInDomainEvent), x.GetType()), * x => Assert.Equal(typeof(ApproachingPayInLimitDomainEvent), x.GetType())); */ }