private QuizAggregate ExecuteCommand(Action <QuizAggregate> command) { var quizId = Guid.NewGuid(); var quiz = QuizAggregate.Create(quizId); command(quiz); return(quiz); }
private async Task <QuizAggregate> CreateAggregate(IDocumentSession session, Guid quizId) { var events = (await session.Events.FetchStreamAsync(quizId)).Select(@event => @event.Data).ToArray(); return(QuizAggregate.Create(quizId, events)); }