Silverlight Unit Tests: How to Stop Breaking on Assert Exceptions

本文介绍如何在Visual Studio 2010中禁用Silverlight单元测试失败时引发的断言异常,通过调整调试器设置,可以避免调试过程中不必要的中断,提升测试效率。

There’s something a little peculiar about how unit tests work in Silverlight when the debugger is attached – when an Assert fails in one of your unit tests, the Visual Studio debugger breaks the execution and brings up the debugger dialog.

image

If you want to run a whole bunch of unit tests to see which ones are failing or you only care about the exceptions that your code throws, this feature can really cramp your style.  Thankfully, it’s pretty easy to edit the debugger settings to make these Assert exceptions go away.

Step #1: Go to the Debug menu in Visual Studio 2010, choose Exceptions…

image

Step #2: On the Exceptions dialog, click Add… 

image

Step #3: Register the exception types you want to tweek   

image

From the Type menu, choose Common Language Runtime Exceptions.    In the Name textbox, type Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException.    Click OK.

Step #4: Repeat step #2 and #3 for Microsoft.VisualStudio.TestTools.UnitTesting.AssertInconclusiveException

 

Step #5: Uncheck Thrown and User-unhandled for the exceptions you just added.

image

Step #6: On the Exceptions dialog, click OK

image

Step #7: Enjoy your new streamlined exceptions.

image

转载于:https://www.cnblogs.com/promise-7/archive/2013/03/20/2972186.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值