Extends Verify to allow comparison of text via Quibble.
Перейти к файлу
dependabot[bot] 0314752f19
Bump Microsoft.NET.Test.Sdk from 17.11.1 to 17.12.0 in /src (#250)
2024-11-19 16:19:40 +00:00
.github
src Bump Microsoft.NET.Test.Sdk from 17.11.1 to 17.12.0 in /src (#250) 2024-11-19 16:19:40 +00:00
.gitignore
code_of_conduct.md
license.txt
readme.md

readme.md

Verify.Quibble

Discussions Build status NuGet Status

Extends Verify to allow comparison of text via Quibble.

See Milestones for release notes.

NuGet package

https://nuget.org/packages/Verify.Quibble/

Usage

Initialize

[ModuleInitializer]
public static void Init()
{
    VerifierSettings.UseStrictJson();
    VerifyQuibble.Initialize();
}

snippet source | anchor

UseStrictJson is required since Verify by default uses a variant of json which Quibble cannot parse.

Verify

Given an existing verified file:

{
  "Property1": "ValueA",
  "Property2": "ValueB"
}

And a test:

[Test]
public async Task Sample()
{
    var target = new Target(
        Property1: "ValueC",
        Property2: "ValueD");
    await Verifier.Verify(target);
}

Diff results

When the comparison fails, the resulting differences will be included in the test result displayed to the user.

Results do not match.
Use DiffEngineTray to verify files.
Differences:
Received: Tests.Sample.received.json
Verified: Tests.Sample.verified.json
Compare Result:
String value difference at $.Property1: ValueC vs ValueA.
String value difference at $.Property2: ValueD vs ValueB.

Icon

Argument designed by Vinence Studio from The Noun Project.