惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Azure Blog
Microsoft Azure Blog
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
V
V2EX
PCI Perspectives
PCI Perspectives
Latest news
Latest news
博客园 - 三生石上(FineUI控件)
C
CERT Recently Published Vulnerability Notes
W
WeLiveSecurity
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Palo Alto Networks Blog
T
The Exploit Database - CXSecurity.com
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
WordPress大学
WordPress大学
V
Vulnerabilities – Threatpost
H
Heimdal Security Blog
Attack and Defense Labs
Attack and Defense Labs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News: Ask HN
Hacker News: Ask HN
博客园 - 叶小钗
V
Visual Studio Blog
Jina AI
Jina AI
P
Proofpoint News Feed
罗磊的独立博客
SecWiki News
SecWiki News
J
Java Code Geeks
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 热门话题
Security Archives - TechRepublic
Security Archives - TechRepublic
The Hacker News
The Hacker News
Hugging Face - Blog
Hugging Face - Blog
N
News and Events Feed by Topic
NISL@THU
NISL@THU
T
Tailwind CSS Blog
T
Tenable Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Recent Announcements
Recent Announcements
H
Hacker News: Front Page
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
Tor Project blog
宝玉的分享
宝玉的分享
Help Net Security
Help Net Security
S
Security Affairs
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
G
GRAHAM CLULEY

博客园 - WilsonWu

[Azure] 使用 Visual Studio 2013 管理中国版 Azure 订阅 [Azure] 使用 Azure 快速搭建 Redis 服务器 [Azure] Azure 中国服务使用注意事项及兼容版存储访问工具 [Azure] 创建支持Apache,PHP以及MySQL的CentOS Web Virtual Machine Server [Windows 8] 开发初体验:对话框(MessageBox)和程序任务栏(ApplicationBar) [Windows Phone] 为应用添加后台计划任务 – Scheduled Task Agent [Windows Phone] 在中文版Visual Studio 2010中开发Windows Phone应用程序 [VSTS] 让ADO.NET Entity Framework支持Oracle数据库 [VSTS] 配置 Team Foundation Server 团队权限最佳实践 [VSTS] 从零开始 Team Foundation Server 2010 安装配置详细图文教程 [Windows Phone] 在Windows Phone程序中播放GIF动画 [Windows Phone] Windows Phone 7 播放远程流媒体的代码实现方法 [Windows Phone] 在Windows Phone应用中使用Google Map替代Bing Map [Windows Phone] 另类方法解决ScrollViewer设置透明度后文字模糊问题 [免费讲座] 成都软件技术沙龙 - 开启基于Scrum的敏捷开发全新征程讲座 欢迎访问iOS开发者论坛:www.codeios.com! [TechEd 2010] 回首微软TechEd十年,我们获益良多! [.NET] 在Windows系统中搭建基于.NET的iPhone应用程序虚机开发环境 [Windows 7] 使用Windows Media Center看免费大片
[Visual Studio] 开启Visual Studio 2012通过右键菜单创建单元测试(Unit Test)
WilsonWu · 2013-05-22 · via 博客园 - WilsonWu

Visual Studio 2012可以说是迄今为止微软VS开发工具中用户体验最好的产品,无论是速度还是体验以及功能,都非常出色,但是,使用了一段时间后发现有一个之前版本VS都有的功能却在Visual Studio 2012中消失了。

装了Visual Studio 2012的朋友可以自己试一试,在一个方法的名上右键点击发现操作菜单中没有创建单元测试的选项,如下图:

clip_image001

不知道微软是怎么想的,这个实用的功能给去掉了,但是也不用着急,成熟的软件产品一般都不会将已有的功能去掉,最多也是隐藏,下面我们就来通过几个简单的步骤开启该功能,让我们可以在右键菜单中轻松创建单元测试。

1. 在Tools菜单中选择Customize…菜单:

clip_image002

2. 在弹出窗口中选择Commands选项卡,并选择Context menus,在下拉菜单中选择Editor Context Menus | Code Windows

clip_image004

3. 这是我们可以看到久违的Create Unit Tests…菜单,选择后点击Move UpMove Down,让这个菜单移动到Run Tests周围即可(这点需要注意,往下移动10次左右,会看到除图上之外的另一个Run Tests,移到这里就对了):

clip_image005

4. 看到Create Unit Tests…菜单出现,已经成功一半了,但是却发现该菜单不能被点击,处于禁用状态:

clip_image006

5. 接着随便创建一个项目,并在该项目的解决方案中创建一个测试项目:

clip_image008

6. 创建好测试项目后,在该项目中通过Add –> Unit Test…创建一个单元测试文件:

clip_image010

7. 这时再回到刚才右键菜单中单元测试被禁用的方法上,右键点击,发现Create Unit Tests…已经可用,大功告成,以后在所有项目中都可以快速使用这个功能了。

clip_image011