public void Create_new_period() { var periodCreator = new PeriodCreator(History.Empty); var period = periodCreator.Create(PeriodName.From(3, 2019)); period.PeriodName.Should().Be(PeriodName.From(3, 2019)); }
public async Task Handle(CreatePeriod command, CancellationToken cancellationToken) { PeriodCreator periodCreator; try { periodCreator = await _eventBroker.GetAggregate <PeriodCreator>(a => a is PeriodCreated); } catch (AggregateNotFoundException) { periodCreator = new PeriodCreator(History.Empty); } var period = periodCreator.Create(command.PeriodName); await _eventBroker.Publish(period.UncommittedEvents); }