You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicclassMyOrder:Order<MyXp>{}publicclassMyXp{publicstringColor{get;set;}}varorder=newMyOrder();order=(Order)order;order.xp=5;order=(MyOrder)order;varcolor=order.xp.Color;// 'myOrder.xp.Color' threw an exception of type 'System.InvalidCastException'
The expectation would be that when I use the instance as MyOrder everything will be fine, but it cannot be fine since it is backed by the same dictionary instance and the implementation of ordercloud models does not handle this scenario.
This may seem a bit contrived but I came across this when trying to use AutoFixture to automatically mock ordercloud models with typed xp. AutoFixture cannot ignore the hidden properties, since the hidden property values can always be used, while its lower instance is cast to it's base type.
The text was updated successfully, but these errors were encountered:
Consider the following scenario:
The expectation would be that when I use the instance as
MyOrder
everything will be fine, but it cannot be fine since it is backed by the same dictionary instance and the implementation of ordercloud models does not handle this scenario.This may seem a bit contrived but I came across this when trying to use AutoFixture to automatically mock ordercloud models with typed xp. AutoFixture cannot ignore the hidden properties, since the hidden property values can always be used, while its lower instance is cast to it's base type.
The text was updated successfully, but these errors were encountered: