public HandlerTypeInvokerTests()
 {
     _di = Substitute.For<IContainerScope>();
     _err = Substitute.For<IFailedMessagesQueue>();
     _di.BeginLifetimeScope().Returns(_di);
     _handler=new MyHandler();
     _di.Resolve(typeof (MyHandler)).Returns(_handler);
     _sut =new HandlerTypeInvoker(typeof(MyHandler),_di,new BusAuditor(NullStorage.Instance), _err);
 }
        private void AddSagaEvent(Type handler, Type msg, EventHandlerSubscription sub)
        {
            var invoker = new HandlerTypeInvoker(handler, _container,_auditor,_error);
            SagaExecutor executor = null;
            if (msg.CanStartSaga(handler))
            {
                executor = new SagaStarterExecutor(invoker, _container);             
            }
            else
            {
                executor = new SagaExecutor(invoker, _container);
             
            }
            executor.UseCustomRepositories = _host.UseUserDefinedSagaRepos;
            sub.Add(executor);

        }