Exemplo n.º 1
0
        public void TestIntListWithGenericType()
        {
            IList <string> injected = new List <string>();

            injected.Add("1");
            injected.Add("2");
            injected.Add("3");

            ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();

            cb.BindList <IntListClass.NamedIntList, int>(GenericType <IntListClass.NamedIntList> .Class, injected);

            IInjector    i = TangFactory.GetTang().NewInjector(cb.Build());
            IntListClass o = i.GetInstance <IntListClass>();

            IList <int> expected = new List <int>();

            expected.Add(1);
            expected.Add(2);
            expected.Add(3);
            o.Verify(expected);
        }
Exemplo n.º 2
0
        public void TestIntListWithNamedParameter()
        {
            ICsClassHierarchy   classH   = TangFactory.GetTang().GetDefaultClassHierarchy();
            INamedParameterNode np       = (INamedParameterNode)classH.GetNode(typeof(IntListClass.NamedIntList));
            IList <string>      injected = new List <string>();

            injected.Add("1");
            injected.Add("2");
            injected.Add("3");

            IConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();

            cb.BindList(np, injected);

            IInjector    i = TangFactory.GetTang().NewInjector(cb.Build());
            IntListClass o = i.GetInstance <IntListClass>();

            IList <int> expected = new List <int>();

            expected.Add(1);
            expected.Add(2);
            expected.Add(3);
            o.Verify(expected);
        }