I have an enum in my business object defined.
This enum is although defined in the data transfer object.
The dto enum is not of the type of the business object because they should not know of each other.
When I get now this dto from the client and map the dto to a business object and insert the data in the database I want to assert that passed dto.enum has the same value as the inserted enum value in the database.
Thats my error message I get:
Expected: A
But was: A
Actually they have the same value but different type: dto.enum vs businessobject.enum.
So where would you define this enum then that both objects can it and both objects does not have a coupling to each other?
I thought about putting an extra c# class in my business layer and inside the enum definition used by the dto AND business object so the assertion would work.
What would you do?
You should put the enum in an external util class that both objects would have access to by project reference (Model Layer most likely). Then they can use the same enum and you won't have to attempt to cast, convert or couple (assuming the enums are exact duplicates of eachother).