public void When(EnergySupplierChangeRegistered @event) { switch (_state) { case State.NotStarted: _processId = @event.ProcessId; _effectiveDate = @event.EffectiveDate; SetInternalState(State.AwaitingConfirmationMessageDispatch); SendCommand(new SendConfirmationMessage(_processId)); break; default: ThrowIfStateDoesNotMatch(@event); break; } }
public void EnergySupplierChangeIsRegistered_WhenStateIsNotStarted_ConfirmationMessageIsSend() { var processManager = Create(); var(processId, gsrnNumber, effectiveDate) = CreateTestValues(); var @event = new EnergySupplierChangeRegistered(gsrnNumber, processId, effectiveDate); processManager.When(@event); var command = processManager.CommandsToSend.First(c => c.Command is SendConfirmationMessage).Command as SendConfirmationMessage; Assert.NotNull(command); }