private static IApplyEventsToStates BuildEventApplierFrom(ICollection <ApplierRetriever> appliers) { var applier = new EventApplier(); applier.SeedWith(appliers); return(applier); }
public void SetUp() { var commandHandlerFactory = Substitute.For <ICommandHandlerFactory>(); _commandHandlerProvider = new CommandHandlerProvider(commandHandlerFactory); _openTabCommandHandler = new OpenTabCommandHandler(); _commandHandlerProvider.RegisterCommandHandler(_openTabCommandHandler); CommandHandler = new TCommandHandler { Id = AggregateId }; CommandHandler2 = new TCommandHandler { Id = _aggregateId2 }; if (!CanUsePreregisteredCommandHandlersToHandleCommand()) { ConfigureCommandHandlerFactory(commandHandlerFactory); } _eventHandler = Substitute.For <IEventHandler>(); _commandRouter = new CommandRouter(_eventHandler, _commandHandlerProvider); _eventApplier = new EventApplier(new TypeInspector()); }
public void GivenAggregateWithHandleMethod_ShouldCallDefaultHandleMethod() { var aggregate = new TestAggregate(); EventApplier.Apply(aggregate, new TestEvent1()); EventApplier.Apply(aggregate, new TestEvent2()); Assert.True(aggregate.Event1Handled); Assert.True(aggregate.Event2Handled); }
public void Calls_apply_with_supplied_event() { var eventApplier = new EventApplier(new TypeInspector()); var testAggregate = new TestAggregate(); var testEvent = new TestEvent(); eventApplier.ApplyEvent(testEvent, testAggregate); Assert.That(testAggregate.AppliedEvent, Is.EqualTo(testEvent)); }
public void Apply(EventList events) { events.ForEach(x => EventApplier.Apply(this, x)); }
public void Setup() { _flag = A.Fake <IFlag>(); _eventApplier = new EventApplier <IGenericEvents>(); }
public void OnEvent(IEvent @event) { EventApplier.Apply(this, @event); }