Inheritance: IMongoConfiguration
示例#1
0
 public void And_All_Events_Should_Be_Applied_When_Loading_From_EventStore_In_The_Right_Order()
 {
     var mongoConfig = new MongoConfiguration()
     {
         DatabaseName = "EventTestDB"
     };
     var eventStore = new MongoEventStore(mongoConfig, _eventPublisher);
     var loadedAggregate = eventStore.Get<StubAggregate>(_aggregateId);
     var appliedEvents = loadedAggregate.EventsTriggered;
     appliedEvents.Count.Should().Be(4);
     for (int i = 0; i < appliedEvents.Count; i++ )
     {
         appliedEvents[i].EventNumber.Should().Be(i);
         if (i % 2 == 0)
             appliedEvents[i].GetType().Should().Be(typeof(ValidEvent));
         else
             appliedEvents[i].GetType().Should().Be(typeof (AnotherValidEvent));
     }
 }
示例#2
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();
 }