diff --git a/LICENSE b/LICENSE index 0d55ffa..aae7edc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Stravaig Contributors +Copyright (c) 2020 Stravaig Projects' Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/release-notes/wip-release-notes.md b/release-notes/wip-release-notes.md index d4ed6a8..4b43d59 100644 --- a/release-notes/wip-release-notes.md +++ b/release-notes/wip-release-notes.md @@ -30,6 +30,7 @@ Date: ??? - #179: Update github pages pipeline. - #181: Add support for .NET 9.0. - #183: Update github action workflow to separate the build and deploy stages. +- #185: Add package readme to the XUnit extensions package ### Dependencies diff --git a/src/Stravaig.Extensions.Logging.Diagnostics.XUnit/Stravaig.Extensions.Logging.Diagnostics.XUnit.csproj b/src/Stravaig.Extensions.Logging.Diagnostics.XUnit/Stravaig.Extensions.Logging.Diagnostics.XUnit.csproj index 81ca656..5eae679 100644 --- a/src/Stravaig.Extensions.Logging.Diagnostics.XUnit/Stravaig.Extensions.Logging.Diagnostics.XUnit.csproj +++ b/src/Stravaig.Extensions.Logging.Diagnostics.XUnit/Stravaig.Extensions.Logging.Diagnostics.XUnit.csproj @@ -6,13 +6,14 @@ XUnit extensions for Stravaig Logging Capture for Tests $(STRAVAIG_NUGET_VERSION) Colin Angus Mackay - ©$2023-(YEAR) Colin Angus Mackay. See licence for more information. + ©2023-$(YEAR) Colin Angus Mackay. See licence for more information. https://stravaig-projects.github.io/Stravaig.Extensions.Logging.Diagnostics/ MIT https://github.com/Stravaig-Projects/Stravaig.Extensions.Logging.Diagnostics stravaig-icon.png logging testing xunit true + readme.md XUnit extensions for Stravaig Logging Capture for Tests. @@ -29,6 +30,10 @@ true / + + True + / + diff --git a/src/Stravaig.Extensions.Logging.Diagnostics.XUnit/readme.md b/src/Stravaig.Extensions.Logging.Diagnostics.XUnit/readme.md new file mode 100644 index 0000000..9c6b3e5 --- /dev/null +++ b/src/Stravaig.Extensions.Logging.Diagnostics.XUnit/readme.md @@ -0,0 +1,45 @@ +# About + +XUnit extensions for [Stravaig Log Capture](https://www.nuget.org/packages/Stravaig.Extensions.Logging.Diagnostics/) add helper extension methods for outputting the captured logs via XUnit's `IOutputTestHelper`. + +## Version & Framework support + +* v2.x: Supports .NET 6.0, 7.0 & 8.0 +* v3.x: Supports .NET 6.0, 8.0 & 9.0 + + +## How to use + +For simple tests you can pass the logger into the class under test like this: + +```csharp +public class MyTestClass +{ + private readonly IOutputTestHelper _output; + + public MyTestClass(IOutputTestHelper output) + { + _output = output; + } + + [Fact] + public void EnsureSomeFunctionalityWorks() + { + // Arrange + var logger = new TestCaptureLogger(); + var service = new ServiceClass(logger); + + // Act + service.DoSomething(); + + // Assert + _output.WriteLogs(logger); // Writes all captured logs to the output. + logger.GetLogs().Count.ShouldBe(1); + } +} +``` + +## See also + +* [Full Documentation](https://stravaig-projects.github.io/Stravaig.Extensions.Logging.Diagnostics/docs/library/xunit-extensions.html) +* [Release Notes](https://github.com/Stravaig-Projects/Stravaig.Extensions.Logging.Diagnostics/releases) diff --git a/src/Stravaig.Extensions.Logging.Diagnostics/readme.md b/src/Stravaig.Extensions.Logging.Diagnostics/readme.md index 83b65c9..556a8c7 100644 --- a/src/Stravaig.Extensions.Logging.Diagnostics/readme.md +++ b/src/Stravaig.Extensions.Logging.Diagnostics/readme.md @@ -42,4 +42,7 @@ public void EnsureSomeFunctionalityWorks() } ``` -For more details on more complex scenarios, see the full documentation at https://stravaig-projects.github.io/Stravaig.Extensions.Logging.Diagnostics/ +## See also + +* [Full Documentation](https://stravaig-projects.github.io/Stravaig.Extensions.Logging.Diagnostics/) +* [Release Notes](https://github.com/Stravaig-Projects/Stravaig.Extensions.Logging.Diagnostics/releases)