Esempio n. 1
0
        public void SimpleInjectorResolveSingleInstance()
        {
            var container  = new global::SimpleInjector.Container();
            var registered = new Registered();

            container.RegisterSingle(typeof(Registered), registered);

            var resolver = new SimpleInjectorDependencyResolver(container);

            var resolved = resolver.GetInstance(typeof(Registered));

            Assert.That(resolved, Is.EqualTo(registered));
        }
Esempio n. 2
0
        public RabbitMQIntegrationModule(global::SimpleInjector.Container container)
        {
            container.Register <IRabbitBus, RabbitBus>(SimpleInjector.Lifestyle.Transient);

            var handler = DefineBusHandler();

            IBus bus = RabbitHutch.CreateBus(ConfigHelper.ConnectionString, handler, serviceRegister => serviceRegister
                                             .Register <IEasyNetQLogger, QueueLogManager>()
                                             .Register <IConsumerErrorStrategy, ErrorStrategy>());

            container.RegisterSingle <IBus>(bus);

            this.container = container;
        }
Esempio n. 3
0
	    public void SimpleInjectorResolveSingleInstance()
	    {
		    var container = new global::SimpleInjector.Container();
		    var registered = new Registered();
			container.RegisterSingle(typeof(Registered), registered);

		    var resolver = new SimpleInjectorDependencyResolver(container);
		    
			var resolved = resolver.GetInstance(typeof (Registered));

			Assert.That(resolved, Is.EqualTo(registered));
	    }