To enable output in test class, as mentioned in the following answer xUnit.net does not capture console output you need to provide the following setup:
public class OutputTest
{
private readonly ITestOutputHelper _testOutputHelper;
public OutputTest(ITestOutputHelper testOutputHelper)
{
_testOutputHelper = testOutputHelper;
}
[Fact]
public void MyFact()
{
_testOutputHelper.WriteLine("Hello world!");
//this should result in writing to _testOutputHelper too
LogManager.GetCurrentClassLogger().Info("Hello world!");
}
}
How do I connect _testOutputHelper with NLog? Is it possible to write to ITestOutputHelper when there is done some logging by NLog (in application or in referenced library)?