Пример #1
0
        public void CreateSetter_StringType()
        {
            const string TestVal = "No";
            var          model   = new ExpressionTestModel {
                StringType = "Yes"
            };
            var setter = ExpressionHelper.CreateSetter <ExpressionTestModel, string>(x => x.StringType);

            setter(model, TestVal);

            Assert.AreEqual(TestVal, model.StringType);
        }
Пример #2
0
        public void CreateSetter_IntType()
        {
            const int TestVal = 2;
            var       model   = new ExpressionTestModel {
                IntType = 1
            };
            var setter = ExpressionHelper.CreateSetter <ExpressionTestModel, int>(x => x.IntType);

            setter(model, TestVal);

            Assert.AreEqual(TestVal, model.IntType);
        }
Пример #3
0
        public void CreateSetter_ListType()
        {
            List <int> TestVal = new List <int>();
            var        model   = new ExpressionTestModel
            {
                ListOfInt = new List <int> {
                    1, 2, 3
                }
            };
            var setter = ExpressionHelper.CreateSetter <ExpressionTestModel, List <int> >(x => x.ListOfInt);

            setter(model, TestVal);

            Assert.AreEqual(TestVal, model.ListOfInt);
        }