Inheritance: AggregateRoot
Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
 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();
 }
Esempio n. 4
0
 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();
 }
Esempio n. 5
0
 public void Setup()
 {
     _aggregate = new StubAggregate();
 }
Esempio n. 6
0
 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);
 }
Esempio n. 7
0
 protected override void Given()
 {
     var stubUnitOfWork = new InMemoryEventBus(new MessageRouterStub());
     var eventStore = new StubEventStore(stubUnitOfWork);
     _aggregate = eventStore.Get<StubAggregate>(Guid.Empty);
 }