Resharper:如何写入控制台输出

Resharper: How to write to console output

我正在使用 Resharper 2019 1.3.
我正在使用 Xunit 运行单元测试。 在我用 [Fact] 装饰的测试方法中,我想使用 Console.WriteLine 写入 Resharper 输出。
由于某种原因,它不起作用。

关于如何解决这个问题有什么想法吗?

public class NumberTest
{
    public NumberTest()
    {
    }

    [Fact]
    public void NewNumber_should_randomize()
    {
        var number1 = Number.NewNumber();

        Console.WriteLine(number1.Value);
    }
}

较新版本的 xUnit 稍微分离了日志记录。看看 the "Capturing Output" docs,告诉你这样做:

public class NumberTest
{
    private readonly ITestOutputHelper output;

    public NumberTest(ITestOutputHelper output)
    {
        this.output = output;
    }

    [Fact]
    public void NewNumber_should_randomize()
    {
        var number1 = Number.NewNumber();

        output.WriteLine(number1.Value);

        throw new Exception("Output _might_ only show if the test fails, depending on the runner");
    }
}

但是,保重,我之前在类似的问答中注意到