static IEnumerable <IEvent> Execute(ICollection <IEvent> given, Expression <Action <FactoryAggregate> > when) { if (given.Count == 0) { Console.WriteLine("Given no events"); } foreach (var @event in given) { Console.WriteLine("Given: " + @event); } var customer = new FactoryAggregate(new FactoryState(given)); PrintWhen(when); when.Compile()(customer); return(customer.EventsThatHappened); }
static IEnumerable<IEvent> Execute(ICollection<IEvent> given, Expression<Action<FactoryAggregate>> when) { if (given.Count == 0) Console.WriteLine("Given no events"); foreach (var @event in given) { Console.WriteLine("Given: " + @event); } var customer = new FactoryAggregate(new FactoryState(given)); PrintWhen(when); when.Compile()(customer); return customer.EventsThatHappened; }