public Specification() { var eventpublisher = new SpecEventPublisher(); var eventstorage = new SpecEventStorage(eventpublisher, Given().ToList()); var snapshotstorage = new SpecSnapShotStorage(Snapshot); var snapshotStrategy = new DefaultSnapshotStrategy(); var repository = new SnapshotRepository(snapshotstorage, snapshotStrategy, new Repository(eventstorage), eventstorage); Session = new Session(repository); Aggregate = GetAggregate().Result; var handler = BuildHandler(); handler.Handle(When()); Snapshot = snapshotstorage.Snapshot; PublishedEvents = eventpublisher.PublishedEvents; EventDescriptors = eventstorage.Events; }
public void Run() { var eventstorage = new SpecEventStorage(Given().ToList()); var snapshotstorage = new SpecSnapShotStorage(Snapshot); var eventpublisher = new SpecEventPublisher(); var snapshotStrategy = new DefaultSnapshotStrategy(); var repository = new SnapshotRepository(snapshotstorage, snapshotStrategy, new Repository(eventstorage, eventpublisher), eventstorage); Session = new Session(repository); Aggregate = Session.GetAsync <TAggregate>(Guid.Empty).Result; var handler = BuildHandler(); handler.HandleAsync(When()); Snapshot = snapshotstorage.Snapshot; PublishedEvents = eventpublisher.PublishedEvents; EventDescriptors = eventstorage.Events; }