CommandProcessor GetCommandProcessor(bool useCaching) { var eventStore = new MongoDbEventStore(_database, "events"); _timeTaker = new TimeTaker { InnerEventStore = eventStore, }; var serializer = new JsonDomainEventSerializer(); IAggregateRootRepository aggregateRootRepository = new DefaultAggregateRootRepository(_timeTaker, serializer, _domainTypeNameMapper); if (useCaching) { aggregateRootRepository = new CachingAggregateRootRepositoryDecorator(aggregateRootRepository, new InMemorySnapshotCache { ApproximateMaxNumberOfCacheEntries = 100 }, eventStore, serializer); } _timeTaker.InnerAggregateRootRepository = aggregateRootRepository; var eventDispatcher = new ViewManagerEventDispatcher(_timeTaker, eventStore, serializer, _domainTypeNameMapper); var commandProcessor = new CommandProcessor(_timeTaker, _timeTaker, eventDispatcher, serializer, _commandMapper, _domainTypeNameMapper, new Options()); RegisterForDisposal(commandProcessor); return commandProcessor; }
public void Method_Scenario_ExpectedResult() { using (var timeTaker = TimeTaker.Begin(TimeSpan.FromSeconds(1))) { // Execute methods which performance should get measured Thread.Sleep(100); timeTaker.End(Resources.IntegrationTests_Method_Scenario_ExpectedResult_executing__method__took_longer_than_expected_); } }