コード例 #1
0
        public void Save_WithConcurrencyConflict_ThrowsConcurrencyConflictOccurredException()
        {
            // Arrange
            var stubInMemoryEventStore = new InMemoryEventStore();
            var stubGuid      = Guid.NewGuid();
            var mockEventList = new ArrayList()
            {
                new Event1(), new Event2()
            };

            // Act
            Action saveConcurrencyConflict = () => stubInMemoryEventStore
                                             .Save(new AdditionalEvents(stubGuid, mockEventList, 2));

            // Assert
            Assert.Throws <ConcurrencyConflictOccurred>(saveConcurrencyConflict);
        }
コード例 #2
0
        public void LoadEventsFor_SavedEventsWithSameGUID_ReturnsSavedEvents()
        {
            // Arrange
            var stubInMemoryEventStore = new InMemoryEventStore();
            var stubGuid      = Guid.NewGuid();
            var mockEventList = new ArrayList()
            {
                new Event1(), new Event2()
            };

            stubInMemoryEventStore.Save(
                new AdditionalEvents(stubGuid, mockEventList));

            // Act
            var loadedEvents = stubInMemoryEventStore.LoadEventsFor(stubGuid);

            // Assert
            Assert.Equal(mockEventList, loadedEvents);
        }
コード例 #3
0
 public RepoBuilder()
 {
     this.store          = new InMemoryEventStore();
     this.eventPublisher = new Mock <IAggregateEventPublisher>();
 }