如何在Windows Phone 8.1 RT中进行单元测试?

时间:2014-10-25 13:49:28

标签: c# unit-testing windows-runtime windows-phone windows-phone-8.1

任何人都知道如何在WP 8.1 RT应用程序中进行单元测试?关于这个甚至WinRT,互联网上几乎没有资源。

1 个答案:

答案 0 :(得分:5)

  1. 在解决方案中创建一个新项目。选择单元测试应用模板(参见屏幕截图)。
  2. 在该项目中使用测试方法创建一个测试类。这看起来像这样:

    [TestClass]
    public class FooTestUnit
    {
        [TestMethod]
        public void TestFooBarProperty () {
            int referenceValue = 42;
            int actualValue = methodToTest();
            Assert.AreEqual(referenceValue, actualValue);
        }
    }
    

    }

  3. 从主菜单中选择:测试/运行所有测试

  4. enter image description here