Home

Awesome

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

Discussions Build status NuGet Status

Extends Verify to allow verification of Serilog bits.

See Milestones for release notes.

NuGet package

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

Usage

<!-- snippet: Enable -->

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

[ModuleInitializer]
public static void Initialize() =>
    VerifySerilog.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()
{
    Log.Error("The Message");
    return "Result";
}

<sup><a href='/src/Tests/Tests.cs#L3-L21' 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 Message
  }
}

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

<!-- endSnippet -->