Skip to content

Commit

Permalink
VerifierSettings
Browse files Browse the repository at this point in the history
fixes #156
  • Loading branch information
SimonCropp committed Jun 14, 2020
1 parent 41eaf52 commit 5813f9e
Show file tree
Hide file tree
Showing 42 changed files with 78 additions and 78 deletions.
4 changes: 2 additions & 2 deletions docs/build-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ See also [Pushing artifacts from scripts](https://www.appveyor.com/docs/packagin

## Custom Test directory

In some scenarios, as part of a build, the test assemblies are copied to a different directory or machine to be run. In this case custom code will be required to derive the path to the `.verified.` files. This can be done using a custom delegate via `SharedVerifySettings.DeriveTestDirectory`. The parameters passed are as follows:
In some scenarios, as part of a build, the test assemblies are copied to a different directory or machine to be run. In this case custom code will be required to derive the path to the `.verified.` files. This can be done using a custom delegate via `VerifierSettings.DeriveTestDirectory`. The parameters passed are as follows:

* `type`: The test type.
* `testDirectory`: The directory that the test source file existed in at compile time.
Expand All @@ -43,7 +43,7 @@ For example a possible implementation for [AppVeyor](https://www.appveyor.com/)
if (BuildServerDetector.Detected)
{
var buildDirectory = Environment.GetEnvironmentVariable("APPVEYOR_BUILD_FOLDER")!;
SharedVerifySettings.DeriveTestDirectory(
VerifierSettings.DeriveTestDirectory(
(sourceFile, projectDirectory) =>
{
var testDirectory = Path.GetDirectoryName(sourceFile)!;
Expand Down
2 changes: 1 addition & 1 deletion docs/clipboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ settings.DisableClipboard();
<!-- snippet: DisableClipboardGlobal -->
<a id='snippet-disableclipboardglobal'/></a>
```cs
SharedVerifySettings.DisableClipboard();
VerifierSettings.DisableClipboard();
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L56-L60' title='File snippet `disableclipboardglobal` was extracted from'>snippet source</a> | <a href='#snippet-disableclipboardglobal' title='Navigate to start of snippet `disableclipboardglobal`'>anchor</a></sup>
<!-- endsnippet -->
Expand Down
2 changes: 1 addition & 1 deletion docs/comparer.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ await Verifier.Verify("TheImage.png", settings);
<!-- snippet: StaticComparer -->
<a id='snippet-staticcomparer'/></a>
```cs
SharedVerifySettings.RegisterComparer(
VerifierSettings.RegisterComparer(
extension: "png",
compare: CompareImages);
await Verifier.VerifyFile("TheImage.png");
Expand Down
4 changes: 2 additions & 2 deletions docs/converter.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ This sample uses a typed approach. So the converter acts on an in memory instanc
<!-- snippet: RegisterFileConverterType -->
<a id='snippet-registerfileconvertertype'/></a>
```cs
SharedVerifySettings.RegisterFileConverter<Image>(
VerifierSettings.RegisterFileConverter<Image>(
toExtension: "png",
canConvert: target => Equals(target.RawFormat, ImageFormat.Tiff),
conversion: (image, settings) =>
Expand Down Expand Up @@ -107,7 +107,7 @@ This sample uses a extension approach. So the converter acts on a file or stream
<!-- snippet: RegisterFileConverterExtension -->
<a id='snippet-registerfileconverterextension'/></a>
```cs
SharedVerifySettings.RegisterFileConverter(
VerifierSettings.RegisterFileConverter(
fromExtension: "tif",
toExtension: "png",
conversion: (stream, settings) =>
Expand Down
2 changes: 1 addition & 1 deletion docs/mdsource/build-server.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ See also [Pushing artifacts from scripts](https://www.appveyor.com/docs/packagin

## Custom Test directory

In some scenarios, as part of a build, the test assemblies are copied to a different directory or machine to be run. In this case custom code will be required to derive the path to the `.verified.` files. This can be done using a custom delegate via `SharedVerifySettings.DeriveTestDirectory`. The parameters passed are as follows:
In some scenarios, as part of a build, the test assemblies are copied to a different directory or machine to be run. In this case custom code will be required to derive the path to the `.verified.` files. This can be done using a custom delegate via `VerifierSettings.DeriveTestDirectory`. The parameters passed are as follows:

* `type`: The test type.
* `testDirectory`: The directory that the test source file existed in at compile time.
Expand Down
2 changes: 1 addition & 1 deletion docs/mdsource/parameterised.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ xUnit only exposes parameter information when the types certain types. For unkno

snippet: xunitComplexMemberData

`SharedVerifySettings.NameForParameter` is required since the parameter type has no `ToString()` override that can be used for deriving the name of the `.verified.` file.
`VerifierSettings.NameForParameter` is required since the parameter type has no `ToString()` override that can be used for deriving the name of the `.verified.` file.


## NUnit
Expand Down
2 changes: 1 addition & 1 deletion docs/mdsource/scrubbers.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Scrubber are executed in reveres order. So the most recent added method scrubber

## Available Scrubbers

Scrubbers can be added to an instance of `VerifySettings` or globally on `SharedVerifySettings`.
Scrubbers can be added to an instance of `VerifySettings` or globally on `VerifierSettings`.


### ScrubLines
Expand Down
4 changes: 2 additions & 2 deletions docs/parameterised.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class ComplexParametersSample
static ComplexParametersSample()
{
//TODO: this should be in the appdomain startup code
SharedVerifySettings.NameForParameter<ComplexData>(_ => _.Value);
VerifierSettings.NameForParameter<ComplexData>(_ => _.Value);
}

[Theory]
Expand Down Expand Up @@ -112,7 +112,7 @@ public class ComplexParametersSample
<sup><a href='/src/Verify.Xunit.Tests/Snippets/ComplexParametersSample.cs#L7-L43' title='File snippet `xunitcomplexmemberdata` was extracted from'>snippet source</a> | <a href='#snippet-xunitcomplexmemberdata' title='Navigate to start of snippet `xunitcomplexmemberdata`'>anchor</a></sup>
<!-- endsnippet -->

`SharedVerifySettings.NameForParameter` is required since the parameter type has no `ToString()` override that can be used for deriving the name of the `.verified.` file.
`VerifierSettings.NameForParameter` is required since the parameter type has no `ToString()` override that can be used for deriving the name of the `.verified.` file.


## NUnit
Expand Down
8 changes: 4 additions & 4 deletions docs/scrubbers.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Scrubber are executed in reveres order. So the most recent added method scrubber

## Available Scrubbers

Scrubbers can be added to an instance of `VerifySettings` or globally on `SharedVerifySettings`.
Scrubbers can be added to an instance of `VerifySettings` or globally on `VerifierSettings`.


### ScrubLines
Expand Down Expand Up @@ -339,7 +339,7 @@ public class ScrubberLevelsSample
static ScrubberLevelsSample()
{
// Should be dont at appdomain startup
SharedVerifySettings.AddScrubber(s => s.Replace("One", "A"));
VerifierSettings.AddScrubber(s => s.Replace("One", "A"));
}
}
```
Expand Down Expand Up @@ -376,7 +376,7 @@ public class ScrubberLevelsSample
[OneTimeSetUp]
public static void Setup()
{
SharedVerifySettings.AddScrubber(s => s.Replace("One", "A"));
VerifierSettings.AddScrubber(s => s.Replace("One", "A"));
}
}
```
Expand Down Expand Up @@ -412,7 +412,7 @@ public class ScrubberLevelsSample :
[AssemblyInitialize]
public static void Setup(TestContext testContext)
{
SharedVerifySettings.AddScrubber(s => s.Replace("One", "A"));
VerifierSettings.AddScrubber(s => s.Replace("One", "A"));
}
}
```
Expand Down
10 changes: 5 additions & 5 deletions docs/serializer-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ To disable this behavior globally use:
<!-- snippet: DontIgnoreEmptyCollections -->
<a id='snippet-dontignoreemptycollections'/></a>
```cs
SharedVerifySettings.ModifySerialization(_ => _.DontIgnoreEmptyCollections());
VerifierSettings.ModifySerialization(_ => _.DontIgnoreEmptyCollections());
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L192-L194' title='File snippet `dontignoreemptycollections` was extracted from'>snippet source</a> | <a href='#snippet-dontignoreemptycollections' title='Navigate to start of snippet `dontignoreemptycollections`'>anchor</a></sup>
<!-- endsnippet -->
Expand Down Expand Up @@ -120,7 +120,7 @@ To disable this behavior globally use:
<!-- snippet: DontScrubGuids -->
<a id='snippet-dontscrubguids'/></a>
```cs
SharedVerifySettings.ModifySerialization(_ => _.DontScrubGuids());
VerifierSettings.ModifySerialization(_ => _.DontScrubGuids());
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L199-L201' title='File snippet `dontscrubguids` was extracted from'>snippet source</a> | <a href='#snippet-dontscrubguids' title='Navigate to start of snippet `dontscrubguids`'>anchor</a></sup>
<!-- endsnippet -->
Expand All @@ -130,7 +130,7 @@ Strings containing inline Guids can also be scrubbed. To enable this behavior, u
<!-- snippet: ScrubInlineGuids -->
<a id='snippet-scrubinlineguids'/></a>
```cs
SharedVerifySettings.ModifySerialization(_ => _.ScrubInlineGuids());
VerifierSettings.ModifySerialization(_ => _.ScrubInlineGuids());
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L206-L208' title='File snippet `scrubinlineguids` was extracted from'>snippet source</a> | <a href='#snippet-scrubinlineguids' title='Navigate to start of snippet `scrubinlineguids`'>anchor</a></sup>
<!-- endsnippet -->
Expand Down Expand Up @@ -182,7 +182,7 @@ To disable this behavior globally use:
<!-- snippet: DontScrubDateTimes -->
<a id='snippet-dontscrubdatetimes'/></a>
```cs
SharedVerifySettings.ModifySerialization(_ => _.DontScrubDateTimes());
VerifierSettings.ModifySerialization(_ => _.DontScrubDateTimes());
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L213-L215' title='File snippet `dontscrubdatetimes` was extracted from'>snippet source</a> | <a href='#snippet-dontscrubdatetimes' title='Navigate to start of snippet `dontscrubdatetimes`'>anchor</a></sup>
<!-- endsnippet -->
Expand All @@ -197,7 +197,7 @@ To disable this behavior globally use:
<!-- snippet: DontIgnoreFalse -->
<a id='snippet-dontignorefalse'/></a>
```cs
SharedVerifySettings.ModifySerialization(_ => _.DontIgnoreFalse());
VerifierSettings.ModifySerialization(_ => _.DontIgnoreFalse());
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L220-L222' title='File snippet `dontignorefalse` was extracted from'>snippet source</a> | <a href='#snippet-dontignorefalse' title='Navigate to start of snippet `dontignorefalse`'>anchor</a></sup>
<!-- endsnippet -->
Expand Down
2 changes: 1 addition & 1 deletion src/Verify.Integration.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static Tests()
File.Copy(binPath.Path, newPath, true);
AllFiles.UseFile(Category.Image, newPath);

SharedVerifySettings.RegisterFileConverter<TypeToSplit>(
VerifierSettings.RegisterFileConverter<TypeToSplit>(
"txt",
(split, settings) => new ConversionResult(
split.Info,
Expand Down
2 changes: 1 addition & 1 deletion src/Verify.MSTest.Tests/Scrubbers/ScrubberLevelsSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public Task Simple()
[AssemblyInitialize]
public static void Setup(TestContext testContext)
{
SharedVerifySettings.AddScrubber(s => s.Replace("One", "A"));
VerifierSettings.AddScrubber(s => s.Replace("One", "A"));
}
}
#endregion
2 changes: 1 addition & 1 deletion src/Verify.NUnit.Tests/Scrubbers/ScrubberLevelsSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public Task Simple()
[OneTimeSetUp]
public static void Setup()
{
SharedVerifySettings.AddScrubber(s => s.Replace("One", "A"));
VerifierSettings.AddScrubber(s => s.Replace("One", "A"));
}
}
#endregion
4 changes: 2 additions & 2 deletions src/Verify.Tests/Comparer/ComparerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task Instance()
[Fact]
public async Task Static_with_message()
{
SharedVerifySettings.RegisterComparer("staticComparerExtMessage", CompareWithMessage);
VerifierSettings.RegisterComparer("staticComparerExtMessage", CompareWithMessage);
var settings = new VerifySettings();
settings.UseExtension("staticComparerExtMessage");
settings.DisableDiff();
Expand All @@ -44,7 +44,7 @@ public async Task Static_with_message()
[Fact]
public async Task Static()
{
SharedVerifySettings.RegisterComparer("staticComparerExt", Compare);
VerifierSettings.RegisterComparer("staticComparerExt", Compare);
var settings = new VerifySettings();
settings.UseExtension("staticComparerExt");
await Verifier.Verify("TheText", settings);
Expand Down
8 changes: 4 additions & 4 deletions src/Verify.Tests/Converters/ExtensionConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ExtensionConverterTests
[Fact]
public Task TextSplit()
{
SharedVerifySettings.RegisterFileConverter(
VerifierSettings.RegisterFileConverter(
"split",
"txt",
(stream, _) => new ConversionResult(null, stream));
Expand All @@ -26,7 +26,7 @@ public Task TextSplit()
[Fact]
public Task ExtensionConversion()
{
SharedVerifySettings.RegisterFileConverter(
VerifierSettings.RegisterFileConverter(
"bmp",
"png",
(stream, _) =>
Expand All @@ -42,7 +42,7 @@ public Task ExtensionConversion()
[Fact]
public Task AsyncExtensionConversion()
{
SharedVerifySettings.RegisterFileConverter(
VerifierSettings.RegisterFileConverter(
"bmp",
"png",
(stream, _) =>
Expand All @@ -58,7 +58,7 @@ public Task AsyncExtensionConversion()
[Fact]
public Task WithInfo()
{
SharedVerifySettings.RegisterFileConverter(
VerifierSettings.RegisterFileConverter(
"bmp",
"png",
(stream, _) =>
Expand Down
20 changes: 10 additions & 10 deletions src/Verify.Tests/Converters/TypeConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class TypeConverterTests
[Fact]
public Task Inherited()
{
SharedVerifySettings.RegisterFileConverter<ParentClass>(
VerifierSettings.RegisterFileConverter<ParentClass>(
"txt",
(instance, _) =>
{
Expand All @@ -35,15 +35,15 @@ public Task Inherited()
[Fact]
public Task DifferingExtensions()
{
SharedVerifySettings.RegisterFileConverter<ClassToSplit3>(
VerifierSettings.RegisterFileConverter<ClassToSplit3>(
"notTxt",
async (classToSplit, _) =>
{
await Task.Delay(1);
throw new Exception();
});

SharedVerifySettings.RegisterFileConverter<ClassToSplit3>(
VerifierSettings.RegisterFileConverter<ClassToSplit3>(
"txt",
(instance, _) =>
{
Expand Down Expand Up @@ -83,7 +83,7 @@ public class InheritedClass : ParentClass
[Fact]
public Task ConvertWithExtInSettings()
{
SharedVerifySettings.RegisterFileConverter<ClassToSplit2>(
VerifierSettings.RegisterFileConverter<ClassToSplit2>(
(instance, _) =>
{
var streams = ToStream(instance.Value);
Expand All @@ -106,7 +106,7 @@ public class ClassToSplit2
[Fact]
public Task ConvertWithNewline()
{
SharedVerifySettings.RegisterFileConverter<ClassToSplit>(
VerifierSettings.RegisterFileConverter<ClassToSplit>(
"txt",
(instance, _) =>
{
Expand All @@ -128,7 +128,7 @@ public class ClassToSplit
[Fact]
public Task ConvertWithCanConvert_Invalid()
{
SharedVerifySettings.RegisterFileConverter<CanConvertTarget>(
VerifierSettings.RegisterFileConverter<CanConvertTarget>(
"txt",
(instance, _) =>
{
Expand All @@ -146,7 +146,7 @@ public Task ConvertWithCanConvert_Invalid()
[Fact]
public Task ConvertWithCanConvert_Valid()
{
SharedVerifySettings.RegisterFileConverter<CanConvertTarget>(
VerifierSettings.RegisterFileConverter<CanConvertTarget>(
"txt",
(instance, _) =>
{
Expand All @@ -169,7 +169,7 @@ public class CanConvertTarget
[Fact]
public Task WithInfo()
{
SharedVerifySettings.RegisterFileConverter<Bitmap>(
VerifierSettings.RegisterFileConverter<Bitmap>(
"png",
(bitmap1, _) =>
{
Expand All @@ -189,7 +189,7 @@ public Task WithInfo()
[Fact]
public Task WithInfoShouldRespectSettings()
{
SharedVerifySettings.RegisterFileConverter<Bitmap>(
VerifierSettings.RegisterFileConverter<Bitmap>(
"png",
canConvert: target => Equals(target.RawFormat, ImageFormat.Bmp),
conversion: (bitmap1, _) =>
Expand All @@ -211,7 +211,7 @@ public Task WithInfoShouldRespectSettings()
[Fact]
public Task TypeConversion()
{
SharedVerifySettings.RegisterFileConverter<Bitmap>(
VerifierSettings.RegisterFileConverter<Bitmap>(
"png",
canConvert: target => Equals(target.RawFormat, ImageFormat.Bmp),
conversion: (bitmap1, _) =>
Expand Down
2 changes: 1 addition & 1 deletion src/Verify.Tests/NamerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task DeriveTestDirectory()
{
string? receivedSourceFile = null;
string? receivedProjectDirectory = null;
SharedVerifySettings.DeriveTestDirectory(
VerifierSettings.DeriveTestDirectory(
(sourceFile, projectDirectory) =>
{
receivedSourceFile = sourceFile;
Expand Down
Loading

0 comments on commit 5813f9e

Please sign in to comment.