单元测试运行器抛出异常

时间:2014-07-04 18:25:21

标签: c# unit-testing windows-phone-8 resharper win-phone-silverlight-8.1

我刚刚创建了一个示例Windows Phone Unit Test应用来查看问题。但我无法测试样本方法。奇怪的是Visual Studio测试运行器工作正常,但Resharper Unit Test Runner只是抛出异常。 例外: - enter image description here

有人知道吗?

1 个答案:

答案 0 :(得分:0)

为了测试这个,我创建了全新的WP8项目。 “程序”就像使用默认的MainPage和所有内容一样简单。

enter image description here

我刚刚添加了MainViewModel,只有一个属性

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

之后我添加了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);    
    }
}

MS Test runner和ReSharper都工作正常,测试通过。

enter image description here

我正在使用Visual Studio 2012 v11.0.61030.00 Update 4和JetBrains ReSharper v7.1 build 7.1.3000.2259。

如果有兴趣,您可以从GitHub @ https://github.com/mikkoviitala/wp8-unit-test-example找到Visual Studio解决方案并亲自试用。如果它不适合你,那么除了重新安装ReSharper并希望最好之外我什么也想不到。

相关问题