简体   繁体   English

单元测试运行程序引发异常

[英]Unit test runner throwing an Exception

I have just created a sample Windows Phone Unit Test app for checking things out. 我刚刚创建了一个示例Windows Phone Unit Test应用程序,用于签出内容。 But i am not able to test a sample method. 但是我无法测试样本方法。 the weird thing is Visual Studio test runner is working fine but Resharper Unit Test Runner just throwing Exception. 奇怪的是Visual Studio测试运行器工作正常,但是Resharper Unit Test Runner仅抛出Exception。 Exception :- 例外:- 在此处输入图片说明

anybody know about it ? 有人知道吗?

To test this I created brand new WP8 project. 为了测试这一点,我创建了一个全新的WP8项目。 "Program" is as simple as they get, using default MainPage and all. 使用默认的MainPage和全部,“程序”非常简单。

在此处输入图片说明

I just added MainViewModel, having only one property 我刚刚添加了MainViewModel,它只有一个属性

public string MyProperty
{
    get { return _myProperty; }
    set { _myProperty = value; OnPropertyChanged(); }
}

After that I added the WP8 Unit Test project and replaced default UnitTest1.Testmethod1 with 之后,我添加了WP8单元测试项目,并将默认的UnitTest1.Testmethod1替换为

[TestClass]
public class MainViewModelTests
{
    [TestMethod]
    public void MyPropertyTest()
    {
        string expected = "expected";
        var vm = new MainViewModel();

        vm.MyProperty = expected;
        Assert.AreEqual(expected, vm.MyProperty);    
    }
}

Both MS Test runner and ReSharper are working fine and test passed. MS TestRunner和ReSharper都可以正常工作并通过测试。

在此处输入图片说明

I am using Visual Studio 2012 v11.0.61030.00 Update 4 and JetBrains ReSharper v7.1 build 7.1.3000.2259. 我正在使用Visual Studio 2012 v11.0.61030.00更新4和JetBrains ReSharper v7.1构建7.1.3000.2259。

If interested you can find the Visual Studio solution from GitHub @ https://github.com/mikkoviitala/wp8-unit-test-example and try it out yourself. 如果有兴趣,可以从GitHub @ https://github.com/mikkoviitala/wp8-unit-test-example找到Visual Studio解决方案,然后自己尝试一下。 If it's not working for you then I can't think of anything other than reinstalling ReSharper and hope for the best. 如果对您不起作用,那么除了重新安装ReSharper并希望获得最好的效果外,我别无选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM