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);
        }
Ejemplo n.º 2
0
        public Spesification(ITestOutputHelper outputHelper)
        {
            History = Given();
            Command = When();

            var sut   = new TAggregate();
            var store = new SpecificationAggregateStore(sut);

            try
            {
                sut.Load(History);
                GetHandler(store)(Command).GetAwaiter().GetResult();
            }
            catch (Exception e)
            {
                CaughtException = e;
            }

            RaisedEvents = store.RaisedEvents;


            if (CaughtException != null)
            {
                outputHelper.WriteLine($"Error : {CaughtException.ToString()}");
            }

            Print(outputHelper);
        }
Ejemplo n.º 3
0
 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);
 public override Func <Contracts.Reviews.V1.ReviewCreate, Task> GetHandler(SpecificationAggregateStore store)
 {
     return(cmd => new ApplicationService(store).Handle(cmd));
 }
Ejemplo n.º 6
0
 public abstract Func <TCommand, Task> GetHandler(SpecificationAggregateStore store);