MartinCostello.Logging.XUnit
0.4.0
dotnet add package MartinCostello.Logging.XUnit --version 0.4.0
NuGet\Install-Package MartinCostello.Logging.XUnit -Version 0.4.0
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.4.0" />
paket add MartinCostello.Logging.XUnit --version 0.4.0
#r "nuget: MartinCostello.Logging.XUnit, 0.4.0"
// Install MartinCostello.Logging.XUnit as a Cake Addin #addin nuget:?package=MartinCostello.Logging.XUnit&version=0.4.0 // Install MartinCostello.Logging.XUnit as a Cake Tool #tool nuget:?package=MartinCostello.Logging.XUnit&version=0.4.0
xunit Logging
Introduction
MartinCostello.Logging.XUnit
provides extensions to hook into the ILogger
infrastructure to output logs from your xunit tests to the test output.
Usage
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Xunit;
using Xunit.Abstractions;
namespace MyApp.Calculator;
public class CalculatorTests(ITestOutputHelper outputHelper)
{
[Fact]
public void Calculator_Sums_Two_Integers()
{
// Arrange
using var serviceProvider = new ServiceCollection()
.AddLogging((builder) => builder.AddXUnit(outputHelper))
.AddSingleton<Calculator>()
.BuildServiceProvider();
var calculator = services.GetRequiredService<Calculator>();
// Act
int actual = calculator.Sum(1, 2);
// Assert
Assert.AreEqual(3, actual);
}
}
public sealed class Calculator(ILogger<Calculator> logger)
{
public int Sum(int x, int y)
{
int sum = x + y;
logger.LogInformation("The sum of {x} and {y} is {sum}.", x, y, sum);
return sum;
}
}
Feedback
Any feedback or issues can be added to the issues for this project in GitHub.
License
This project is licensed under the Apache 2.0 license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Logging (>= 8.0.0)
- xunit.abstractions (>= 2.0.3)
- xunit.extensibility.execution (>= 2.4.1)
-
net8.0
- Microsoft.Extensions.Logging (>= 8.0.0)
- xunit.abstractions (>= 2.0.3)
- xunit.extensibility.execution (>= 2.4.1)
NuGet packages (15)
Showing the top 5 NuGet packages that depend on MartinCostello.Logging.XUnit:
Package | Downloads |
---|---|
Xunit.DependencyInjection.Logging
Support Microsoft.Extensions.Logging to ITestOutputHelper. public void Configure(IServiceProvider provider) { XunitTestOutputLoggerProvider.Register(provider); } |
|
FastEndpoints.Testing
Integration/End-To-End testing helper library for FastEndpoints |
|
SPG.Framework.IntegrationTest
Package Description |
|
Sekiban.Testing
Sekiban - Event Sourcing Framework Testing |
|
AElf.ContractTestKit
Contract testing kit. |
GitHub repositories (32)
Showing the top 5 popular GitHub repositories that depend on MartinCostello.Logging.XUnit:
Repository | Stars |
---|---|
FastEndpoints/FastEndpoints
A light-weight REST API development framework for ASP.NET 6 and newer.
|
|
openiddict/openiddict-core
Flexible and versatile OAuth 2.0/OpenID Connect stack for .NET
|
|
aspnet-contrib/AspNet.Security.OAuth.Providers
OAuth 2.0 social authentication providers for ASP.NET Core
|
|
CarterCommunity/Carter
Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable.
|
|
AElfProject/AElf
An AI-enhanced cloud-native layer-1 blockchain network.
|
Version | Downloads | Last updated |
---|---|---|
0.4.0 | 532,723 | 6/1/2024 |
0.3.0 | 3,508,323 | 5/22/2022 |
0.2.1 | 27,049 | 5/15/2022 |
0.2.0 | 721,357 | 10/3/2021 |
0.1.2 | 229,116 | 7/12/2021 |
0.1.1 | 275,271 | 3/26/2021 |
0.1.0 | 1,187,123 | 9/30/2018 |
0.1.0-beta1 | 790 | 9/26/2018 |
0.1.0-alpha4 | 2,646 | 8/20/2018 |
0.1.0-alpha3 | 744 | 8/19/2018 |
0.1.0-alpha2 | 726 | 8/19/2018 |
0.1.0-alpha1 | 736 | 8/19/2018 |
See https://github.com/martincostello/xunit-logging/releases for details.