コード例 #1
0
        public Specification(ITestOutputHelper output)
        {
            _output = output;

            History = Given();

            Command = When();

            var sut = new TAggregate();

            sut.Load(History);

            var store = SpecificationAggregateStore.For(sut);

            try
            {
                GetHandler(store)(Command).GetAwaiter().GetResult();
            }
            catch (Exception exception)
            {
                CaughtException = exception;
            }

            RaisedEvents = store.RaisedEvents;

            Print();
        }
コード例 #2
0
        public Specification()
        {
            History = Given();
            Command = When();

            var sut = new TAggregate();

            sut.Load(History);
            var store = SpecificationAggregateStore.For(sut);

            try
            {
                GetHandler(store)(Command).Wait();
            }
            catch (Exception exception)
            {
                CaughtException = exception;
            }

            RaisedEvents = store.RaisedEvents;
        }
コード例 #3
0
 public abstract Func <TCommand, Task> GetHandler(SpecificationAggregateStore store);
コード例 #4
0
 public override Func <Contracts.ClassifiedAds.V1.Register, Task> GetHandler(SpecificationAggregateStore store)
 => cmd => new ClassifiedAdsApplicationService(
     store,
     () => DateTimeOffset.MinValue,
     _ => Task.FromResult(false)
     ).Handle(cmd);
コード例 #5
0
 public override Func <ClassifiedAds.V1.RenameAd, Task> GetHandler(SpecificationAggregateStore store)
 => cmd => new ClassifiedAdsApplicationService(store).Handle(cmd);
コード例 #6
0
 public override Func <RenameAd, Task> GetHandler(SpecificationAggregateStore store)
 => cmd => new ClassifiedAdsApplicationService(store: store,
                                               getUtcNow: () => DateTimeOffset.MinValue,
                                               checkTextForProfanity: _ => Task.FromResult(false)).Handle(cmd);