Stepping through and debugging code in Unit tests

前端 未结 8 2027
离开以前
离开以前 2020-12-09 01:34

I have not been able to debug or step through unit test.

Here is my sample test code...

using System;
using System.Text;
using System.Collections.Gen         


        
8条回答
  •  温柔的废话
    2020-12-09 02:02

    Maybe simply debugging tests and setting breakpoints works in some kinds of Unit tests but it doesn't if you debug e.g. Web service.

    To debug a Web Service (break inside a Unit test) you have to insert this code:

    System.Diagnostics.Debugger.Break();
    

    This will show a popup saying the application stopped working and you can choose to debug it.

    More here: http://msdn.microsoft.com/en-us/library/ms243172.aspx#DebuggingOnCassini

提交回复
热议问题