상속: ISubDependencyResolver
예제 #1
0
		public void WillAskResolverWhenTryingToResolveDependencyAfterAnotherHandlerWasRegistered()
		{
			FooBarResolver resolver = new FooBarResolver();

			IKernel kernel = new DefaultKernel();
			kernel.Resolver.AddSubResolver(resolver);

			kernel.AddComponent("foo", typeof(Foo));
			IHandler handler = kernel.GetHandler("foo");
			Assert.AreEqual(HandlerState.WaitingDependency, handler.CurrentState);

			resolver.Result = 15;

			kernel.RaiseHandlerRegistered(null);//should force reevaluation of state

			Assert.AreEqual(HandlerState.Valid, handler.CurrentState);
		}
예제 #2
0
		public void WillAskResolverWhenTryingToResolveDependencyAfterAnotherHandlerWasRegistered()
		{
			var resolver = new FooBarResolver();

			IKernel kernel = new DefaultKernel();
			kernel.Resolver.AddSubResolver(resolver);

			kernel.Register(Component.For<Foo>());
			var handler = kernel.GetHandler(typeof(Foo));

			Assert.AreEqual(HandlerState.WaitingDependency, handler.CurrentState);

			resolver.Result = 15;

			kernel.Register(Component.For<A>());

			Assert.AreEqual(HandlerState.Valid, handler.CurrentState);
		}
예제 #3
0
        public void WillAskResolverWhenTryingToResolveDependencyAfterAnotherHandlerWasRegistered()
        {
            var resolver = new FooBarResolver();

            IKernel kernel = new DefaultKernel();

            kernel.Resolver.AddSubResolver(resolver);

            kernel.Register(Component.For <Foo>());
            var handler = kernel.GetHandler(typeof(Foo));

            Assert.AreEqual(HandlerState.WaitingDependency, handler.CurrentState);

            resolver.Result = 15;

            kernel.Register(Component.For <A>());

            Assert.AreEqual(HandlerState.Valid, handler.CurrentState);
        }