diff --git a/docs/anonymous-types.md b/docs/anonymous-types.md
index 55aa33f0f1..6c5f67dc09 100644
--- a/docs/anonymous-types.md
+++ b/docs/anonymous-types.md
@@ -13,7 +13,7 @@ When validating multiple instances, an [anonymous type](https://docs.microsoft.c
## xUnit
-
+
```cs
[Fact]
public async Task Anon()
@@ -37,14 +37,14 @@ public async Task Anon()
});
}
```
-snippet source | anchor
+snippet source | anchor
## NUnit
-
+
```cs
[Test]
public async Task Anon()
@@ -68,14 +68,14 @@ public async Task Anon()
});
}
```
-snippet source | anchor
+snippet source | anchor
## MSTest
-
+
```cs
[TestMethod]
public async Task Anon()
@@ -99,7 +99,7 @@ public async Task Anon()
});
}
```
-snippet source | anchor
+snippet source | anchor
@@ -108,7 +108,7 @@ public async Task Anon()
Results in the following:
-
+
```txt
{
person1: {
@@ -121,5 +121,5 @@ Results in the following:
}
}
```
-snippet source | anchor
+snippet source | anchor
diff --git a/docs/build-server.md b/docs/build-server.md
index 8d9bc10171..fb0db1242f 100644
--- a/docs/build-server.md
+++ b/docs/build-server.md
@@ -16,12 +16,12 @@ To change this file edit the source file and then run MarkdownSnippets.
Use an [on_failure build step](https://www.appveyor.com/docs/build-configuration/#build-pipeline) to call [Push-AppveyorArtifact](https://www.appveyor.com/docs/build-worker-api/#push-artifact).
-
+
```yml
on_failure:
- ps: Get-ChildItem *.received.* -recurse | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
```
-snippet source | anchor
+snippet source | anchor
See also [Pushing artifacts from scripts](https://www.appveyor.com/docs/packaging-artifacts/#pushing-artifacts-from-scripts).
@@ -38,7 +38,7 @@ In some scenarios, as part of a build, the test assemblies are copied to a diffe
For example a possible implementation for [AppVeyor](https://www.appveyor.com/) could be:
-
+
```cs
if (BuildServerDetector.Detected)
{
@@ -52,5 +52,5 @@ if (BuildServerDetector.Detected)
});
}
```
-snippet source | anchor
+snippet source | anchor
diff --git a/docs/clipboard.md b/docs/clipboard.md
index 492635f2b3..897b5be991 100644
--- a/docs/clipboard.md
+++ b/docs/clipboard.md
@@ -62,34 +62,34 @@ The clipboard behavior can be disable using the following:
### Per Test
-
+
```cs
var settings = new VerifySettings();
settings.DisableClipboard();
```
-snippet source | anchor
+snippet source | anchor
### For all tests
-
+
```cs
VerifierSettings.DisableClipboard();
```
-snippet source | anchor
+snippet source | anchor
If clipboard is disabled for all tests, it can be re-enabled at the test level:
-
+
```cs
var settings = new VerifySettings();
settings.EnableClipboard();
```
-snippet source | anchor
+snippet source | anchor
diff --git a/docs/compared-to-assertion.md b/docs/compared-to-assertion.md
index 777f0f01fb..1a6577a93a 100644
--- a/docs/compared-to-assertion.md
+++ b/docs/compared-to-assertion.md
@@ -26,7 +26,7 @@ Given the following method:
### Class being tested
-
+
```cs
public static class ClassBeingTested
{
@@ -53,7 +53,7 @@ public static class ClassBeingTested
}
}
```
-snippet source | anchor
+snippet source | anchor
@@ -65,7 +65,7 @@ Compare a traditional assertion based test to a verification test.
#### Traditional assertion test:
-
+
```cs
[Fact]
public void TraditionalTest()
@@ -83,14 +83,14 @@ public void TraditionalTest()
Assert.Equal("USA", person.Address.Country);
}
```
-snippet source | anchor
+snippet source | anchor
#### Verification test
-
+
```cs
[Fact]
public Task Simple()
@@ -99,5 +99,5 @@ public Task Simple()
return Verifier.Verify(person);
}
```
-snippet source | anchor
+snippet source | anchor
diff --git a/docs/comparer.md b/docs/comparer.md
index 8a22b593cb..98dc770b3b 100644
--- a/docs/comparer.md
+++ b/docs/comparer.md
@@ -17,7 +17,7 @@ Using a custom comparer can be helpful when a result has changed, but not enough
For samples purposes an image difference hash algorithm from the [ImageHash project](https://github.com/pgrho/phash) will be used:
-
+
```cs
static Task CompareImages(
VerifySettings settings,
@@ -44,7 +44,7 @@ static Digest HashImage(Stream stream)
return ImagePhash.ComputeDigest(bitmap.ToLuminanceImage());
}
```
-snippet source | anchor
+snippet source | anchor
The returned `CompareResult.NotEqual` takes an optional message that will be rendered in the resulting text displayed to the user on test failure.
@@ -53,35 +53,35 @@ The returned `CompareResult.NotEqual` takes an optional message that will be ren
### Instance comparer
-
+
```cs
var settings = new VerifySettings();
settings.UseComparer(CompareImages);
settings.UseExtension("png");
await Verifier.Verify("TheImage.png", settings);
```
-snippet source | anchor
+snippet source | anchor
### Static comparer
-
+
```cs
VerifierSettings.RegisterComparer(
extension: "png",
compare: CompareImages);
await Verifier.VerifyFile("TheImage.png");
```
-snippet source | anchor
+snippet source | anchor
## Default Comparison
-
+
```cs
static async Task StreamsAreEqual(Stream stream1, Stream stream2)
{
@@ -131,7 +131,7 @@ static async Task ReadBufferAsync(Stream stream, byte[] buffer)
return bytesRead;
}
```
-snippet source | anchor
+snippet source | anchor
diff --git a/docs/converter.md b/docs/converter.md
index 5d9931198d..22bc934cd6 100644
--- a/docs/converter.md
+++ b/docs/converter.md
@@ -29,14 +29,14 @@ Both the following examples take an input tiff and convert it to:
The info file:
-
+
```txt
{
PixelFormat: 'Format8bppIndexed',
Size: '473, 355'
}
```
-snippet source | anchor
+snippet source | anchor
Multiple png files:
@@ -49,7 +49,7 @@ Multiple png files:
This sample uses a typed approach. So the converter acts on an in memory instance matching based on type.
-
+
```cs
VerifierSettings.RegisterFileConverter(
canConvert: (target, settings) => Equals(target.RawFormat, ImageFormat.Tiff),
@@ -76,26 +76,26 @@ VerifierSettings.RegisterFileConverter(
streams);
});
```
-snippet source | anchor
+snippet source | anchor
-
+
```cs
using var stream = File.OpenRead("sample.tif");
await Verifier.Verify(Image.FromStream(stream));
```
-snippet source | anchor
+snippet source | anchor
Note that this sample also uses the optional `canConvert` to ensure that only `Image`s that are tiffs are converted.
-
+
```cs
canConvert: (target, settings) => Equals(target.RawFormat, ImageFormat.Tiff),
```
-snippet source | anchor
+snippet source | anchor
@@ -104,7 +104,7 @@ canConvert: (target, settings) => Equals(target.RawFormat, ImageFormat.Tiff),
This sample uses a extension approach. So the converter acts on a file or stream based on the extension (configured or detected).
-
+
```cs
VerifierSettings.RegisterFileConverter(
fromExtension: "tif",
@@ -132,15 +132,15 @@ VerifierSettings.RegisterFileConverter(
streams);
});
```
-snippet source | anchor
+snippet source | anchor
-
+
```cs
await Verifier.VerifyFile("sample.tif");
```
-snippet source | anchor
+snippet source | anchor
@@ -149,7 +149,7 @@ await Verifier.VerifyFile("sample.tif");
If cleanup needs to occur after verification a callback can be passes to `ConversionResult`:
-
+
```cs
return new ConversionResult(
info: info,
@@ -161,7 +161,7 @@ return new ConversionResult(
return Task.CompletedTask;
});
```
-snippet source | anchor
+snippet source | anchor
diff --git a/docs/named-tuples.md b/docs/named-tuples.md
index 2eabd65ed9..da2a1e3bca 100644
--- a/docs/named-tuples.md
+++ b/docs/named-tuples.md
@@ -14,30 +14,30 @@ Due to the use of [ITuple](https://docs.microsoft.com/en-us/dotnet/api/system.ru
Given a method that returns a named tuple:
-
+
```cs
static (bool Member1, string Member2, string Member3) MethodWithNamedTuple()
{
return (true, "A", "B");
}
```
-snippet source | anchor
+snippet source | anchor
Can be verified:
-
+
```cs
await Verifier.Verify(() => MethodWithNamedTuple());
```
-snippet source | anchor
+snippet source | anchor
Resulting in:
-
+
```txt
{
Member1: true,
@@ -45,5 +45,5 @@ Resulting in:
Member3: 'B'
}
```
-snippet source | anchor
+snippet source | anchor
diff --git a/docs/naming.md b/docs/naming.md
index a2bd410d9f..52d16b7c68 100644
--- a/docs/naming.md
+++ b/docs/naming.md
@@ -28,7 +28,7 @@ UniqueFor allows for one or more delimiters to be added to the file name.
### XUnit
-
+
```cs
using static VerifyXunit.Verifier;
@@ -60,14 +60,14 @@ public class UniqueForSample
}
}
```
-snippet source | anchor
+snippet source | anchor
### NUnit
-
+
```cs
using static VerifyNUnit.Verifier;
@@ -99,14 +99,14 @@ public class UniqueForSample
}
}
```
-snippet source | anchor
+snippet source | anchor
### MSTest
-
+
```cs
[TestClass]
public class UniqueForSample :
@@ -137,7 +137,7 @@ public class UniqueForSample :
}
}
```
-snippet source | anchor
+snippet source | anchor
@@ -171,7 +171,7 @@ It can be overridden at two levels:
Usage:
-
+
```cs
[UsesVerify]
public class ExtensionSample
@@ -211,13 +211,13 @@ public class ExtensionSample
}
}
```
-snippet source | anchor
+snippet source | anchor
Result in two files:
-
+
```json
{
"fruit": "Apple",
@@ -225,11 +225,11 @@ Result in two files:
"color": "Red"
}
```
-snippet source | anchor
+snippet source | anchor
-
+
```xml
Joe
@@ -237,7 +237,7 @@ Result in two files:
Reminder
```
-snippet source | anchor
+snippet source | anchor
@@ -246,10 +246,10 @@ Result in two files:
To access the current Namer `Runtime` or `RuntimeAndVersion` strings use:
-
+
```cs
Debug.WriteLine(Namer.Runtime);
Debug.WriteLine(Namer.RuntimeAndVersion);
```
-snippet source | anchor
+snippet source | anchor
diff --git a/docs/parameterised.md b/docs/parameterised.md
index 3e5032f070..acf19fa565 100644
--- a/docs/parameterised.md
+++ b/docs/parameterised.md
@@ -26,7 +26,7 @@ A test with two parameters `param1` + `param2`, and called twice with the values
### InlineData
-
+
```cs
[Theory]
[InlineData("Value1")]
@@ -38,14 +38,14 @@ public Task InlineDataUsage(string arg)
return Verifier.Verify(arg, settings);
}
```
-snippet source | anchor
+snippet source | anchor
### MemberData
-
+
```cs
[Theory]
[MemberData(nameof(GetData))]
@@ -62,7 +62,7 @@ public static IEnumerable