Skip to content

Commit 7b7b409

Browse files
authored
Respect null value handling in WriteMember for converter (#1346)
1 parent c889294 commit 7b7b409

26 files changed

+191
-56
lines changed

docs/dates.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var target = new DateTimeTarget
2929

3030
await Verify(target);
3131
```
32-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1022-L1041' title='Snippet source file'>snippet source</a> | <a href='#snippet-Date' title='Start of snippet'>anchor</a></sup>
32+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1044-L1063' title='Snippet source file'>snippet source</a> | <a href='#snippet-Date' title='Start of snippet'>anchor</a></sup>
3333
<!-- endSnippet -->
3434

3535
Results in the following:
@@ -70,7 +70,7 @@ settings.DontScrubDateTimes();
7070

7171
return Verify(target, settings);
7272
```
73-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1661-L1673' title='Snippet source file'>snippet source</a> | <a href='#snippet-DontScrubDateTimes' title='Start of snippet'>anchor</a></sup>
73+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1683-L1695' title='Snippet source file'>snippet source</a> | <a href='#snippet-DontScrubDateTimes' title='Start of snippet'>anchor</a></sup>
7474
<!-- endSnippet -->
7575

7676

@@ -87,7 +87,7 @@ var target = new
8787
return Verify(target)
8888
.DontScrubDateTimes();
8989
```
90-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1679-L1689' title='Snippet source file'>snippet source</a> | <a href='#snippet-DontScrubDateTimesFluent' title='Start of snippet'>anchor</a></sup>
90+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1701-L1711' title='Snippet source file'>snippet source</a> | <a href='#snippet-DontScrubDateTimesFluent' title='Start of snippet'>anchor</a></sup>
9191
<!-- endSnippet -->
9292

9393

@@ -100,7 +100,7 @@ return Verify(target)
100100
public static void ModuleInitializer() =>
101101
VerifierSettings.DontScrubDateTimes();
102102
```
103-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1747-L1753' title='Snippet source file'>snippet source</a> | <a href='#snippet-DontScrubDateTimesGlobal' title='Start of snippet'>anchor</a></sup>
103+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1769-L1775' title='Snippet source file'>snippet source</a> | <a href='#snippet-DontScrubDateTimesGlobal' title='Start of snippet'>anchor</a></sup>
104104
<!-- endSnippet -->
105105

106106

@@ -124,7 +124,7 @@ settings.DisableDateCounting();
124124

125125
return Verify(target, settings);
126126
```
127-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1708-L1720' title='Snippet source file'>snippet source</a> | <a href='#snippet-DisableDateCounting' title='Start of snippet'>anchor</a></sup>
127+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1730-L1742' title='Snippet source file'>snippet source</a> | <a href='#snippet-DisableDateCounting' title='Start of snippet'>anchor</a></sup>
128128
<!-- endSnippet -->
129129

130130

@@ -141,7 +141,7 @@ var target = new
141141
return Verify(target)
142142
.DisableDateCounting();
143143
```
144-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1726-L1736' title='Snippet source file'>snippet source</a> | <a href='#snippet-DisableDateCountingFluent' title='Start of snippet'>anchor</a></sup>
144+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1748-L1758' title='Snippet source file'>snippet source</a> | <a href='#snippet-DisableDateCountingFluent' title='Start of snippet'>anchor</a></sup>
145145
<!-- endSnippet -->
146146

147147

@@ -154,7 +154,7 @@ return Verify(target)
154154
public static void ModuleInitializer() =>
155155
VerifierSettings.DisableDateCounting();
156156
```
157-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1695-L1701' title='Snippet source file'>snippet source</a> | <a href='#snippet-DisableDateCountingGlobal' title='Start of snippet'>anchor</a></sup>
157+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1717-L1723' title='Snippet source file'>snippet source</a> | <a href='#snippet-DisableDateCountingGlobal' title='Start of snippet'>anchor</a></sup>
158158
<!-- endSnippet -->
159159

160160

@@ -201,7 +201,7 @@ public Task ScrubInlineDateTimesInstance()
201201
settings);
202202
}
203203
```
204-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1631-L1643' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineDateTimesInstance' title='Start of snippet'>anchor</a></sup>
204+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1653-L1665' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineDateTimesInstance' title='Start of snippet'>anchor</a></sup>
205205
<!-- endSnippet -->
206206

207207

@@ -215,7 +215,7 @@ public Task ScrubInlineDateTimesFluent() =>
215215
Verify("content 2020-10-20 content")
216216
.ScrubInlineDateTimes("yyyy-MM-dd");
217217
```
218-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1622-L1629' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineDateTimesFluent' title='Start of snippet'>anchor</a></sup>
218+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1644-L1651' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineDateTimesFluent' title='Start of snippet'>anchor</a></sup>
219219
<!-- endSnippet -->
220220

221221

@@ -231,7 +231,7 @@ public static class ModuleInitializer
231231
VerifierSettings.ScrubInlineDateTimes("yyyy-MM-dd");
232232
}
233233
```
234-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1610-L1619' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineDateTimesGlobal' title='Start of snippet'>anchor</a></sup>
234+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1632-L1641' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineDateTimesGlobal' title='Start of snippet'>anchor</a></sup>
235235
<!-- endSnippet -->
236236

237237

@@ -252,7 +252,7 @@ settings.AddNamedDateTime(new(2030, 1, 2), "instanceNamedDateTime");
252252
settings.AddNamedDateTimeOffset(new DateTime(2030, 1, 2), "instanceNamedTimeOffset");
253253
await Verify(target, settings);
254254
```
255-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1204-L1213' title='Snippet source file'>snippet source</a> | <a href='#snippet-NamedDatesAndTimesInstance' title='Start of snippet'>anchor</a></sup>
255+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1226-L1235' title='Snippet source file'>snippet source</a> | <a href='#snippet-NamedDatesAndTimesInstance' title='Start of snippet'>anchor</a></sup>
256256
<!-- endSnippet -->
257257

258258

@@ -267,7 +267,7 @@ await Verify(target)
267267
.AddNamedDateTime(new(2030, 1, 2), "instanceNamedDateTime")
268268
.AddNamedDateTimeOffset(new DateTime(2030, 1, 2), "instanceNamedTimeOffset");
269269
```
270-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1161-L1169' title='Snippet source file'>snippet source</a> | <a href='#snippet-NamedDatesAndTimesFluent' title='Start of snippet'>anchor</a></sup>
270+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1183-L1191' title='Snippet source file'>snippet source</a> | <a href='#snippet-NamedDatesAndTimesFluent' title='Start of snippet'>anchor</a></sup>
271271
<!-- endSnippet -->
272272

273273

@@ -285,7 +285,7 @@ public static void NamedDatesAndTimesGlobal()
285285
VerifierSettings.AddNamedDateTimeOffset(new(new(2030, 1, 1)), "namedDateTimeOffset");
286286
}
287287
```
288-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1116-L1127' title='Snippet source file'>snippet source</a> | <a href='#snippet-NamedDatesAndTimesGlobal' title='Start of snippet'>anchor</a></sup>
288+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1138-L1149' title='Snippet source file'>snippet source</a> | <a href='#snippet-NamedDatesAndTimesGlobal' title='Start of snippet'>anchor</a></sup>
289289
<!-- endSnippet -->
290290

291291

docs/guids.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var target = new GuidTarget
2323

2424
await Verify(target);
2525
```
26-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2010-L2023' title='Snippet source file'>snippet source</a> | <a href='#snippet-guid' title='Start of snippet'>anchor</a></sup>
26+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2032-L2045' title='Snippet source file'>snippet source</a> | <a href='#snippet-guid' title='Start of snippet'>anchor</a></sup>
2727
<!-- endSnippet -->
2828

2929
Results in the following:
@@ -79,7 +79,7 @@ await Verify(target)
7979
```cs
8080
VerifierSettings.DontScrubGuids();
8181
```
82-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1539-L1543' title='Snippet source file'>snippet source</a> | <a href='#snippet-DontScrubGuidsGlobal' title='Start of snippet'>anchor</a></sup>
82+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1561-L1565' title='Snippet source file'>snippet source</a> | <a href='#snippet-DontScrubGuidsGlobal' title='Start of snippet'>anchor</a></sup>
8383
<!-- endSnippet -->
8484

8585

@@ -103,7 +103,7 @@ public Task ScrubInlineGuidsInstance()
103103
settings);
104104
}
105105
```
106-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1595-L1607' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineGuidsInstance' title='Start of snippet'>anchor</a></sup>
106+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1617-L1629' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineGuidsInstance' title='Start of snippet'>anchor</a></sup>
107107
<!-- endSnippet -->
108108

109109

@@ -117,7 +117,7 @@ public Task ScrubInlineGuidsFluent() =>
117117
Verify("content 651ad409-fc30-4b12-a47e-616d3f953e4c content")
118118
.ScrubInlineGuids();
119119
```
120-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1586-L1593' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineGuidsFluent' title='Start of snippet'>anchor</a></sup>
120+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1608-L1615' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineGuidsFluent' title='Start of snippet'>anchor</a></sup>
121121
<!-- endSnippet -->
122122

123123

@@ -133,7 +133,7 @@ public static class ModuleInitializer
133133
VerifierSettings.ScrubInlineGuids();
134134
}
135135
```
136-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1574-L1583' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineGuidsGlobal' title='Start of snippet'>anchor</a></sup>
136+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1596-L1605' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubInlineGuidsGlobal' title='Start of snippet'>anchor</a></sup>
137137
<!-- endSnippet -->
138138

139139

docs/named-tuples.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Given a method that returns a named tuple:
1919
static (bool Member1, string Member2, string Member3) MethodWithNamedTuple() =>
2020
(true, "A", "B");
2121
```
22-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1945-L1950' title='Snippet source file'>snippet source</a> | <a href='#snippet-MethodWithNamedTuple' title='Start of snippet'>anchor</a></sup>
22+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1967-L1972' title='Snippet source file'>snippet source</a> | <a href='#snippet-MethodWithNamedTuple' title='Start of snippet'>anchor</a></sup>
2323
<!-- endSnippet -->
2424

2525
Can be verified:
@@ -29,7 +29,7 @@ Can be verified:
2929
```cs
3030
await VerifyTuple(() => MethodWithNamedTuple());
3131
```
32-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1939-L1943' title='Snippet source file'>snippet source</a> | <a href='#snippet-VerifyTuple' title='Start of snippet'>anchor</a></sup>
32+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1961-L1965' title='Snippet source file'>snippet source</a> | <a href='#snippet-VerifyTuple' title='Start of snippet'>anchor</a></sup>
3333
<!-- endSnippet -->
3434

3535
Resulting in:

docs/scrubbers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ For example remove lines containing `text`:
5959
```cs
6060
verifySettings.ScrubLines(line => line.Contains("text"));
6161
```
62-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1769-L1773' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubLines' title='Start of snippet'>anchor</a></sup>
62+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1791-L1795' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubLines' title='Start of snippet'>anchor</a></sup>
6363
<!-- endSnippet -->
6464

6565

@@ -74,7 +74,7 @@ For example remove lines containing `text1` or `text2`
7474
```cs
7575
verifySettings.ScrubLinesContaining("text1", "text2");
7676
```
77-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1775-L1779' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubLinesContaining' title='Start of snippet'>anchor</a></sup>
77+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1797-L1801' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubLinesContaining' title='Start of snippet'>anchor</a></sup>
7878
<!-- endSnippet -->
7979

8080
Case insensitive by default (StringComparison.OrdinalIgnoreCase).
@@ -86,7 +86,7 @@ Case insensitive by default (StringComparison.OrdinalIgnoreCase).
8686
```cs
8787
verifySettings.ScrubLinesContaining(StringComparison.Ordinal, "text1", "text2");
8888
```
89-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1781-L1785' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubLinesContainingOrdinal' title='Start of snippet'>anchor</a></sup>
89+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1803-L1807' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubLinesContainingOrdinal' title='Start of snippet'>anchor</a></sup>
9090
<!-- endSnippet -->
9191

9292

@@ -101,7 +101,7 @@ For example converts lines to upper case:
101101
```cs
102102
verifySettings.ScrubLinesWithReplace(line => line.ToUpper());
103103
```
104-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1787-L1791' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubLinesWithReplace' title='Start of snippet'>anchor</a></sup>
104+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1809-L1813' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubLinesWithReplace' title='Start of snippet'>anchor</a></sup>
105105
<!-- endSnippet -->
106106

107107

@@ -114,7 +114,7 @@ Replaces `Environment.MachineName` with `TheMachineName`.
114114
```cs
115115
verifySettings.ScrubMachineName();
116116
```
117-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1793-L1797' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMachineName' title='Start of snippet'>anchor</a></sup>
117+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1815-L1819' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMachineName' title='Start of snippet'>anchor</a></sup>
118118
<!-- endSnippet -->
119119

120120

@@ -127,7 +127,7 @@ Replaces `Environment.UserName` with `TheUserName`.
127127
```cs
128128
verifySettings.ScrubUserName();
129129
```
130-
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1799-L1803' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubUserName' title='Start of snippet'>anchor</a></sup>
130+
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L1821-L1825' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubUserName' title='Start of snippet'>anchor</a></sup>
131131
<!-- endSnippet -->
132132

133133

0 commit comments

Comments
 (0)