Created
May 19, 2021 18:43
-
-
Save henkin/09df03c2a6450e4bc1ea454dd1389072 to your computer and use it in GitHub Desktop.
xunit test dump sorted environment dotnet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using Xunit; | |
using Xunit.Abstractions; | |
namespace Jail.Booking.ComponentTests | |
{ | |
public class DebugTests | |
{ | |
private readonly ITestOutputHelper _outputHelper; | |
public DebugTests(ITestOutputHelper outputHelper) | |
{ | |
_outputHelper = outputHelper; | |
} | |
[Fact] | |
public void DebugTest() | |
{ | |
_outputHelper.WriteLine("ENVIRONMENT"); | |
var variables = Environment.GetEnvironmentVariables().Keys.Cast<string>().ToList(); | |
variables.Sort(); | |
//.Keys.ToList<string>(); | |
foreach (var envVar in variables) | |
{ | |
var output = $"{envVar}: '{Environment.GetEnvironmentVariable(envVar)}'"; | |
_outputHelper.WriteLine(output); | |
} | |
throw new InvalidCastException(); // to trigger Azure Devops to print output | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment