Verify/docs/named-tuples.md

1.8 KiB

Named Tuples

Instances of named tuples can be verified.

Due to the use of ITuple, this approach is only available an net472+ and netcoreapp2.2+.

Given a method that returns a named tuple:

static (bool Member1, string Member2, string Member3) MethodWithNamedTuple() =>
    (true, "A", "B");

snippet source | anchor

Can be verified:

await VerifyTuple(() => MethodWithNamedTuple());

snippet source | anchor

Resulting in:

{
  Member1: true,
  Member2: A,
  Member3: B
}

snippet source | anchor