예제 #1
0
        public void TestGetSupply()
        {
            Type[] supplied = new Type[3];
            supplied [0] = typeof(HasANamedInjection);
            supplied [1] = typeof(HasANamedInjection2);
            supplied [2] = typeof(InjectsClassToBeInjected);
            int iterator = 0;

            Binder.BindingResolver resolver = delegate(IBinding bound)
            {
                object[] value = (bound as IInjectionBinding).GetSupply();
                Assert.AreEqual(value[value.Length - 1], supplied[iterator]);
            };

            InjectionBinding binding = new InjectionBinding(resolver);

            while (iterator < 3)
            {
                binding.SupplyTo(supplied[iterator]);
                iterator++;
            }

            object[] supply = binding.GetSupply();
            Assert.AreEqual(3, supply.Length);

            for (var a = 0; a < supply.Length; a++)
            {
                Assert.AreEqual(supply[a], supplied[a]);
            }
        }
예제 #2
0
        public void TestSupplyOne()
        {
            Binder.BindingResolver resolver = delegate(IBinding bound)
            {
                object[] value = (bound as IInjectionBinding).GetSupply();
                Assert.AreEqual(value[0], typeof(HasANamedInjection));
            };
            InjectionBinding binding = new InjectionBinding(resolver);

            binding.SupplyTo <HasANamedInjection> ();
        }
예제 #3
0
		public void TestGetSupply()
		{
			Type[] supplied = new Type[3];
			supplied [0] = typeof (HasANamedInjection);
			supplied [1] = typeof (HasANamedInjection2);
			supplied [2] = typeof (InjectsClassToBeInjected);
			int iterator = 0;

			Binder.BindingResolver resolver = delegate (IBinding bound)
			{
				object[] value = (bound as IInjectionBinding).GetSupply();
				Assert.AreEqual(value[value.Length-1], supplied[iterator]);
			};

			InjectionBinding binding = new InjectionBinding (resolver);

			while (iterator < 3)
			{
				binding.SupplyTo (supplied[iterator]);
				iterator++;
			}

			object[] supply = binding.GetSupply ();
			Assert.AreEqual (3, supply.Length);

			for (var a = 0; a < supply.Length; a++)
			{
				Assert.AreEqual (supply[a], supplied[a]);
			}
		}
예제 #4
0
		public void TestSupplyOne()
		{
			Binder.BindingResolver resolver = delegate (IBinding bound)
			{
				object[] value = (bound as IInjectionBinding).GetSupply();
				Assert.AreEqual(value[0], typeof(HasANamedInjection));
			};
			InjectionBinding binding = new InjectionBinding (resolver);
			binding.SupplyTo<HasANamedInjection> ();
		}