You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file was generated by [MarkdownSnippets](https://github.com/SimonCropp/MarkdownSnippets).
4
+
Source File: /docs/mdsource/encoding.source.md
5
+
To change this file edit the source file and then run MarkdownSnippets.
6
+
-->
7
+
8
+
# Encoding
9
+
10
+
## UseUtf8NoBom
11
+
12
+
The default encoding for snapshot files uses UTF-8 with byte order marks (BOM) enable. To disable UTF-8 BOMs, call `VerifierSettings.UseUtf8NoBom`.
13
+
14
+
<!-- snippet: UseUtf8NoBom -->
15
+
<aid='snippet-UseUtf8NoBom'></a>
16
+
```cs
17
+
publicstaticclassModuleInitializer
18
+
{
19
+
[ModuleInitializer]
20
+
publicstaticvoidInit() =>
21
+
VerifierSettings.UseUtf8NoBom();
22
+
}
23
+
```
24
+
<sup><ahref='/src/ModuleInitDocs/UseUtf8NoBom.cs#L3-L12'title='Snippet source file'>snippet source</a> | <ahref='#snippet-UseUtf8NoBom'title='Start of snippet'>anchor</a></sup>
25
+
<!-- endSnippet -->
26
+
27
+
28
+
## UseEncoding
29
+
30
+
To override the encoding used for snapshot files, replacing the default UTF-8 encoding, call `VerifierSettings.UseEncoding` providing a `System.Text.Encoding` instance.
31
+
32
+
<!-- snippet: UseEncoding -->
33
+
<aid='snippet-UseEncoding'></a>
34
+
```cs
35
+
publicstaticclassModuleInitializer
36
+
{
37
+
[ModuleInitializer]
38
+
publicstaticvoidInit()
39
+
{
40
+
varencoding=newUnicodeEncoding(
41
+
bigEndian: false,
42
+
byteOrderMark: true,
43
+
throwOnInvalidBytes: true);
44
+
VerifierSettings.UseEncoding(encoding);
45
+
}
46
+
}
47
+
```
48
+
<sup><ahref='/src/ModuleInitDocs/UseEncoding.cs#L3-L18'title='Snippet source file'>snippet source</a> | <ahref='#snippet-UseEncoding'title='Start of snippet'>anchor</a></sup>
To change this file edit the source file and then run MarkdownSnippets.
6
+
-->
7
+
8
+
# JsonAppender
9
+
10
+
A JsonAppender allows extra content (key value pairs) to be optionally appended to the output being verified. JsonAppenders can use the current context to determine what should be appended or if anything should be appended.
11
+
12
+
Register a JsonAppender:
13
+
14
+
<!-- snippet: RegisterJsonAppender -->
15
+
<aid='snippet-RegisterJsonAppender'></a>
16
+
```cs
17
+
VerifierSettings.RegisterJsonAppender(
18
+
context=>
19
+
{
20
+
if (ShouldInclude(context))
21
+
{
22
+
returnnewToAppend("theData", "theValue");
23
+
}
24
+
25
+
returnnull;
26
+
});
27
+
```
28
+
<sup><ahref='/src/Verify.Tests/Converters/JsonAppenderTests.cs#L7-L18'title='Snippet source file'>snippet source</a> | <ahref='#snippet-RegisterJsonAppender'title='Start of snippet'>anchor</a></sup>
29
+
<!-- endSnippet -->
30
+
31
+
When when content is verified:
32
+
33
+
<!-- snippet: JsonAppender -->
34
+
<aid='snippet-JsonAppender'></a>
35
+
```cs
36
+
[Fact]
37
+
publicTaskWithJsonAppender() =>
38
+
Verify("TheValue");
39
+
```
40
+
<sup><ahref='/src/Verify.Tests/Converters/JsonAppenderTests.cs#L30-L36'title='Snippet source file'>snippet source</a> | <ahref='#snippet-JsonAppender'title='Start of snippet'>anchor</a></sup>
41
+
<!-- endSnippet -->
42
+
43
+
The content from RegisterJsonAppender will be included in the output:
<sup><ahref='/src/Verify.Tests/Converters/JsonAppenderTests.Stream#00.verified.txt#L1-L4'title='Snippet source file'>snippet source</a> | <ahref='#snippet-JsonAppenderTests.Stream#00.verified.txt'title='Start of snippet'>anchor</a></sup>
79
+
<!-- endSnippet -->
80
+
81
+
See [Converters](/docs/converter.md) for more information on `*.00.verified.txt` files.
82
+
83
+
Examples of extensions using JsonAppenders are [Recorders in Verify.SqlServer](https://github.com/VerifyTests/Verify.SqlServer#recording) and [Recorders in Verify.EntityFramework](https://github.com/VerifyTests/Verify.EntityFramework#recording).
A JsonAppender allows extra content (key value pairs) to be optionally appended to the output being verified. JsonAppenders can use the current context to determine what should be appended or if anything should be appended.
4
+
5
+
Register a JsonAppender:
6
+
7
+
snippet: RegisterJsonAppender
8
+
9
+
When when content is verified:
10
+
11
+
snippet: JsonAppender
12
+
13
+
The content from RegisterJsonAppender will be included in the output:
Then the appended content will be added to the `.verified.txt` file:
22
+
23
+
snippet: JsonAppenderTests.Stream#00.verified.txt
24
+
25
+
See [Converters](/docs/converter.md) for more information on `*.00.verified.txt` files.
26
+
27
+
Examples of extensions using JsonAppenders are [Recorders in Verify.SqlServer](https://github.com/VerifyTests/Verify.SqlServer#recording) and [Recorders in Verify.EntityFramework](https://github.com/VerifyTests/Verify.EntityFramework#recording).
Copy file name to clipboardExpand all lines: docs/mdsource/serializer-settings.source.md
+1-29Lines changed: 1 addition & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -286,35 +286,6 @@ The value of a member can be mutated before serialization:
286
286
snippet: MemberConverter
287
287
288
288
289
-
## JsonAppender
290
-
291
-
A JsonAppender allows extra content (key value pairs) to be optionally appended to the output being verified. JsonAppenders can use the current context to determine what should be appended or if anything should be appended.
292
-
293
-
Register a JsonAppender:
294
-
295
-
snippet: RegisterJsonAppender
296
-
297
-
When when content is verified:
298
-
299
-
snippet: JsonAppender
300
-
301
-
The content from RegisterJsonAppender will be included in the output:
Then the appended content will be added to the `.verified.txt` file:
310
-
311
-
snippet: JsonAppenderTests.Stream#00.verified.txt
312
-
313
-
See [Converters](/docs/converter.md) for more information on `*.00.verified.txt` files.
314
-
315
-
Examples of extensions using JsonAppenders are [Recorders in Verify.SqlServer](https://github.com/VerifyTests/Verify.SqlServer#recording) and [Recorders in Verify.EntityFramework](https://github.com/VerifyTests/Verify.EntityFramework#recording).
316
-
317
-
318
289
## See also
319
290
320
291
*[Obsolete members](/docs/obsolete-members.md)
@@ -324,3 +295,4 @@ Examples of extensions using JsonAppenders are [Recorders in Verify.SqlServer](h
Copy file name to clipboardExpand all lines: docs/serializer-settings.md
+2-120Lines changed: 2 additions & 120 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,48 +112,6 @@ The resulting file will be:
112
112
<!-- endSnippet -->
113
113
114
114
115
-
## UseUtf8NoBom
116
-
117
-
The default encoding for snapshot files uses UTF-8 with byte order marks (BOM) enable. To disable UTF-8 BOMs, call `VerifierSettings.UseUtf8NoBom`.
118
-
119
-
<!-- snippet: UseUtf8NoBom -->
120
-
<aid='snippet-UseUtf8NoBom'></a>
121
-
```cs
122
-
publicstaticclassModuleInitializer
123
-
{
124
-
[ModuleInitializer]
125
-
publicstaticvoidInit() =>
126
-
VerifierSettings.UseUtf8NoBom();
127
-
}
128
-
```
129
-
<sup><ahref='/src/ModuleInitDocs/UseUtf8NoBom.cs#L3-L12'title='Snippet source file'>snippet source</a> | <ahref='#snippet-UseUtf8NoBom'title='Start of snippet'>anchor</a></sup>
130
-
<!-- endSnippet -->
131
-
132
-
133
-
## UseEncoding
134
-
135
-
To override the encoding used for snapshot files, replacing the default UTF-8 encoding, call `VerifierSettings.UseEncoding` providing a `System.Text.Encoding` instance.
136
-
137
-
<!-- snippet: UseEncoding -->
138
-
<aid='snippet-UseEncoding'></a>
139
-
```cs
140
-
publicstaticclassModuleInitializer
141
-
{
142
-
[ModuleInitializer]
143
-
publicstaticvoidInit()
144
-
{
145
-
varencoding=newUnicodeEncoding(
146
-
bigEndian: false,
147
-
byteOrderMark: true,
148
-
throwOnInvalidBytes: true);
149
-
VerifierSettings.UseEncoding(encoding);
150
-
}
151
-
}
152
-
```
153
-
<sup><ahref='/src/ModuleInitDocs/UseEncoding.cs#L3-L18'title='Snippet source file'>snippet source</a> | <ahref='#snippet-UseEncoding'title='Start of snippet'>anchor</a></sup>
154
-
<!-- endSnippet -->
155
-
156
-
157
115
## Default settings
158
116
159
117
Verify uses [Argon](https://github.com/SimonCropp/Argon) for serialization.
@@ -1309,84 +1267,6 @@ public Task MemberConverterByExpression()
1309
1267
<!-- endSnippet -->
1310
1268
1311
1269
1312
-
## JsonAppender
1313
-
1314
-
A JsonAppender allows extra content (key value pairs) to be optionally appended to the output being verified. JsonAppenders can use the current context to determine what should be appended or if anything should be appended.
1315
-
1316
-
Register a JsonAppender:
1317
-
1318
-
<!-- snippet: RegisterJsonAppender -->
1319
-
<aid='snippet-RegisterJsonAppender'></a>
1320
-
```cs
1321
-
VerifierSettings.RegisterJsonAppender(
1322
-
context=>
1323
-
{
1324
-
if (ShouldInclude(context))
1325
-
{
1326
-
returnnewToAppend("theData", "theValue");
1327
-
}
1328
-
1329
-
returnnull;
1330
-
});
1331
-
```
1332
-
<sup><ahref='/src/Verify.Tests/Converters/JsonAppenderTests.cs#L7-L18'title='Snippet source file'>snippet source</a> | <ahref='#snippet-RegisterJsonAppender'title='Start of snippet'>anchor</a></sup>
1333
-
<!-- endSnippet -->
1334
-
1335
-
When when content is verified:
1336
-
1337
-
<!-- snippet: JsonAppender -->
1338
-
<aid='snippet-JsonAppender'></a>
1339
-
```cs
1340
-
[Fact]
1341
-
publicTaskWithJsonAppender() =>
1342
-
Verify("TheValue");
1343
-
```
1344
-
<sup><ahref='/src/Verify.Tests/Converters/JsonAppenderTests.cs#L30-L36'title='Snippet source file'>snippet source</a> | <ahref='#snippet-JsonAppender'title='Start of snippet'>anchor</a></sup>
1345
-
<!-- endSnippet -->
1346
-
1347
-
The content from RegisterJsonAppender will be included in the output:
<sup><ahref='/src/Verify.Tests/Converters/JsonAppenderTests.Stream#00.verified.txt#L1-L4'title='Snippet source file'>snippet source</a> | <ahref='#snippet-JsonAppenderTests.Stream#00.verified.txt'title='Start of snippet'>anchor</a></sup>
1383
-
<!-- endSnippet -->
1384
-
1385
-
See [Converters](/docs/converter.md) for more information on `*.00.verified.txt` files.
1386
-
1387
-
Examples of extensions using JsonAppenders are [Recorders in Verify.SqlServer](https://github.com/VerifyTests/Verify.SqlServer#recording) and [Recorders in Verify.EntityFramework](https://github.com/VerifyTests/Verify.EntityFramework#recording).
1388
-
1389
-
1390
1270
## See also
1391
1271
1392
1272
*[Obsolete members](/docs/obsolete-members.md)
@@ -1395,3 +1275,5 @@ Examples of extensions using JsonAppenders are [Recorders in Verify.SqlServer](h
0 commit comments