protected override void BeforeBuildingHandler() { base.BeforeBuildingHandler(); _storageMock = new Mock <IStorage>(); var persistenceConfigurationMock = new Mock <IPersistenceConfiguration>(); persistenceConfigurationMock.SetupGet(conf => conf.PersisterBatchSize).Returns(() => 100); _inMemoryMessageMatcher = new InMemoryMessageMatcher(persistenceConfigurationMock.Object, _storageMock.Object, Bus); _inMemoryMessageMatcher.Start(); MockContainer.Register <IInMemoryMessageMatcher>(_inMemoryMessageMatcher); }
public void Setup() { _batchSize = 1; _delay = null; _configurationMock = new Mock <IPersistenceConfiguration>(); _configurationMock.SetupGet(conf => conf.PersisterBatchSize).Returns(() => _batchSize); _configurationMock.SetupGet(conf => conf.PersisterDelay).Returns(() => _delay); _storageMock = new Mock <IStorage>(); _bus = new TestBus(); _matcher = new InMemoryMessageMatcher(_configurationMock.Object, _storageMock.Object, _bus); _storeBatchFunc = x => { }; _storageMock.Setup(x => x.Write(It.IsAny <IList <MatcherEntry> >())) .Returns <IList <MatcherEntry> >(items => Task.Run(() => _storeBatchFunc.Invoke(items))); }