public async Task Handle(OpenTask command) { var card = new CardAggregate(command.Id); card.OpenTask(command.Title); await _store.Save(card); }
public async Task SavesCardAggregateChangesToStream() { var cardId = RandomId(); var card = new CardAggregate(cardId); card.OpenTask("Test"); card.AssignTo("Jason Mitchell"); card.StartDevelopment(); var expectedChanges = card.GetChanges().ToArray(); await _aggregateStore.Save(card); var streamName = $"Card-{cardId}"; await _esdb.AssertStreamExists(streamName); await _esdb.AssertEvents(streamName, expectedChanges); }