<!--
GENERATED FILE - DO NOT EDIT
This file was generated by [MarkdownSnippets](https://github.com/SimonCropp/MarkdownSnippets).
Source File: /docs/mdsource/named-tuples.source.md
To change this file edit the source file and then run MarkdownSnippets.
-->

# Named Tuples

Instances of [named tuples](https://docs.microsoft.com/en-us/dotnet/csharp/tuples#named-and-unnamed-tuples) can be verified.

Due to the use of [ITuple](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.ituple), this approach is only available an net472+ and netcoreapp2.2+.

Given a method that returns a named tuple:

<!-- snippet: MethodWithNamedTuple -->
<a id='snippet-MethodWithNamedTuple'></a>
```cs
static (bool Member1, string Member2, string Member3) MethodWithNamedTuple() =>
    (true, "A", "B");
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2000-L2005' title='Snippet source file'>snippet source</a> | <a href='#snippet-MethodWithNamedTuple' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Can be verified:

<!-- snippet: VerifyTuple -->
<a id='snippet-VerifyTuple'></a>
```cs
await VerifyTuple(() => MethodWithNamedTuple());
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1994-L1998' title='Snippet source file'>snippet source</a> | <a href='#snippet-VerifyTuple' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Resulting in:

<!-- snippet: SerializationTests.NamedTuple.verified.txt -->
<a id='snippet-SerializationTests.NamedTuple.verified.txt'></a>
```txt
{
  Member1: true,
  Member2: A,
  Member3: B
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.NamedTuple.verified.txt#L1-L5' title='Snippet source file'>snippet source</a> | <a href='#snippet-SerializationTests.NamedTuple.verified.txt' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->