MackySoft.Testing.Xunit
0.1.0
dotnet add package MackySoft.Testing.Xunit --version 0.1.0
NuGet\Install-Package MackySoft.Testing.Xunit -Version 0.1.0
<PackageReference Include="MackySoft.Testing.Xunit" Version="0.1.0" />
<PackageVersion Include="MackySoft.Testing.Xunit" Version="0.1.0" />
<PackageReference Include="MackySoft.Testing.Xunit" />
paket add MackySoft.Testing.Xunit --version 0.1.0
#r "nuget: MackySoft.Testing.Xunit, 0.1.0"
#:package MackySoft.Testing.Xunit@0.1.0
#addin nuget:?package=MackySoft.Testing.Xunit&version=0.1.0
#tool nuget:?package=MackySoft.Testing.Xunit&version=0.1.0
MackySoft.Testing.Xunit
MackySoft.Testing.Xunit provides xUnit assertions for filesystem and JSON test contracts.
The package targets net8.0 and depends on MackySoft.Testing.IO and xunit.assert. Assertion failures include the inspected path or JSON location where applicable.
Installation
Install a pinned version from nuget.org:
dotnet add package MackySoft.Testing.Xunit --version <version>
Filesystem Assertions
using MackySoft.Testing.Xunit.IO;
FileSystemAssert.ForFile(resultPath)
.Exists()
.IsUnderDirectory(testDirectory)
.HasFileName("result.json")
.HasExtension("json");
FileSystemAssert.ForDirectory(testDirectory)
.HasDirectory("assets")
.HasFile("result.json")
.MatchesExactly();
Path equality and containment assertions normalize absolute paths, symbolic links, and macOS /private aliases before comparison. Directory child assertions use portable single-segment names and can require the exact immediate entry set.
JSON Assertions
using System.Text.Json;
using MackySoft.Testing.Xunit.Json;
using JsonDocument document = JsonDocument.Parse(json);
JsonAssert.For(document.RootElement)
.HasString("status", "ready")
.HasInt32("attempt", 2)
.HasProperty("items", 0, item =>
item.HasString("name", "first"));
The fluent assertion rejects duplicate object property names and reports the containing object path.
For a small reusable structure assertion, build an in-memory schema:
JsonSchemaNode schema = JsonSchemaNode.Object(root => root
.Required("status", JsonSchemaNode.Value(JsonSchemaType.String))
.RequiredArrayOfObject("items", item => item
.Required("name", JsonSchemaNode.Value(JsonSchemaType.String))),
allowAdditionalProperties: false);
JsonAssert.For(document.RootElement)
.MatchesSchema(schema, "result document");
This model is an assertion helper, not an implementation or parser of the JSON Schema specification.
Golden JSON
GoldenJsonAssert.EqualFile(expectedJsonPath, actualJson);
Golden comparison first validates both inputs as JSON and then compares their text ordinally. Whitespace, property order, and line endings are part of the contract. Golden files must be valid UTF-8 without a byte-order mark, and callers provide their path explicitly.
Repository and Support
Source, issues, and support are available in the MackySoft .NET Foundations repository.
License
This package is under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net10.0 was computed. 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. |
-
net8.0
- MackySoft.Testing.IO (>= 0.1.0)
- xunit.assert (>= 2.9.3)
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 |
|---|---|---|
| 0.1.0 | 639 | 8/9/2026 |