Example #1
0
        public void GetValue()
        {
            var o           = new FieldClass();
            var type        = o.GetType();
            var fields      = type.GetFields();
            var stringField = fields.Single(x => x.Name == "StringField");
            var staticField = fields.Single(x => x.Name == "StaticField");

            var stringFieldValue = stringField.GetValue(o);

            AssertEquals(stringFieldValue, "bar");

            var staticFieldValue = staticField.GetValue(null);

            AssertEquals(staticFieldValue, "foobar");
        }
Example #2
0
        public void SetValue()
        {
            var o           = new FieldClass();
            var type        = o.GetType();
            var fields      = type.GetFields();
            var stringField = fields.Single(x => x.Name == "StringField");
            var staticField = fields.Single(x => x.Name == "StaticField");

            stringField.SetValue(o, "bar2");
            staticField.SetValue(o, "foobar2");

            var stringFieldValue = stringField.GetValue(o);

            QUnit.AreEqual(stringFieldValue, "bar2");

            var staticFieldValue = staticField.GetValue(null);

            QUnit.AreEqual(staticFieldValue, "foobar2");
        }
Example #3
0
        public void GetValue()
        {
            var o = new FieldClass();
            var type = o.GetType();
            var fields = type.GetFields();
            var stringField = fields.Single(x => x.Name == "StringField");
            var staticField = fields.Single(x => x.Name == "StaticField");
                
            var stringFieldValue = stringField.GetValue(o);
            AssertEquals(stringFieldValue, "bar");

            var staticFieldValue = staticField.GetValue(null);
            AssertEquals(staticFieldValue, "foobar");
        }