SpawnDev.UnitTesting.Desktop
2.5.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SpawnDev.UnitTesting.Desktop --version 2.5.0
NuGet\Install-Package SpawnDev.UnitTesting.Desktop -Version 2.5.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="SpawnDev.UnitTesting.Desktop" Version="2.5.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SpawnDev.UnitTesting.Desktop" Version="2.5.0" />
<PackageReference Include="SpawnDev.UnitTesting.Desktop" />
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 SpawnDev.UnitTesting.Desktop --version 2.5.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SpawnDev.UnitTesting.Desktop, 2.5.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 SpawnDev.UnitTesting.Desktop@2.5.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=SpawnDev.UnitTesting.Desktop&version=2.5.0
#tool nuget:?package=SpawnDev.UnitTesting.Desktop&version=2.5.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NuGet
SpawnDev.UnitTesting
A lightweight, cross-platform unit testing framework for .NET. Works everywhere — Blazor WASM, WPF, Console, and more.
Supersedes SpawnDev.Blazor.UnitTesting with a platform-agnostic core.
Features
- Cross-platform — no Blazor, WPF, or browser dependencies in the core library
- Simple API —
[TestMethod]attribute andUnitTestRunnerfor reflection-based discovery - Async support — full
async Tasktest methods with configurable timeouts - Unsupported tests — throw
UnsupportedTestExceptionto skip tests gracefully - Blazor UI —
SpawnDev.UnitTesting.BlazorprovidesUnitTestsViewRazor component - WPF Desktop UI —
SpawnDev.UnitTesting.DesktopprovidesUnitTestsControlandUnitTestsWindow
Quick Start
1. Create test classes
using SpawnDev.UnitTesting;
public class MyTests
{
[TestMethod]
public async Task AdditionTest()
{
int result = 1 + 1;
if (result != 2) throw new Exception($"Expected 2, got {result}");
}
[TestMethod]
public async Task UnsupportedFeatureTest()
{
throw new UnsupportedTestException("Feature not available on this platform");
}
}
2. Run tests programmatically
var runner = new UnitTestRunner();
runner.SetTestTypes(new[] { typeof(MyTests) });
runner.TestStatusChanged += () => Console.WriteLine($"Progress: {runner.Tests.Count(t => t.State == TestState.Done)}/{runner.Tests.Count}");
await runner.RunTests();
3. Blazor UI (SpawnDev.UnitTesting.Blazor)
@using SpawnDev.UnitTesting.Blazor
<UnitTestsView TestAssemblies="_assemblies"></UnitTestsView>
@code {
IEnumerable<Assembly>? _assemblies = new List<Assembly> {
typeof(MyTests).Assembly
};
}
4. WPF Desktop UI (SpawnDev.UnitTesting.Desktop)
Option A — Standalone Window:
var testWindow = new SpawnDev.UnitTesting.Desktop.UnitTestsWindow
{
TestTypes = new[] { typeof(MyTests) },
AutoRun = true,
};
testWindow.Show();
Option B — Embeddable UserControl:
<local:UnitTestsControl x:Name="TestControl" />
TestControl.TestTypes = new[] { typeof(MyTests) };
TestControl.AutoRun = true;
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0-windows7.0
- SpawnDev.UnitTesting (>= 2.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.