-
-
Notifications
You must be signed in to change notification settings - Fork 156
/
Copy pathSnippets.cs
115 lines (93 loc) · 2.61 KB
/
Snippets.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DiffEngine;
using Newtonsoft.Json;
using VerifyTesting;
using VerifyXunit;
public class Snippets
{
#region OnHandlers
public async Task OnHandlersSample()
{
var settings = new VerifySettings();
settings.OnFirstVerify(
receivedFile =>
{
Debug.WriteLine(receivedFile);
return Task.CompletedTask;
});
settings.OnVerifyMismatch(
(receivedFile, verifiedFile, message) =>
{
Debug.WriteLine(receivedFile);
Debug.WriteLine(verifiedFile);
Debug.WriteLine(message);
return Task.CompletedTask;
});
await Verifier.Verify("value", settings);
}
#endregion
void DisableClipboard()
{
#region DisableClipboard
var settings = new VerifySettings();
settings.DisableClipboard();
#endregion
}
void EnableClipboard()
{
#region EnableClipboard
var settings = new VerifySettings();
settings.EnableClipboard();
#endregion
}
void DisableClipboardGlobal()
{
#region DisableClipboardGlobal
VerifierSettings.DisableClipboard();
#endregion
}
void DeriveTestDirectory()
{
#region DeriveTestDirectory
if (BuildServerDetector.Detected)
{
var buildDirectory = Environment.GetEnvironmentVariable("APPVEYOR_BUILD_FOLDER")!;
VerifierSettings.DeriveTestDirectory(
(sourceFile, projectDirectory) =>
{
var testDirectory = Path.GetDirectoryName(sourceFile)!;
var testDirectorySuffix = testDirectory.Replace(projectDirectory!, string.Empty);
return Path.Combine(buildDirectory, testDirectorySuffix);
});
}
#endregion
}
void AutoVerify()
{
#region AutoVerify
var settings = new VerifySettings();
settings.AutoVerify();
#endregion
}
void DisableDiff()
{
#region DisableDiff
var settings = new VerifySettings();
settings.DisableDiff();
#endregion
}
void ApplyExtraSettingsSample()
{
#region ExtraSettings
var settings = new VerifySettings();
settings.AddExtraSettings(_ =>
{
_.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
_.TypeNameHandling = TypeNameHandling.All;
});
#endregion
}
}