public void Setup() { _aggregate = new StubAggregate(); var aggregateId = Guid.NewGuid(); var events = new List<IDomainEvent>(); for (int i = 0; i < 5; i++) { var validEvent = new ValidEvent(aggregateId); validEvent.EventNumber = i; events.Add(validEvent); } _aggregate.LoadAggregate(events); }
protected override void Given() { _stubEventBus = new InMemoryEventBus(new MessageRouterStub()); _publishedEvents = new List<IDomainEvent>(); _stubEventBus.EventPublished = (y) => _publishedEvents.Add(y); _eventStore = new StubEventStore(_stubEventBus); _aggregate = new StubAggregate(); _aggregate.DoThis(); _aggregate.DoSomethingElse(); _aggregate.DoThis(); _aggregate.DoSomethingElse(); _eventStore.Insert(_aggregate); _eventStore.Commit(); }
public void Setup() { // Arrange _eventPublisher = new InMemoryEventBus(new MessageRouterStub()); var eventStore = new RavenEventStore(_eventPublisher, "RavenDB"); eventStore.DeleteCollection(); _aggregate = new StubAggregate(); _aggregate.AggregateId = Guid.NewGuid(); _aggregate.DoThis(); _aggregate.DoSomethingElse(); _aggregate.DoThis(); _aggregate.DoSomethingElse(); _aggregateId = _aggregate.AggregateId; eventStore.Insert(_aggregate); eventStore.Commit(); }
public void Setup() { // Arrange _eventPublisher = new InMemoryEventBus(new MessageRouterStub()); var mongoConfig = new MongoConfiguration() { DatabaseName = "EventTestDB" }; var eventStore = new MongoEventStore(mongoConfig, _eventPublisher); eventStore.DeleteCollection(); _aggregate = new StubAggregate(); _aggregate.AggregateId = Guid.NewGuid(); _aggregate.DoThis(); _aggregate.DoSomethingElse(); _aggregate.DoThis(); _aggregate.DoSomethingElse(); _aggregateId = _aggregate.AggregateId; eventStore.Insert(_aggregate); eventStore.Commit(); }
public void Setup() { _aggregate = new StubAggregate(); }
protected override void Given() { var eventBus = new InMemoryEventBus(new MessageRouterStub()); var eventStore = new StubEventStore(eventBus); var events = new List<IDomainEvent>(); events.Add(new ValidEvent(Guid.Empty) { EventNumber = 0 }); events.Add(new AnotherValidEvent(Guid.Empty) { EventNumber = 1 }); events.Add(new ValidEvent(Guid.Empty) { EventNumber = 2 }); events.Add(new AnotherValidEvent(Guid.Empty) { EventNumber = 3 }); eventStore.InsertEvents(events); _aggregate = eventStore.Get<StubAggregate>(Guid.Empty); }
protected override void Given() { var stubUnitOfWork = new InMemoryEventBus(new MessageRouterStub()); var eventStore = new StubEventStore(stubUnitOfWork); _aggregate = eventStore.Get<StubAggregate>(Guid.Empty); }