ConsoleMVC.Testing 1.33.0

dotnet add package ConsoleMVC.Testing --version 1.33.0
                    
NuGet\Install-Package ConsoleMVC.Testing -Version 1.33.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="ConsoleMVC.Testing" Version="1.33.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ConsoleMVC.Testing" Version="1.33.0" />
                    
Directory.Packages.props
<PackageReference Include="ConsoleMVC.Testing" />
                    
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 ConsoleMVC.Testing --version 1.33.0
                    
#r "nuget: ConsoleMVC.Testing, 1.33.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.
#:package ConsoleMVC.Testing@1.33.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ConsoleMVC.Testing&version=1.33.0
                    
Install as a Cake Addin
#tool nuget:?package=ConsoleMVC.Testing&version=1.33.0
                    
Install as a Cake Tool

ConsoleMVC.Testing

End-to-end tests for ConsoleMVC applications. Run the application with scripted input, capture every screen as plain text, check the routes it visited, and compare screens with snapshot files. Works with xUnit, NUnit and MSTest.

dotnet add package ConsoleMVC.Testing
using ConsoleMVC.Testing;

[Fact]
public void Greeting_ShowsTheName()
{
    var host = MvcTestHost.For<HomeController>(builder =>
        builder.Services.AddSingleton<IGreetingService, FakeGreetings>());

    var run = host.Run(new ScriptedInput("2", "Ada")       // menu choice, then a name
        .Keys(ConsoleKey.DownArrow, ConsoleKey.Enter)      // a <select> answered with the arrow keys
        .Line("n")
        .Line("q"));

    Assert.Equal(["Home/Index", "Greet/Index", "Greet/Result"], run.Routes);
    Snapshot.Match(run.Screens[2], "greeting-result");     // __snapshots__/greeting-result.txt beside this file
}
Type Purpose
MvcTestHost Builds a fresh application per run with a fixed Width (80), the Testing environment and a MaxScreens guard (100) against applications that never wait
TestRun Screens, LastScreen, Output, Routes and RemainingInput
ScriptedInput Lines (Line, Lines) and keys (Keys, Key, Char); fields use the arrow keys exactly when the next step is a key. Wait() is a pause in which a screen with @refresh is drawn again, and Click(column, row) and Wheel(down) use the mouse
ScreenRecorder The render target behind the host, one entry per screen; usable with your own MarkupRenderer
Snapshot Snapshot.Match(text, "name"): creates the file on the first run, fails with the first different line afterwards, never creates one when CI is set; CONSOLEMVC_UPDATE_SNAPSHOTS=1 accepts changes

The guide is at Testing.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.33.0 56 10/28/2026
1.23.0 50 10/28/2026
1.22.0 45 10/28/2026
1.18.0 60 10/27/2026