Decided to post this because I had fun writing this code, however I think it will bring good use to you too.
While implementing functionality for creating/merging/converting complex data objects I had to backup myself with unit tests. First of all to test if it is working correctly, secondly to be more confident when new requirements or the need of refactoring appears.
In the tests you usually have to compare the actual result and expected result of some logic. In my case these result where complex data objects. And there is no standard generic mechanism in .NET for comparing 2 complex objects, for example instances of such class:
Here is the implementation checking for checking equality that I came out with:
Please note that this was added and was used only for tests.
If you had the same problem and came with a better solution be kind to share it.
While implementing functionality for creating/merging/converting complex data objects I had to backup myself with unit tests. First of all to test if it is working correctly, secondly to be more confident when new requirements or the need of refactoring appears.
In the tests you usually have to compare the actual result and expected result of some logic. In my case these result where complex data objects. And there is no standard generic mechanism in .NET for comparing 2 complex objects, for example instances of such class:
Here is the implementation checking for checking equality that I came out with:
Please note that this was added and was used only for tests.
If you had the same problem and came with a better solution be kind to share it.