コード例 #1
0
        public async Task Should_not_take_snapshot_below_custom_frequency()
        {
            //Arrange
            var snapshotStore = Mock.Of <ISnapshotStore>();
            var options       = new EventSourcingOptions {
                DefaultSnapshotVersionFrequency = 10
            };
            var sut = new EventSourcedRepository <TestSnapshotAggregateRoot>(Mock.Of <IEventStore>(), snapshotStore, Mock.Of <IMediator>(), options, Mock.Of <ILogger <EventSourcedRepository <TestSnapshotAggregateRoot> > >());

            var domainEvent  = Mock.Of <object>();
            var domainEvents = new List <object> {
                domainEvent
            };
            var testAggregate = new TestSnapshotAggregateRoot(Guid.NewGuid(), 2, 1, 2, domainEvents);

            //Act
            await sut.SaveAsync(testAggregate, CancellationToken.None);

            //Assert
            Mock.Get(snapshotStore)
            .Verify(
                x => x.StoreSnapshotAsync(It.IsAny <SnapshotEnvelope>(), It.IsAny <CancellationToken>()),
                Times.Never);
        }
コード例 #2
0
ファイル: EventSourcedRepository.cs プロジェクト: hfz-r/nbb
 public EventSourcedRepository(IEventStore eventStore, ISnapshotStore snapshotStore, IMediator mediator, EventSourcingOptions eventSourcingOptions, ILogger <EventSourcedRepository <TAggregateRoot> > logger)
 {
     _eventStore           = eventStore;
     _snapshotStore        = snapshotStore;
     _mediator             = mediator;
     _eventSourcingOptions = eventSourcingOptions;
     _logger = logger;
 }
コード例 #3
0
 public ReplayManager(IStreamStoreFactory streamStoreFactory, EventSourcingOptions options, ILogger <ReplayManager> logger)
 {
     _streamStoreFactory = streamStoreFactory ?? throw new ArgumentNullException(nameof(streamStoreFactory));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
     _options            = options ?? throw new ArgumentNullException(nameof(options));
 }
コード例 #4
0
 public EventSourcingOptionsBuilder()
 {
     Options = new EventSourcingOptions();
 }