wp7mobileusers
wp7mobileusers

Reputation: 243

How to make a unit test of my wp7 app

I want to generate a unit test on my wp7 app.

So I go to vs2010 -> test -> new basic unit test.

vs2010 generates a new test project in my solution, and I want to start coding. Now the problems begin.

How do I make the classes and methods from my wp7 app project accessable? When I add a reference to the app in my test project, it does not help me, because I get:

Warning    2    The project 'foo' cannot be referenced.  The referenced project is targeted to a different framework family (Silverlight)   

What should I do?

Upvotes: 2

Views: 295

Answers (2)

Richard Szalay
Richard Szalay

Reputation: 84744

In addition to Adam's answer, the WP7-CI project adds an MSBuild task to the SL Test Framework so that the tests can be run from a build server.

Upvotes: 2

Adam Houldsworth
Adam Houldsworth

Reputation: 64487

You need to use the Silverlight Unit Test framework:

http://channel9.msdn.com/Events/MIX/MIX10/CL59

Then you use Jeff Wilcox's unit test runner, which is a phone app:

http://blogs.msdn.com/b/amit_chatterjee/archive/2011/06/26/unit-testing-the-windows-phone-7-applications.aspx

I do this with success.

Upvotes: 2

Related Questions