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