Edward_jie

for you, my Hall of Frame

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  90 随笔 :: 40 文章 :: 538 评论 :: 0 引用

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

posted on 2013-03-20 22:18  Edward_诺  阅读(...)  评论(... 编辑 收藏