Skip to content

About

Expectations for logging with Microsoft.Extensions.Logging for aweXpect.

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aweXpect.Logging

Nuget Build Quality Gate Status Coverage Mutation testing badge

Expectations for logging with Microsoft.Extensions.Logging for aweXpect.

At a glance

// collect the log records with a FakeLogger from Microsoft.Extensions.Diagnostics.Testing
FakeLogCollector collector = new();
ILogger logger = new FakeLogger(collector);
logger.LogWarning("Retry limit reached");

// verify that a record with the log level was logged
await Expect.That(collector).LoggedWarning();

A failing expectation lists the collected records. If only an error was logged, LoggedWarning() would fail with:

Expected that collector
logged a record with level Warning at least once,
but it did not log any such record

Records:
[
  [Error] "Retry limit reached"
]

Overview

Expectation Subject Summary
Logged FakeLogCollector, FakeLogger logged at least one record with the log level, e.g. LoggedWarning()
DidNotLog FakeLogCollector, FakeLogger logged no record with the log level, e.g. DidNotLogError()

Documentation

The full documentation is available at docs.testably.org:

  • Log records: Logged and DidNotLog on the records of a FakeLogCollector

About

Expectations for logging with Microsoft.Extensions.Logging for aweXpect.

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Sponsor this project

Contributors

Languages