Beispiel #1
0
        public void TestReflectionPropertyGetAndSet()
        {
            var testObject = new ReflectionTestObject();
            var val        = testObject.GetPropertyValue <string>("PrivateProperty");

            Assert.Same("Get off my lawn", val);

            testObject.SetPropertyValue("PrivateProperty", "testProp");
            var val2 = testObject.GetPropertyValue <string>("PrivateProperty");

            Assert.Same("testProp", val2);
        }
Beispiel #2
0
        public void TestReflectionSetPropertyValueBoxed()
        {
            var testObject = new ReflectionTestObject();

            testObject.SetPropertyValue("PrivateObjectProperty", 123);
            Assert.Equal(123, testObject.GetPropertyValue <object>("PrivateObjectProperty"));
        }
Beispiel #3
0
        public void TestReflectionGetPropertyValueBoxed()
        {
            var testObject = new ReflectionTestObject();
            var boxedValue = testObject.GetPropertyValue <object>("PrivateIntProperty");

            Assert.Equal(123, boxedValue);
        }