public Spesification(ITestOutputHelper outputHelper) { History = Given(); Command = When(); var sut = new TAggregate(); var store = new SpecificationAggregateStore(sut); var snapshotStore = new SpesificationAggregateSnapshotStore(); try { sut.Load(History); GetHandler(store, snapshotStore)(Command).GetAwaiter().GetResult(); } catch (Exception e) { CaughtException = e; } RaisedEvents = store.RaisedEvents; Snapshots = snapshotStore.GetSnapshotAsync <TAggregate>(null, sut.Id).Result; if (Snapshots != null) { outputHelper.WriteLine($"Snapshot:{Snapshots.AggregateId},{Snapshots.Version}"); } if (CaughtException != null) { outputHelper.WriteLine($"Error : {CaughtException.ToString()}"); } Print(outputHelper); }
public override Func <Contracts.Reviews.V1.UpdateReview, Task> GetHandler(SpecificationAggregateStore store, SpesificationAggregateSnapshotStore snapshotStore) { return(cmd => new ApplicationService(new Repository(store, null)).Handle(cmd)); }
public abstract Func <TCommand, Task> GetHandler(SpecificationAggregateStore store, SpesificationAggregateSnapshotStore snapshotStores);