Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Dec 7, 2020
1 parent 9e3cffd commit 4e50ade
Show file tree
Hide file tree
Showing 15 changed files with 177 additions and 50 deletions.
2 changes: 1 addition & 1 deletion docs/build-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ if (BuildServerDetector.Detected)
});
}
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L98-L112' title='Snippet source file'>snippet source</a> | <a href='#snippet-derivetestdirectoryappveyor' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L99-L113' title='Snippet source file'>snippet source</a> | <a href='#snippet-derivetestdirectoryappveyor' 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:
VerifySettings settings = new();
settings.DisableClipboard();
```
<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>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L40-L45' 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#L74-L78' 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#L75-L79' 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:
VerifySettings settings = new();
settings.EnableClipboard();
```
<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>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L65-L70' title='Snippet source file'>snippet source</a> | <a href='#snippet-enableclipboard' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
10 changes: 5 additions & 5 deletions docs/converter.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ VerifierSettings.RegisterFileConverter<Image>(
streams);
});
```
<sup><a href='/src/Verify.Tests/Snippets/ConverterSnippets.cs#L17-L45' title='Snippet source file'>snippet source</a> | <a href='#snippet-registerfileconvertertype' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/ConverterSnippets.cs#L18-L46' title='Snippet source file'>snippet source</a> | <a href='#snippet-registerfileconvertertype' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

<!-- snippet: FileConverterTypeVerify -->
Expand All @@ -85,7 +85,7 @@ VerifierSettings.RegisterFileConverter<Image>(
using var stream = File.OpenRead("sample.tif");
await Verifier.Verify(Image.FromStream(stream));
```
<sup><a href='/src/Verify.Tests/Snippets/ConverterSnippets.cs#L47-L52' title='Snippet source file'>snippet source</a> | <a href='#snippet-fileconvertertypeverify' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/ConverterSnippets.cs#L48-L53' title='Snippet source file'>snippet source</a> | <a href='#snippet-fileconvertertypeverify' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Note that this sample also uses the optional `canConvert` to ensure that only `Image`s that are tiffs are converted.
Expand All @@ -95,7 +95,7 @@ Note that this sample also uses the optional `canConvert` to ensure that only `I
```cs
canConvert: (target, extension, context) => Equals(target.RawFormat, ImageFormat.Tiff),
```
<sup><a href='/src/Verify.Tests/Snippets/ConverterSnippets.cs#L20-L22' title='Snippet source file'>snippet source</a> | <a href='#snippet-convertercanconvert' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/ConverterSnippets.cs#L21-L23' title='Snippet source file'>snippet source</a> | <a href='#snippet-convertercanconvert' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down Expand Up @@ -132,15 +132,15 @@ VerifierSettings.RegisterFileConverter(
streams);
});
```
<sup><a href='/src/Verify.Tests/Snippets/ConverterSnippets.cs#L58-L86' title='Snippet source file'>snippet source</a> | <a href='#snippet-registerfileconverterextension' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/ConverterSnippets.cs#L59-L87' title='Snippet source file'>snippet source</a> | <a href='#snippet-registerfileconverterextension' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

<!-- snippet: FileConverterExtensionVerify -->
<a id='snippet-fileconverterextensionverify'></a>
```cs
await Verifier.VerifyFile("sample.tif");
```
<sup><a href='/src/Verify.Tests/Snippets/ConverterSnippets.cs#L88-L92' title='Snippet source file'>snippet source</a> | <a href='#snippet-fileconverterextensionverify' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/ConverterSnippets.cs#L89-L93' title='Snippet source file'>snippet source</a> | <a href='#snippet-fileconverterextensionverify' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
29 changes: 28 additions & 1 deletion docs/mdsource/serializer-settings.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,31 @@ This bypasses the Guid and DateTime scrubbing mentioned above.

Extra types can be added to this mapping:

snippet: TreatAsString
snippet: TreatAsString


## JsonAppender

A JsonAppender allows extra content to be appended to the output. JsonAppenders can use the current context to determine what should be appended or if anything should be appended.

Register a JsonAppender

snippet: RegisterJsonAppender

When when content is verified:

snippet: JsonAppender

The content from RegisterJsonAppender will be included in the output:

snippet: JsonAppenderTests.WithJsonAppender.verified.txt

If the target is a stream or binary file:

snippet: JsonAppenderStream

Then the appended content will be added to the `*.info.verified.txt` file:

snippet: JsonAppenderTests.Stream.info.verified.txt

See [Converters](/docs/converter.md) for more information on `*.info.verified.txt` files.
4 changes: 2 additions & 2 deletions docs/named-tuples.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static (bool Member1, string Member2, string Member3) MethodWithNamedTuple()
return (true, "A", "B");
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L424-L431' title='Snippet source file'>snippet source</a> | <a href='#snippet-methodwithnamedtuple' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L425-L432' title='Snippet source file'>snippet source</a> | <a href='#snippet-methodwithnamedtuple' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Can be verified:
Expand All @@ -31,7 +31,7 @@ Can be verified:
```cs
await Verifier.Verify(() => MethodWithNamedTuple());
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L417-L421' title='Snippet source file'>snippet source</a> | <a href='#snippet-verifytuple' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L418-L422' title='Snippet source file'>snippet source</a> | <a href='#snippet-verifytuple' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Resulting in:
Expand Down
2 changes: 1 addition & 1 deletion docs/naming.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ VerifierSettings.DeriveTestDirectory(
return Path.Combine(snapshotsDirectory);
});
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L83-L93' 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#L84-L94' title='Snippet source file'>snippet source</a> | <a href='#snippet-derivetestdirectory' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

DeriveTestDirectory can also be useful when deriving the storage directory on a [build server](build-server.md#custom-Test-directory)
10 changes: 5 additions & 5 deletions docs/scrubbers.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ For example remove lines containing `text`:
```cs
verifySettings.ScrubLines(line => line.Contains("text"));
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L315-L319' title='Snippet source file'>snippet source</a> | <a href='#snippet-scrublines' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L316-L320' title='Snippet source file'>snippet source</a> | <a href='#snippet-scrublines' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -45,7 +45,7 @@ For example remove lines containing `text1` or `text2`
```cs
verifySettings.ScrubLinesContaining("text1", "text2");
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L321-L325' title='Snippet source file'>snippet source</a> | <a href='#snippet-scrublinescontaining' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L322-L326' title='Snippet source file'>snippet source</a> | <a href='#snippet-scrublinescontaining' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Case insensitive by default (StringComparison.OrdinalIgnoreCase).
Expand All @@ -57,7 +57,7 @@ Case insensitive by default (StringComparison.OrdinalIgnoreCase).
```cs
verifySettings.ScrubLinesContaining(StringComparison.Ordinal, "text1", "text2");
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L327-L331' title='Snippet source file'>snippet source</a> | <a href='#snippet-scrublinescontainingordinal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L328-L332' title='Snippet source file'>snippet source</a> | <a href='#snippet-scrublinescontainingordinal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -72,7 +72,7 @@ For example converts lines to upper case:
```cs
verifySettings.ScrubLinesWithReplace(line => line.ToUpper());
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L333-L337' title='Snippet source file'>snippet source</a> | <a href='#snippet-scrublineswithreplace' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L334-L338' title='Snippet source file'>snippet source</a> | <a href='#snippet-scrublineswithreplace' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -85,7 +85,7 @@ Replaces `Environment.MachineName` with `TheMachineName`.
```cs
verifySettings.ScrubMachineName();
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L339-L343' title='Snippet source file'>snippet source</a> | <a href='#snippet-scrubmachinename' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L340-L344' title='Snippet source file'>snippet source</a> | <a href='#snippet-scrubmachinename' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
Loading

0 comments on commit 4e50ade

Please sign in to comment.