예제 #1
0
        public void Run()
        {
            var eventstorage     = new SpecEventStorage(Given().ToList());
            var snapshotstorage  = new SpecSnapShotStorage(Snapshot);
            var eventpublisher   = new SpecEventPublisher();
            var snapshotStrategy = new DefaultSnapshotStrategy();

            Repository = new Repository <TAggregate>(eventstorage, snapshotstorage, eventpublisher, snapshotStrategy);

            Aggregate = Repository.Get(Guid.Empty);

            var handler = BuildHandler();

            handler.Handle(When());

            Snapshot         = snapshotstorage.Snapshot;
            PublishedEvents  = eventpublisher.PublishedEvents;
            EventDescriptors = eventstorage.Events;
        }
예제 #2
0
        public void Run()
        {
            var version = 0;
            IList <EventDescriptor> descriptors = Given().Select(@event => new EventDescriptor(@event.Id, @event, version++)).ToList();
            var eventstorage    = new SpecEventStorage(descriptors);
            var snapshotstorage = new SpecSnapShotStorage(Snapshot);
            var eventpublisher  = new SpecEventPublisher();

            Repository = new Repository <TAggreagate>(eventstorage, snapshotstorage, eventpublisher);

            Aggregate = Repository.Get(Guid.Empty);

            var handler = BuildHandler();

            handler.Handle(When());

            Snapshot         = snapshotstorage.Snapshot;
            PublishedEvents  = eventpublisher.PublishedEvents;
            EventDescriptors = eventstorage.Descriptors;
        }