有没有办法在不测试整个应用程序的情况下对类库(通用 Windows)进行单元测试? [英] Is there a way to UnitTest a Class Library (Universal Windows) without testing a whole application?

查看:25
本文介绍了有没有办法在不测试整个应用程序的情况下对类库(通用 Windows)进行单元测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要对 Class Library (Universal Windows) 进行单元测试,但是从添加新项目"窗口中,我只看到:

I need to UnitTest a Class Library (Universal Windows), but from the "Add New Project" windows, I just see this:

此项目使用 App Container 运行所有测试,它始终会打开一个 App.由于我不需要所有这些开销,我想知道是否有办法仅对 UWP 库进行单元测试.

This project runs all tests with the App Container, it always opens an App. Since I don't need all that overhead, I would like to know if is there a way to Unit Test just the UWP library.

推荐答案

快速回答是,如果您需要测试 UI 相关的类,您将需要使用这种单元测试".但是,如果您有要测试的逻辑 - 将其提取到可移植库 (PCL) 并使用普通的旧单元测试框架独立测试.

The quick answer is that if you need to test UI related classes you'll need to use this kind of "unit test". However if you have logic which you want to test - extract it to a portable library (PCL) and test it independently using plain old unit testing framework.

这篇关于有没有办法在不测试整个应用程序的情况下对类库(通用 Windows)进行单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆