Windows Phone 7 mocking framework?

Is there any mocking framework for Windows Phone 7 or do I need to create fakes manually?

I did not find on google, and although I found Moq on the WP7 resources page, I could not get it to work.

+8
tdd windows-phone-7 mocking
source share
5 answers

There are no mocking frameworks that support WP7, and I suspect there will never be one until WP7 supports Reflection.Emit.

There are many parameters in the .net framework that exist to create a mocking structure (Profiler API, CodeDem, Refleciton.Emit, and others). Most of these methods will not work on Silverlight itself, as it skips quite a lot of BCL / CLRs. All existing Silverlight frameworks using the form use Reflection.Emit. WP7 does not support Reflection.Emit, and thus the Silverlight mocking framework will not work on WP7.

For this reason, I personally test WP7 builds in the Silverlight runtime. This is far from optimal (this sucks), but it is the best that can be done in the circumstances.

Theoretically, you can build a Mocking environment that uses Post-Build MSIL, which should run on WP7, but that's not all.

If you want WP7 to support Reflection.Emit, then consider this maintenance question: WP7 must support Reflection.Emit for Mocking frameworks

EDIT 12/12/2011: Refleciton.Emit supported by Mango. Hooray! Reflection.Emit based on Mocking should work.

+14
source share

I do not know about the currently available.

This article by David Gadd shows an example of testing on a phone using manually created fake objects and can be a useful resource.

+4
source share

I just got TypeMock Isolator and it works with Windows Phone 7 (sortof).

You need to create a default Visual Studio Test project, and you get an error message indicating that your Windows Phone 7 project cannot be referenced, but for some reason Mocks and Tests are working fine.

In any case, I'm really happy with the scams he can create.

+3
source share

Any mocking framework that supports Silverlight 3 should work with Windows Phone 7. You may need to use a previous version of the framework to โ€œdrop itโ€ on Silverlight 3.

0
source share

Just want to notice some information that I found on MSDN:

http://msdn.microsoft.com/en-us/library/hh821022.aspx#sec2

The mock classes were developed manually, since it is impossible to use a mocking structure on the Windows Phone platform. Mocking frameworks requires the ability to emit Microsoft Intermediate Language Code (MSIL), which is currently not available on the Windows Phone platform.

0
source share

Source: https://habr.com/ru/post/651205/


All Articles