コード例 #1
0
        public void TestBoolListWithGenericType()
        {
            IList <string> injected = new List <string>();

            injected.Add("true");
            injected.Add("false");
            injected.Add("true");

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

            cb.BindList <BoolListClass.NamedBoolList, bool>(GenericType <BoolListClass.NamedBoolList> .Class, injected);

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

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

            expected.Add(true);
            expected.Add(false);
            expected.Add(true);
            o.Verify(expected);
        }
コード例 #2
0
        public void TestBoolListWithNamedParameter()
        {
            ICsClassHierarchy   classH   = TangFactory.GetTang().GetDefaultClassHierarchy();
            INamedParameterNode np       = (INamedParameterNode)classH.GetNode(typeof(BoolListClass.NamedBoolList));
            IList <string>      injected = new List <string>();

            injected.Add("true");
            injected.Add("false");
            injected.Add("true");

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

            cb.BindList(np, injected);

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

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

            expected.Add(true);
            expected.Add(false);
            expected.Add(true);
            o.Verify(expected);
        }