public void AddingDependencyToServiceWithCustomDependency()
		{
			var k = new DefaultKernel();
			((IKernel)k).Register(Component.For(typeof(NeedClassWithCustomerDependency)).Named("NeedClassWithCustomerDependency"));
			((IKernel)k).Register(Component.For(typeof(HasCustomDependency)).Named("HasCustomDependency"));

			Assert.AreEqual(HandlerState.WaitingDependency, k.GetHandler("HasCustomDependency").CurrentState);

			var hash = new Dictionary<object, object>();
			hash["name"] = new CompA();
			k.RegisterCustomDependencies("HasCustomDependency", hash);
			Assert.AreEqual(HandlerState.Valid, k.GetHandler("HasCustomDependency").CurrentState);

			Assert.IsNotNull(k.Resolve(typeof(NeedClassWithCustomerDependency)));
		}
		public CompB(CompA ca, CompC cc, string myArgument)
		{
			compc = cc;
			this.myArgument = myArgument;
		}
		public HasCustomDependency(CompA name)
		{
			this.name = name;
		}
		public void AddingDependencyToServiceWithCustomDependency()
		{
			DefaultKernel k = new DefaultKernel();
			k.AddComponent("NeedClassWithCustomerDependency",typeof(NeedClassWithCustomerDependency));
			k.AddComponent("HasCustomDependency", typeof(HasCustomDependency));

			Assert.AreEqual(HandlerState.WaitingDependency, k.GetHandler("HasCustomDependency").CurrentState);

			Hashtable hash = new Hashtable();
			hash["name"] = new CompA();
			k.RegisterCustomDependencies("HasCustomDependency", hash);
			Assert.AreEqual(HandlerState.Valid, k.GetHandler("HasCustomDependency").CurrentState);

			Assert.IsNotNull(k.Resolve(typeof(NeedClassWithCustomerDependency)));
		}
Exemplo n.º 5
0
 public CompB(CompA ca, CompC cc, string myArgument)
 {
     compc           = cc;
     this.myArgument = myArgument;
 }
Exemplo n.º 6
0
 public HasCustomDependency(CompA name)
 {
     this.name = name;
 }