Beispiel #1
0
        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);
        }
Beispiel #2
0
        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;
        }