zplCore.comzplCore.com

ZplTestFrameworks

public static class ZplTestFrameworks

Optional adapters that turn a ZplAssertionException into the assertion exception of a test framework, so the framework reports a failed assertion instead of an unexpected exception (NUnit shows "Error" for foreign exceptions, MSTest prints "threw exception"). They work by reflection: this package does not reference any test framework. The original exception is kept as Exception.InnerException.

The default (ZplTestFrameworks.AutoDetect) picks NUnit or MSTest when exactly one of them is loaded and otherwise throws ZplAssertionException unchanged – which xUnit (v2 and v3), TUnit and every other runner report as a normal test failure.

Properties

PropertyTypeDescription
static AutoDetect { get; }Func<ZplAssertionException, Exception>Detects NUnit or MSTest from the loaded assemblies on the first failure (default).
static MSTest { get; }Func<ZplAssertionException, Exception>Throws MSTest's AssertFailedException (falls back to the original when MSTest is not loaded).
static NUnit { get; }Func<ZplAssertionException, Exception>Throws NUnit.Framework.AssertionException (falls back to the original when NUnit is not loaded).
static None { get; }Func<ZplAssertionException, Exception>Throws ZplAssertionException as it is.