Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Nov 6, 2020
1 parent 6f9782e commit 9a5da18
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/build-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ if (BuildServerDetector.Detected)
});
}
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L82-L96' title='Snippet source file'>snippet source</a> | <a href='#snippet-derivetestdirectory' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L83-L97' title='Snippet source file'>snippet source</a> | <a href='#snippet-derivetestdirectory' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
6 changes: 3 additions & 3 deletions docs/clipboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The clipboard behavior can be disable using the following:
var settings = new VerifySettings();
settings.DisableClipboard();
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L38-L43' title='Snippet source file'>snippet source</a> | <a href='#snippet-disableclipboard' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L39-L44' title='Snippet source file'>snippet source</a> | <a href='#snippet-disableclipboard' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -78,7 +78,7 @@ settings.DisableClipboard();
```cs
VerifierSettings.DisableClipboard();
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L73-L77' title='Snippet source file'>snippet source</a> | <a href='#snippet-disableclipboardglobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L74-L78' title='Snippet source file'>snippet source</a> | <a href='#snippet-disableclipboardglobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

If clipboard is disabled for all tests, it can be re-enabled at the test level:
Expand All @@ -89,7 +89,7 @@ If clipboard is disabled for all tests, it can be re-enabled at the test level:
var settings = new VerifySettings();
settings.EnableClipboard();
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L63-L68' title='Snippet source file'>snippet source</a> | <a href='#snippet-enableclipboard' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L64-L69' title='Snippet source file'>snippet source</a> | <a href='#snippet-enableclipboard' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
16 changes: 10 additions & 6 deletions docs/serializer-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ VerifierSettings.AddExtraSettings(_ =>
_.TypeNameHandling = TypeNameHandling.All;
});
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L121-L129' title='Snippet source file'>snippet source</a> | <a href='#snippet-extrasettingsglobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L122-L130' title='Snippet source file'>snippet source</a> | <a href='#snippet-extrasettingsglobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -293,7 +293,7 @@ settings.AddExtraSettings(_ =>
_.TypeNameHandling = TypeNameHandling.All;
});
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L131-L140' title='Snippet source file'>snippet source</a> | <a href='#snippet-extrasettingsinstance' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L132-L141' title='Snippet source file'>snippet source</a> | <a href='#snippet-extrasettingsinstance' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -307,7 +307,11 @@ One common use case is to register a custom [JsonConverter](https://www.newtonso
class CompanyConverter :
WriteOnlyJsonConverter<Company>
{
public override void WriteJson(JsonWriter writer, Company? company, JsonSerializer serializer)
public override void WriteJson(
JsonWriter writer,
Company? company,
JsonSerializer serializer,
IReadOnlyDictionary<string, object> context)
{
if (company != null)
{
Expand All @@ -316,15 +320,15 @@ class CompanyConverter :
}
}
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L152-L166' title='Snippet source file'>snippet source</a> | <a href='#snippet-companyconverter' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L153-L171' title='Snippet source file'>snippet source</a> | <a href='#snippet-companyconverter' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

<!-- snippet: JsonConverter -->
<a id='snippet-jsonconverter'></a>
```cs
VerifierSettings.AddExtraSettings(_ => { _.Converters.Add(new CompanyConverter()); });
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L145-L149' title='Snippet source file'>snippet source</a> | <a href='#snippet-jsonconverter' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L146-L150' title='Snippet source file'>snippet source</a> | <a href='#snippet-jsonconverter' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down Expand Up @@ -938,5 +942,5 @@ Extra types can be added to this mapping:
VerifierSettings.TreatAsString<ClassWithToString>(
(target, settings) => target.Property);
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L48-L53' title='Snippet source file'>snippet source</a> | <a href='#snippet-treatasstring' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L49-L54' title='Snippet source file'>snippet source</a> | <a href='#snippet-treatasstring' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
4 changes: 2 additions & 2 deletions docs/verify-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This can be done using `AutoVerify()`:
var settings = new VerifySettings();
settings.AutoVerify();
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L101-L106' title='Snippet source file'>snippet source</a> | <a href='#snippet-autoverify' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L102-L107' title='Snippet source file'>snippet source</a> | <a href='#snippet-autoverify' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Note that auto accepted changes in `.verified.` files remain visible in source control tooling.
Expand Down Expand Up @@ -57,5 +57,5 @@ public async Task OnHandlersSample()
await Verifier.Verify("value", settings);
}
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L12-L34' title='Snippet source file'>snippet source</a> | <a href='#snippet-onhandlers' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L13-L35' title='Snippet source file'>snippet source</a> | <a href='#snippet-onhandlers' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
6 changes: 5 additions & 1 deletion src/Verify.Tests/Snippets/Snippets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ void Converter()
class CompanyConverter :
WriteOnlyJsonConverter<Company>
{
public override void WriteJson(JsonWriter writer, Company? company, JsonSerializer serializer, IReadOnlyDictionary<string, object> context)
public override void WriteJson(
JsonWriter writer,
Company? company,
JsonSerializer serializer,
IReadOnlyDictionary<string, object> context)
{
if (company != null)
{
Expand Down

0 comments on commit 9a5da18

Please sign in to comment.