private SpotCharterDomain.SpotCharter GetSpotCharter() { var spot = new SpotCharterDomain.SpotCharter(new SpotCharterDomain.Commands.CreateSpotCharter() { Login = login, CharterpartyDate = DateTime.Now, CharterpartyId = cpId1, CharterpartyName = counterparty1, VesselId = vesselId, VesselName = vesselName, MinimumQuantity = minimumQuantityStart }); spot.ChangeLaycan(new SpotCharterDomain.Commands.ChangeLaycan() { Login = login, Laycan = laycan }); spot.ChangeDemurrageRate(new SpotCharterDomain.Commands.ChangeDemurrageRate() { Login = login, DemurrageRate = demurrageRate }); spot.ChangeCharterparty(new SpotCharterDomain.Commands.ChangeCharterparty() { Login = login, CharterpartyId = cpId2, CharterpartyName = counterparty2 }); return(spot); }
public void CreateAggregateFromEventStream() { var eventStream = new List <IEvent <SpotCharterId> >() { new SpotCharterCreated(spotId, login, DateTime.Now, cpId1, counterparty1, vesselId, vesselName, minimumQuantityStart), new LaycanChanged(spotId, login, 2, laycan), new DemurrageRateChanged(spotId, login, 3, demurrageRate), new CharterpartyChanged(spotId, login, 4, cpId2, counterparty2), }; var spot = new SpotCharterDomain.SpotCharter(eventStream); Assert.Equal(spot.DemurrageRate, demurrageRate); Assert.Equal(spot.VesselName, vesselName); Assert.Equal(spot.Laycan, laycan); Assert.Equal(spot.Version, 4); }
void ICommandHandler <CreateSpotCharter> .Handle(CreateSpotCharter command) { var spot = new SpotCharter(command); this._repository.Save(spot); }