public static JobsBuilder WithInMemoryBroker(this JobsBuilder jobs, InMemoryMessages messages = null) { jobs.RegisterInstance(messages ?? new InMemoryMessages()); jobs.RegisterSingleton <IMessagePublisher, InMemoryMessagePublisher>(); jobs.RegisterSingleton <IMessageConsumer, InMemoryMessageConsumer>(); return(jobs); }
public void TestInit() { _counter = new Counter(); _messages = new InMemoryMessages(); _timers = new List <TestTimer>(); _timeProvider = new TestTimeProvider(); JobsBuilder.Configure() .RegisterInstance(_settings) .RegisterInstance(_counter) .RegisterInstance <ITimeProvider>(_timeProvider) .RegisterScoped <ITimer>(f => { var timer = new TestTimer(); _timers.Add(timer); return(timer); }) .WithInMemoryBroker(_messages) .Build(); }