public void TestBindIntNamedParam() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); cb.BindIntNamedParam <Int32Test.NamedInt>("8"); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); var o = i.GetInstance <Int32Test>(); o.Verify(8); }
public void TestObjectInjectWithInjectableSubclassesMultipleInstances() { IList <string> injected = new List <string>(); injected.Add(typeof(TestSetInjection.Integer1).AssemblyQualifiedName); injected.Add(typeof(TestSetInjection.Integer1).AssemblyQualifiedName); injected.Add(typeof(TestSetInjection.Float1).AssemblyQualifiedName); ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); cb.BindIntNamedParam <TestSetInjection.Integer1.NamedInt>("5"); cb.BindNamedParam <TestSetInjection.Float1.NamedFloat, float>("12.5"); cb.BindList <ListOfClasses, INumber>(injected); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); IList <INumber> actual = ((PoolListClass)i.GetInstance(typeof(PoolListClass))).Numbers; Assert.True(actual.Count == 3); Assert.True(actual.Contains(new TestSetInjection.Integer1(5))); Assert.True(actual.Contains(new TestSetInjection.Integer1(5))); Assert.True(actual.Contains(new TestSetInjection.Float1(12.5f))); }