6
votes

The 'Silverlight Unit Test Application' project type is missing from within Visual Studio 2012. I can see it in VS 2010, but not in VS2012. I have installed and re-installed the Silverlight 5 toolkit from codeplex. Creating and running a silverlight unit test project in VS2010 works, but when running the tests through R# in VS2012, I get "Inconclusive: Test wasn't run"

Any help / suggestions would be greatly appreciated.

2
what is R#? Do you mean resharper?Eriawan Kusumawardhono
Hi Eriawan, yes. Resharper Version 7.1user2115298
I found [workaround][1] for almost same question, may help . [1]: stackoverflow.com/a/28167112/173073Dzmitry Lahoda

2 Answers

4
votes

This link has the answer that worked for me:

http://social.msdn.microsoft.com/Forums/vstudio/en-US/5e991b0d-8061-4c4e-a17d-82b4abd58d6c/vs-2012-silverlight-unittest

I recommend starting a new Silverlight project and installing the SilverlightToolkit-Testing NuGet package. In your test files, put in usings for Microsoft.Silverlight.Testing and Microsoft.VisualStudio.TestTools.UnitTesting and use regular [TestClass] and [TestMethod] attributes. To run them, you can use the Toolkit test runner by putting RootVisual = UnitTestSystem.CreateTestPage(); in your App.Application_Startup(), use Silverlight Unit Test Adapter (which currently is at v0.0.1 and doesn't really work), or (the best approach by far) install ReSharper and the AgUnit plugin.

1
votes

It's possible to reference Silverlight libraries from ordinary .NET libraries. So, if you are going to unit test only your view models, you can move them to a separate project, create an ordinary (not Silverlight specific) unit testing project and add a reference to the project of view models.