I'm working on a legacy system that has uses stored procs, business objects and DTO:s. The business objects and the DTO:s often have the same properties. When calling a method in the service layer that returns a DTO, many transformations are happening. Stored proc -> dataset -> business object -> DTO. If a new property is added, it sometimes happens that a developer forgets to add code that moves it from one layer/object to another.
In some parts of the system I solved this by using AutoMapper which will automatically project properties with the same name.
My question is for the other parts. Can I somehow write a unit test that checks if every property in an object has been set/given a value? That way I could write an integration test that calls our service layer and all the transformations have to be successful for the test to pass.
I guess the solution would involve reflection.