public void GenerateType_Interface_ConfigInfo()
        {
            ProxyGenerator proxy = new ProxyGenerator("XLY.Framework.UnitTest", "XLY.Framework.UnitTest.ConfigInfo");

            proxy.InheritInterface <IA>();
            proxy.InheritInterface <IB>();
            proxy.AppendProperty("Name", typeof(string));
            proxy.AppendProperty("Summary", typeof(string));
            var type = proxy.GenerateType();
            var obj  = Activator.CreateInstance(type);
            var a    = obj as IA;

            Assert.IsNotNull(a);

            var b = obj as IB;

            Assert.IsNotNull(b);

            a.Name = "123;";
            System.Utility.Helper.Reflection.SettingObjectValue(obj, "Name", "xiaoming");
            Assert.IsTrue(a.Name == "xiaoming");

            System.Utility.Helper.Reflection.SettingObjectValue(obj, "Summary", "ok123");
            dynamic dobj = obj;

            Assert.IsTrue(dobj.Summary == "ok123");
        }
        public void GenerateType_ConfigInfo()
        {
            ProxyGenerator proxy = new ProxyGenerator("XLY.Framework.UnitTest", "XLY.Framework.UnitTest.ConfigInfo");

            proxy.AppendProperty("Name", typeof(string));
            proxy.AppendProperty("Code", typeof(EnumEncodingType));
            proxy.AppendProperty("Age", typeof(int));
            proxy.AppendProperty("Birthdy", typeof(DateTime));
            proxy.AppendProperty("Died", typeof(DateTime?));
            var type = proxy.GenerateType();
            var obj  = Activator.CreateInstance(type);

            System.Utility.Helper.Reflection.SettingObjectValue(obj, "Name", "xiaoming");
            var vname = System.Utility.Helper.Reflection.GetObjectValue(obj, "Name");

            Assert.IsTrue(vname == "xiaoming");

            System.Utility.Helper.Reflection.SettingObjectValue(obj, "Code", EnumEncodingType.GB2312);
            dynamic dobj = obj;

            Assert.IsTrue(dobj.Code == EnumEncodingType.GB2312);

            dobj.Age = 33;
            var vage = System.Utility.Helper.Reflection.GetObjectValue(dobj, "Age");

            Assert.IsTrue(vage == 33);

            var now = DateTime.Now;

            dobj.Birthdy = now;
            Assert.IsTrue(dobj.Birthdy == now);
            //died
            System.Utility.Helper.Reflection.SettingObjectValue(obj, "Died", new DateTime(1986, 11, 15));
            var vdied = (DateTime)System.Utility.Helper.Reflection.GetObjectValue(obj, "Died");

            Assert.IsTrue(vdied == new DateTime(1986, 11, 15));

            //---console
            Console.WriteLine("Name:" + dobj.Name);
            Console.WriteLine("Code:" + dobj.Code);
            Console.WriteLine("Age:" + dobj.Age);
            Console.WriteLine("Birthdy:" + TypeExtension.ToDateTimeString(dobj.Birthdy));
            Console.WriteLine("Died:" + TypeExtension.ToDateTimeString(dobj.Died));
        }