public void CreateSetField_ReadOnly()
        {
            FieldsTestClass c = new FieldsTestClass();

            Action <object, object> setter = ExpressionReflectionDelegateFactory.Instance.CreateSet <object>(typeof(FieldsTestClass).GetField("IntReadOnlyField"));

            setter(c, int.MinValue);
            Assert.AreEqual(int.MinValue, c.IntReadOnlyField);
        }
        public void CreateSetField()
        {
            FieldsTestClass c = new FieldsTestClass();

            Action <object, object> setter = ExpressionReflectionDelegateFactory.Instance.CreateSet <object>(typeof(FieldsTestClass).GetField("StringField"));

            setter(c, "String!");
            Assert.AreEqual("String!", c.StringField);

            setter = ExpressionReflectionDelegateFactory.Instance.CreateSet <object>(typeof(FieldsTestClass).GetField("BoolField"));

            setter(c, true);
            Assert.AreEqual(true, c.BoolField);
        }
        public void CreateGetField()
        {
            FieldsTestClass c = new FieldsTestClass
            {
                BoolField   = true,
                StringField = "String!"
            };

            Func <object, object> getter = ExpressionReflectionDelegateFactory.Instance.CreateGet <object>(typeof(FieldsTestClass).GetField("StringField"));

            object value = getter(c);

            Assert.AreEqual("String!", value);

            getter = ExpressionReflectionDelegateFactory.Instance.CreateGet <object>(typeof(FieldsTestClass).GetField("BoolField"));

            value = getter(c);
            Assert.AreEqual(true, value);
        }
        public void CreateSetField()
        {
            FieldsTestClass c = new FieldsTestClass();

            Action<object, object> setter = ExpressionReflectionDelegateFactory.Instance.CreateSet<object>(typeof(FieldsTestClass).GetField("StringField"));

            setter(c, "String!");
            Assert.AreEqual("String!", c.StringField);

            setter = ExpressionReflectionDelegateFactory.Instance.CreateSet<object>(typeof(FieldsTestClass).GetField("BoolField"));

            setter(c, true);
            Assert.AreEqual(true, c.BoolField);
        }
        public void CreateSetField_ReadOnly()
        {
            FieldsTestClass c = new FieldsTestClass();

            Action<object, object> setter = ExpressionReflectionDelegateFactory.Instance.CreateSet<object>(typeof(FieldsTestClass).GetField("IntReadOnlyField"));

            setter(c, int.MinValue);
            Assert.AreEqual(int.MinValue, c.IntReadOnlyField);
        }
        public void CreateGetField()
        {
            FieldsTestClass c = new FieldsTestClass
            {
                BoolField = true,
                StringField = "String!"
            };

            Func<object, object> getter = ExpressionReflectionDelegateFactory.Instance.CreateGet<object>(typeof(FieldsTestClass).GetField("StringField"));

            object value = getter(c);
            Assert.AreEqual("String!", value);

            getter = ExpressionReflectionDelegateFactory.Instance.CreateGet<object>(typeof(FieldsTestClass).GetField("BoolField"));

            value = getter(c);
            Assert.AreEqual(true, value);
        }