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
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MartinCostello.Logging.XUnit --version 0.4.0
#r "nuget: MartinCostello.Logging.XUnit, 0.4.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (14)

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

AElf.Contracts.TestKit

Contract testing kit.

SPG.Framework.IntegrationTest

Package Description

AElf.ContractTestKit

Contract testing kit.

GitHub repositories (24)

Showing the top 5 popular GitHub repositories that depend on MartinCostello.Logging.XUnit:

Repository Stars
openiddict/openiddict-core
Flexible and versatile OAuth 2.0/OpenID Connect stack for .NET
FastEndpoints/FastEndpoints
A light-weight REST API development framework for ASP.NET 6 and newer.
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.
shinyorg/shiny
.NET Framework for Backgrounding & Device Hardware Services (iOS, Android, & Catalyst)
Version Downloads Last updated
0.4.0 512 6/1/2024
0.3.0 2,699,647 5/22/2022
0.2.1 26,855 5/15/2022
0.2.0 670,253 10/3/2021
0.1.2 203,211 7/12/2021
0.1.1 261,346 3/26/2021
0.1.0 1,160,338 9/30/2018
0.1.0-beta1 746 9/26/2018
0.1.0-alpha4 2,612 8/20/2018
0.1.0-alpha3 710 8/19/2018
0.1.0-alpha2 690 8/19/2018
0.1.0-alpha1 700 8/19/2018