Esempio n. 1
0
        public void MemberAccessWithReflection()
        {
            var obj = new PropsOnClass {
                A = 123, B = "abc", C = _now, D = null
            };
            DateTime value = (DateTime)typeof(PropsOnClass).GetProperty("C").GetValue(obj);

            Assert.AreEqual(_now, value);
        }
Esempio n. 2
0
        public void StaticMemberAccessWithFastMember_ObjectAccessor()
        {
            var obj = new PropsOnClass {
                A = 123, B = "abc", C = _now, D = null
            };
            var accessor = TypeAccessor.Create(typeof(PropsOnClass));
            int value    = (int)accessor[obj, "Count"];

            Assert.AreEqual(1, value);
        }
Esempio n. 3
0
        public void MemberAccessWithFastMember_ObjectAccessor()
        {
            var obj = new PropsOnClass {
                A = 123, B = "abc", C = _now, D = null
            };
            var accessor = ObjectAccessor.Create(obj);
            var value    = (DateTime)accessor["C"];

            Assert.AreEqual(_now, value);
        }
Esempio n. 4
0
        public void MemberAccessWithFastMember_TypeAccessor()
        {
            var obj = new PropsOnClass {
                A = 123, B = "abc", C = _now, D = null
            };
            var      accessor = TypeAccessor.Create(typeof(PropsOnClass));
            DateTime value    = (DateTime)accessor[obj, "C"];

            Assert.AreEqual(_now, value);
        }