public void can_apply_credit() { var accountId = Guid.NewGuid(); var correlationId = Guid.NewGuid(); Bus.Fire( new CreateAccount( accountId, "NewAccount", correlationId, null), responseTimeout: TimeSpan.FromMilliseconds(3000)); const double amountCredited = 123.45; Bus.Fire(new ApplyCredit( accountId, amountCredited, correlationId, Guid.Empty), responseTimeout: TimeSpan.FromSeconds(60)); BusCommands.DequeueNext <CreateAccount>(); RepositoryEvents.DequeueNext <AccountCreated>(); BusCommands.AssertNext <ApplyCredit>(correlationId, out var cmd) .AssertEmpty(); RepositoryEvents.AssertNext <CreditApplied>(correlationId, out var evt) .AssertEmpty(); Assert.Equal(amountCredited, evt.Amount); }
public void dropdown_determines_credit_or_debit() { var vm = new MainWindowViewModel(Bus, null, _accountId) { Amount = 100 }; vm.CreditOrDebitSelection = "Debit"; vm.AddCreditOrDebitCommand.Execute(); Assert.IsType <ApplyDebit>(BusCommands.First()); vm.CreditOrDebitSelection = "Credit"; vm.AddCreditOrDebitCommand.Execute(); Assert.IsType <ApplyCredit>(BusCommands.Skip(1).First()); }
public void can_apply_debit() { const double amountDebited = 123.45; Bus.Fire(new ApplyDebit( _accountId, amountDebited, _correlationId, Guid.Empty), responseTimeout: TimeSpan.FromSeconds(60)); BusCommands.AssertNext <ApplyDebit>(_correlationId, out var cmd) .AssertEmpty(); RepositoryEvents.AssertNext <DebitApplied>(_correlationId, out var evt) .AssertEmpty(); Assert.Equal(amountDebited, evt.Amount); }
public void can_create_account() { var accountId = Guid.NewGuid(); var correlationId = Guid.NewGuid(); Bus.Fire( new CreateAccount( accountId, "NewAccount", correlationId, null), responseTimeout: TimeSpan.FromMilliseconds(1500)); BusCommands.AssertNext <CreateAccount>(correlationId, out var cmd) .AssertEmpty(); RepositoryEvents.AssertNext <AccountCreated>(correlationId, out var evt) .AssertEmpty(); Assert.Equal(accountId, evt.AccountId); }