Last active
April 3, 2021 12:13
-
-
Save stiano/ce26652d5e1997344f2afeb1213759ea to your computer and use it in GitHub Desktop.
NUnit testing dependencies
This file contains 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
public static class TestExtensions | |
{ | |
private static readonly JsonSerializerOptions JsonSerializerOptions = new JsonSerializerOptions() | |
{ | |
WriteIndented = true, | |
}; | |
public static void ToConsole(this object? o) | |
{ | |
if (o is null) | |
return; | |
var json = ToJson(o); | |
Console.WriteLine(json); | |
} | |
public static string ToJson(this object? o) | |
{ | |
if (o is null) | |
return string.Empty; | |
return JsonSerializer.Serialize(o, JsonSerializerOptions); | |
} | |
} |
This file contains 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
<ItemGroup> | |
<PackageReference Include="nunit" Version="3.13.1" /> | |
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" /> | |
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" /> | |
<PackageReference Include="FluentAssertions" Version="5.10.3" /> | |
<PackageReference Include="System.Runtime.Serialization.Json" Version="4.3.0" /> | |
</ItemGroup> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment