Catel and Microsoft Fakes

Topics: Feature requests
Jun 20, 2014 at 6:23 PM
I'm currently using Catel as my MVVM Framework, and I'm using Microsoft Fakes to unit test my code.

One issue that I've run into involves a problem with Catel's [Model] and [ViewModelToModel] attributes not working well with MSTest stubs. The issue is because Catel uses reflection to ensure that Model has the appropriate properties that are being tagged for exposure. But MSTest implements its Stubs using delegates for the Getter and Setter. Therefore, Catel doesn't see the properties it wants and throws a reflection exception.

I was wondering what I could do to remedy this situation. My Unit Tests are failing, because catel is throwing Reflection exceptions, even though the stubs work properly. My current work around is to create fakes that implement the interface using properties, but this seems a bit redundant.

I have a reproduction available, I'm just not sure where you would like me to post it. Thanks.
Jun 20, 2014 at 6:27 PM
If the stubs are correct, they should mimick the models exactly as they are. That means that using emit, the properties should be created at runtime on the stubs. Isn't that the case with Microsoft Fakes?

Do you have a small example / repro so I can test it?
Jun 20, 2014 at 6:33 PM
I have a small solution that reproduces this. Where should I post it?
Jun 20, 2014 at 6:34 PM
Jun 20, 2014 at 6:46 PM
I've created an issue with the reproduction here.