在NUnit中替换Console.WriteLine [英] Replace Console.WriteLine in NUnit

查看:196
本文介绍了在NUnit中替换Console.WriteLine的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前对NUnit并没有做很多事情,但是我只是想以控制台类型的方式将一些文本转储到窗口中。

 例如Console.WriteLine( ...一些信息...); 

这当然是行不通的,因为NUnit正在驱动事物。


I我正在构建一些单元测试,并且希望转储变量值列表以在调试期间进行检查。我承认,这并不是严格的单元测试,但这很方便。

解决方案

您可以看到控制台输出。您只需要选择文本输出即可。



如果使用的是ReSharper测试运行程序,则应显示控制台输出。单击显示输出,确保显示测试运行器输出窗口。测试运行器工具栏中的按钮:



然后您应该获得以下内容:



I haven't done much with NUnit before, but I just wanted to dump some text to a window in a console type fashion.

e.g. Console.WriteLine("... some information...");

That won't work of course because NUnit is driving things.

I'm in the middle of building some unit tests and want to dump a list of variable values for inspection during debug. It isn't strictly a unit test if I need to do this I admit that, but it would be convenient.

解决方案

You can see the console output. You just have to select the "Text Output" tab in the NUnit GUI runner.

If you are using the ReSharper test runner, the console output should be displayed. Ensure that the test runner output window is displayed by clicking the "Show Output" button in the test runner tool bar:

You should then get something as follows:

这篇关于在NUnit中替换Console.WriteLine的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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