public OverdueFineCalculationExecutionPolicyManager EstablishLoan() { TestBusInitializer.Initialize(); _dueDate = DateTime.Today.AddDays(DefaultLoanTermDays); _loanDuePolicySagaTester = Test.Saga <OverdueFineAccumulationPolicy>(); return(this); }
public void ShouldSetLoanIdOnState() { TestBusInitializer.Initialize(); var saga = new OverdueFineAccumulationPolicy(); Test.Saga(saga); saga.Handle(Test.CreateInstance <LoanConsumatedEvent>(theEvent => { theEvent.LoanId = _loanId; theEvent.DueDate = DateTime.Today; })); saga.Data.LoanId.ShouldEqual(_loanId); }
public void Setup() { TestBusInitializer.Initialize(); _handler = Test.Handler(bus => new CalculateFineCommandHandler(bus, new FineCalculator())); _handler .ExpectPublish <FineCalculatedEvent>(theEvent => { _resultingEvent = theEvent; return(true); }) .OnMessage <CalculateFineCommand>(command => { command.LoanId = _loanId; command.DaysOverdue = 5; }); }