TestConsole 2.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package TestConsole --version 2.2.1
NuGet\Install-Package TestConsole -Version 2.2.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="TestConsole" Version="2.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TestConsole --version 2.2.1
#r "nuget: TestConsole, 2.2.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.
// Install TestConsole as a Cake Addin
#addin nuget:?package=TestConsole&version=2.2.1

// Install TestConsole as a Cake Tool
#tool nuget:?package=TestConsole&version=2.2.1

Unit tests will often need to assert that a sizeable amount of data matches an expectation, and this is difficult with only the traditional style of assertion. You essentially have the choice of writing a long list of simple assertions, or concatenating the output into a string and using a single assert against that. However, when these assertions fail it can be very hard to determine in what ways the output differs from the expectation.

One solution to this problem is a different workflow from traditional unit testing - instead of making a prediction in the code, and then checking the output against the prediction, what if you  formatted the output and displayed it side by side with the last "approved" version. This is what TestConsole.Core provides. On a build server, when the test result does not match the default behaviour is just to fail the test, whereas on a development PC you can configure the library to use an installed file compare utility to display the differences. If the differences are expected, you can copy the new result over to the approved version and the test will pass.

TestConsole.Core inherits all of the formatting capabilities from the original TestConsole project, and adds test approval features. Users of ApprovalTests will recognise the workflow and the functionality, but at the time of publishing, ApprovalTests is full framework only, whereas TestConsole.Core is intended to allow testing in both full framework and .NET core test suites. I did not set out to build an alternative to ApprovalTests, but I need to be able to test netcoreapp code, and the conversion of TestConsole was not difficult. However, ApprovalTests did not support netstandard or netcoreapp test suites and I couldn't wait any longer, so I built the subset of ApprovalTests features that I needed into TestConsole.Core from scratch. As a result, the syntax is a little different to ApprovalTests, particularly where it relates to selecting a file compare tool, and also relating to what can be directly approved. The intention  of the test approval features is to allow data formatted using the TestConsole Output object to be approved, and I've also extended it to handle any plain text.

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 was computed.  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 (2)

Showing the top 2 NuGet packages that depend on TestConsole:

Package Downloads
SnapshotTests

SnapshotTests is a library that supports TDD by allowing snapshots to be taken of datasets before and after a test operation. The differences between the snapshots can be computed and formatted for approval. The library relies on TestConsole for formatting and the approval mechanism.

VMTest

Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.6.0 1,307 10/3/2021
2.5.2-beta 1,051 11/29/2020
2.5.1-beta 918 11/14/2020
2.5.0 1,457 10/18/2020
2.3.3-beta 1,020 8/26/2020
2.3.2-beta 1,051 8/15/2020
2.3.1-beta 1,070 8/12/2020
2.3.0 1,160 7/19/2020
2.2.1 1,265 3/8/2020
2.2.0 1,145 3/1/2020
2.1.1 1,436 10/13/2019
2.1.0 1,182 10/13/2019
2.0.2 1,265 8/3/2019
2.0.1 1,184 7/30/2019
2.0.0 1,557 10/10/2018
1.0.9 1,644 5/6/2018
1.0.8 2,301 9/27/2015
1.0.7 1,948 9/25/2015
1.0.5 2,234 8/8/2015
1.0.4 2,458 8/3/2015
1.0.3 2,175 8/3/2015
1.0.2 1,913 7/9/2015
1.0.1.3 1,937 7/6/2015
1.0.1.2 1,930 7/5/2015
1.0.1.1 1,835 6/17/2015
1.0.1 1,909 6/11/2015
1.0.0 1,944 5/27/2015

Added the ability for table formatting via TableFormat or AsReport to opt to exceed buffer limits. This means tables can be arbitrarily wide. The empty line at the end of some test outputs is now a blank line instead of a row of space characters, which may break some tests. The previous release had a bug which blocked the feature if you were not using a custom report.