MartinCostello.Logging.XUnit 0.5.1

dotnet add package MartinCostello.Logging.XUnit --version 0.5.1
                    
NuGet\Install-Package MartinCostello.Logging.XUnit -Version 0.5.1
                    
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.5.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.5.1" />
                    
Directory.Packages.props
<PackageReference Include="MartinCostello.Logging.XUnit" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MartinCostello.Logging.XUnit --version 0.5.1
                    
#r "nuget: MartinCostello.Logging.XUnit, 0.5.1"
                    
#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.
#addin nuget:?package=MartinCostello.Logging.XUnit&version=0.5.1
                    
Install MartinCostello.Logging.XUnit as a Cake Addin
#tool nuget:?package=MartinCostello.Logging.XUnit&version=0.5.1
                    
Install MartinCostello.Logging.XUnit as a Cake Tool

xunit Logging

Introduction

MartinCostello.Logging.XUnit and MartinCostello.Logging.XUnit.v3 provide 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; // For xunit v2 - not required for xunit v3

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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
SPG.Framework.IntegrationTest

Package Description

Sekiban.Testing

Sekiban - Event Sourcing Framework Testing

AElf.ContractTestKit

Contract testing kit.

AElf.ContractTestBase

Contract test base.

AElf.Contracts.TestKit

Contract testing kit.

GitHub repositories (28)

Showing the top 20 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
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)
AElfProject/AElf
An AI-enhanced cloud-native layer-1 blockchain network. 
kubernetes-client/csharp
Officially supported dotnet Kubernetes Client library
dotnet/aspire-samples
mehdihadeli/food-delivery-microservices
🍔 A practical and imaginary food delivery microservices, built with .Net 9, MassTransit, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
Libitum/jellyfin-plugin-douban
Douban metadata provider for Jellyfin
tonybaloney/CSnakes
Embed Python in .NET
weikio/PluginFramework
Everything is a Plugin in .NET
ObsidianMC/Obsidian
A C# implementation of the Minecraft server protocol.
temporalio/sdk-dotnet
Temporal .NET SDK
CommunityToolkit/Aspire
A community project with additional components and extensions for .NET Aspire
mehdihadeli/food-delivery-modular-monolith
🌭 A practical and imaginary food and grocery delivery modular monolith, built with .Net 8, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
meysamhadeli/booking-modular-monolith
Practical Modular Monolith, built with .Net 9, DDD, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
IEvangelist/azure-cosmos-dotnet-repository
Wraps the .NET SDK for Azure Cosmos DB abstracting away the complexity, exposing a simple CRUD-based repository pattern
BEagle1984/silverback
Silverback is a simple but feature-rich message bus for .NET core (it currently supports Kafka, RabbitMQ and MQTT).
erikbra/grate
grate - the SQL scripts migration runner
Overmiind/Puppeteer-sharp-extra
Plugin framework for PuppeteerSharp
Version Downloads Last updated
0.5.1 253,601 12/26/2024
0.5.0 13,782 12/20/2024
0.4.0 1,102,966 6/1/2024
0.3.0 4,072,366 5/22/2022
0.2.1 27,282 5/15/2022
0.2.0 766,783 10/3/2021
0.1.2 248,081 7/12/2021
0.1.1 285,832 3/26/2021
0.1.0 1,203,739 9/30/2018
0.1.0-beta1 857 9/26/2018
0.1.0-alpha4 2,711 8/20/2018
0.1.0-alpha3 805 8/19/2018
0.1.0-alpha2 791 8/19/2018
0.1.0-alpha1 794 8/19/2018