public void ReaderLambdaReadsCompoundTypesFromProperty() { var primitiveClass = new PrimitivePropertyClass() { Integer = 123 }; var compoundClass = new CompositePropertyClass() { PropertyClass = primitiveClass }; var propertyInfo = compoundClass.GetType().GetProperties().Single(); var function = _lambdaGenerator.CreateReaderFunction<CompositePropertyClass, PrimitivePropertyClass>(propertyInfo); Assert.AreEqual(primitiveClass, function(compoundClass)); }
public void AssignmentLambdaAssignsCompoundTypeToProperty() { var compoundClass = new CompositePropertyClass(); var primitiveClass = new PrimitivePropertyClass() { Integer = 123 }; var propertyInfo = compoundClass.GetType().GetProperties().Single(); var function = _lambdaGenerator.CreateAssignmentFunction<CompositePropertyClass, PrimitivePropertyClass>(propertyInfo); function(compoundClass, primitiveClass); Assert.AreEqual(primitiveClass, compoundClass.PropertyClass); Assert.AreEqual(123, compoundClass.PropertyClass.Integer); }