Home

Awesome

<img src="/src/icon.png" height="30px"> Verify.ZeroLog

Discussions Build status NuGet Status

Extends Verify to allow verification of ZeroLog bits.

See Milestones for release notes.

NuGet package

https://nuget.org/packages/Verify.ZeroLog/

Usage

<!-- snippet: Enable -->

<a id='snippet-Enable'></a>

[ModuleInitializer]
public static void Initialize() =>
    VerifyZeroLog.Initialize();

<sup><a href='/src/Tests/ModuleInitializer.cs#L3-L9' title='Snippet source file'>snippet source</a> | <a href='#snippet-Enable' title='Start of snippet'>anchor</a></sup>

<!-- endSnippet --> <!-- snippet: Usage -->

<a id='snippet-Usage'></a>

[Fact]
public Task Usage()
{
    Recording.Start();
    var result = Method();

    return Verify(result);
}

static string Method()
{
    var logger = LogManager.GetLogger<Tests>();
    logger.Error("The error");
    logger.Warn("The warning");
    return "Result";
}

<sup><a href='/src/Tests/Tests.cs#L3-L22' title='Snippet source file'>snippet source</a> | <a href='#snippet-Usage' title='Start of snippet'>anchor</a></sup>

<!-- endSnippet -->

Results in:

<!-- snippet: Tests.Usage.verified.txt -->

<a id='snippet-Tests.Usage.verified.txt'></a>

{
  target: Result,
  log: [
    {
      Error: The error,
      Logger: Tests
    },
    {
      Warn: The warning,
      Logger: Tests
    }
  ]
}

<sup><a href='/src/Tests/Tests.Usage.verified.txt#L1-L13' title='Snippet source file'>snippet source</a> | <a href='#snippet-Tests.Usage.verified.txt' title='Start of snippet'>anchor</a></sup>

<!-- endSnippet -->