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); }
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); }
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); }