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]); } }
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> (); }
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]); } }
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> (); }