Example #1
0
 public void AnonymousTypeTest1()
 {
     Assert.Equal(new[] { "a", "b" }, ObjectUtility.GetPropertyDictionary(new
     {
         a = 1,
         b = 2
     }).Keys);
 }
Example #2
0
        public void AnonymousTypeTest2()
        {
            Assert.Equal(new[] { "a", "b" }, ObjectUtility.GetPropertyDictionary(new
            {
                a = 1,
                b = 2
            }).Keys);

            var anonymous = new
            {
                a = 1,
                b = 2,
                c = new
                {
                    RegionID = 5,
                }
            };

            Assert.Equal(new[] { "a", "b", "RegionID" }, ObjectUtility.GetPropertyPureDictionary(anonymous, true).Keys);
            Assert.Equal(new[] { "a", "b", "c_RegionID" }, ObjectUtility.GetPropertyPureDictionary(anonymous, false).Keys);
        }