-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partially incorrect reverse map when numerical values of source and destination enums differ #30
Comments
I will have a look at it Monday |
…estination enums differ #30 Setup testcase with error
I created a branch with same tests: Line 113 in df484a3
I will have a look at the logic. |
I have added a MapByCustom option. MapByValue and MapByName both rely on or the values or the names. In case of no default on name or value, we can now use Custom. With Custom you have to specify all the mappings explicitly in the configuration. I need to add more tests and more checks for AssertConfigurationIsValid. |
* Partially incorrect reverse map when numerical values of source and destination enums differ #30 Setup testcase with error * Added Mapping by custom mappings * Added testcases * Updated documentation * Cleanup --------- Co-authored-by: Henk Kin <[email protected]>
Source and Destination Types
Mapping Configuration and Test Code
Version: Automapper.Extensions.EnumMapping version 4.0.0
Expected Behavior
All tests pass.
Actual Behavior
All tests pass except for
TestReverseBazMapping
. The reverse mapping fromDestinationEnum.BAZ_ALT_NAME
toSourceEnum.Baz
is incorrect - expectedSourceEnum.Baz
, but the mapper gives meSourceEnum.Bar
instead.Note that although the integer values of
DestinationEnum.BAZ_ALT_NAME
andSourceEnum.Baz
are different, the other mappings in the other three tests also involve source and destination values that differ in integer value. This specific reverse mapping value is the one that produces an incorrect value, but not the others. Note also that all the values mapped in the Source -> Destination direction are mapped correctly, only some of the values in the reverse map are incorrect. I'm not clear on what about this particular value is triggering the failed map.The text was updated successfully, but these errors were encountered: