コード例 #1
0
        public void EnumLambdaAssignsToIntegerEnumProperty()
        {
            var obj = new IntegerEnumClass()
                          {
                              Enum = IntegerEnum.ValueOne
                          };
            var propertyInfo = obj.GetType().GetProperties().Single();
            var function = _lambdaGenerator.CreateAssignmentFunctionWithCast<IntegerEnumClass, Enum>(propertyInfo);

            function(obj, IntegerEnum.ValueTwo);

            Assert.AreEqual(IntegerEnum.ValueTwo, obj.Enum);
        }
コード例 #2
0
 public void ReaderLambdaReadsIntEnumFromProperty()
 {
     var obj = new IntegerEnumClass()
     {
         Enum = IntegerEnum.ValueOne
     };
     var propertyInfo = obj.GetType().GetProperties().Single();
     var function = _lambdaGenerator.CreateReaderFunction<IntegerEnumClass, IntegerEnum>(propertyInfo);
     Assert.AreEqual(obj.Enum, function(obj));
 }