It feels like I've got to be missing something, but I haven't been able to find any mock-object frameworks I can use when I'm writing unit tests for my WinRT code. Are there any WinRT-capable mocking frameworks out there?
I'm aware of MoqRT, but as far as I can tell, it does codegen at build time (though via a fragile-sounding integration that's not quite part of the actual build process), but it feels more like a hack than an implementation.
DynamicMethod (the class behind Lightweight Code Generation) apparently isn't available in WinRT. But expression trees do seem to be supported, including their Compile method; so it seems like a mock-object framework should be doable, probably.
Are there any WinRT mocking frameworks out there?
I've been using Telerik JustMock in WinRT. You don't get a useful error message when the test fails, but apart from that, you're away. It's the full paid version I've got, not the free one, I don't know if that works.
Also, you might want to consider if you really need to have your code in WinRT assemblies - check out Portable Class Libraries, and call them from your WinRT app. I might be proved wrong by reality, but I would think you would be able to use mocking frameworks on code in a PCL
I'm currently stuck with the same problem. I'm sad that Rhino Mocks is not working on WinRT. But apparetnly there is a port of Moq => MoqRT
I haven't used it, I'll probably investigate in fakes, stubs and shims from Microsoft; Since MoqRT is still alpha and I don't want to test my code with an alpha framework.
But just pointing out another possibility.
UPDATE
I just found out about this: Fake It Easy
Haven't tried it but it looks promising.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With