From ba8d943e8cfbe866d29c94f3a1ad9e667ea290b3 Mon Sep 17 00:00:00 2001 From: Sander van Vliet Date: Mon, 15 Oct 2018 15:09:33 +0200 Subject: [PATCH] Update examples in readme --- README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ff6bbe9..3071fa6 100644 --- a/README.md +++ b/README.md @@ -61,17 +61,16 @@ public class WhenExecutingBusinessLogic { public void GivenInputOfFiveCharacters_MessageIsLogged() { - var inMemorySink = new Serilog.Sinks.InMemory.InMemorySink(); - var logger = new LoggerConfiguration() - .WriteTo.Sink(inMemorySink) + .WriteTo.InMemory() .CreateLogger(); var logic = new ComplicatedBusinessLogic(logger); logic.FirstTenCharacters("12345"); - logger + // Use the static Instance property to access the in-memory sink + InMemorySink.Instance .Should() .HaveMessage("Input is {count} characters long"); } @@ -100,7 +99,7 @@ public void GivenInputOfFiveCharacters_MessageIsLoggedOnce() { /* omitted for brevity */ - logger + InMemorySink.Instance .Should() .HaveMessage("Input is {count} characters long") .Appearing().Once(); @@ -116,7 +115,7 @@ public void GivenInputOfFiveCharacters_CountPropertyValueIsFive() { /* omitted for brevity */ - logger + InMemorySink.Instance .Should() .HaveMessage("Input is {count} characters long") .Appearing().Once(); @@ -134,7 +133,7 @@ public void GivenLoopWithFiveItems_MessageIsLoggedFiveTimes() { /* omitted for brevity */ - logger + InMemorySink.Instance .Should() .HaveMessage("Input is {count} characters long") .Appearing().Times(5);