Example #1
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();
 }
Example #2
0
 public void ShouldNotFail()
 {
     var id = Guid.NewGuid();
     var eventPublisher = new InMemoryEventBus(new MessageRouterStub());
     var eventStore = new RavenEventStore(eventPublisher, "RavenDB");
     eventStore.DeleteCollection();
     var events = new List<IDomainEvent>
                      {
                          new ValidEvent(id),
                          new AnotherValidEvent(id),
                          new ValidEvent(id),
                          new AnotherValidEvent(id)
                      };
     eventStore.InsertBatchTest(events);
     var eventsFromStore = eventStore.GetEventsTest(id);
     foreach (var domainEvent in eventsFromStore)
     {
         events.Should().Contain(domainEvent);
     }
     
 }