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(); }
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; }
public abstract Func <TCommand, Task> GetHandler(SpecificationAggregateStore store);
public override Func <Contracts.ClassifiedAds.V1.Register, Task> GetHandler(SpecificationAggregateStore store) => cmd => new ClassifiedAdsApplicationService( store, () => DateTimeOffset.MinValue, _ => Task.FromResult(false) ).Handle(cmd);
public override Func <ClassifiedAds.V1.RenameAd, Task> GetHandler(SpecificationAggregateStore store) => cmd => new ClassifiedAdsApplicationService(store).Handle(cmd);
public override Func <RenameAd, Task> GetHandler(SpecificationAggregateStore store) => cmd => new ClassifiedAdsApplicationService(store: store, getUtcNow: () => DateTimeOffset.MinValue, checkTextForProfanity: _ => Task.FromResult(false)).Handle(cmd);