Windows手机库解决方案的运行单元测试

时间:2014-05-12 14:37:54

标签: c# unit-testing visual-studio-2012 windows-phone

我正在使用 Visual Studio Express 2012 for Windows Phone,更新4

我创建了项目类型为 Windows Phone类库的解决方案,目标是 Windows Phone 7.1 平台。

完成一些编码后,我发现将一些测试添加到解决方案中会很不错。所以我在解决方案中添加了 Windows Phone Unit Test App ,并创建了一些失败的虚假测试:

[TestClass]
public class BogusTester
{
    [TestMethod]
    public void BogusTest()
    {
        Assert.AreEqual(true, false);
    }
}

我已经打开Test Explorer窗口,我可以看到我的测试,但是它显示为灰色,当我点击Run All时没有任何反应(即项目正在构建,但测试不会返回任何值)< / p>

我做错了什么?

EDIT 我也找到了测试结果:

Failed to import IDeployService. Cannot proceed with xap deployment. This failure can be observed if the component model cache (typically located in %LocalAppData%\Microsoft\VisualStudio\[version]\ComponentModelCache) is not up-to-date.  To come out of this error, close all instances of visual studio, delete the component model cache folder and try again.
Unit tests in source D:\projekty\PhoneApp3\TestApp1\Bin\x86\Debug\TestApp1.dll cannot be run. Please create a Windows Store or Windows Phone Unit Test project.

我已经为我的用户删除了ComponentModelCache,但这没有帮助,我也无法在互联网上找到有关此错误的任何资源

1 个答案:

答案 0 :(得分:0)

请参阅本说明: &#34;您只能为针对Windows Phone 8的应用程序创建单元测试。不支持Windows Phone 7,7.5,7.8。&#34; 来自 - http://blogs.msdn.com/b/visualstudioalm/archive/2013/01/31/windows-phone-unit-tests-in-visual-studio-2012-update-2.aspx

第3点:常见问题和已知问题

HTH。