-
-
Notifications
You must be signed in to change notification settings - Fork 154
/
Copy pathInnerVerifyTests.cs
57 lines (49 loc) · 1.66 KB
/
InnerVerifyTests.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
public class InnerVerifyTests
{
static string splitFilePath;
static string filePath;
static string targetDirectory;
static InnerVerifyTests()
{
var solutionDirectory = AttributeReader.GetSolutionDirectory();
targetDirectory = Path.Combine(solutionDirectory, "Verify.Tests", "InnerVerifyTests");
filePath = Path.Combine(targetDirectory, "sample.txt");
splitFilePath = Path.Combine(targetDirectory, "sample.innersplit");
}
[Fact]
#region VerifyFileWithoutUnitTest
public async Task VerifyExternalFile()
{
using var verifier = new InnerVerifier(targetDirectory, name: "sample");
await verifier.VerifyFile(filePath);
}
#endregion
[Fact]
public async Task VerifyExternalFileLocked()
{
using var locker = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
using var verifier = new InnerVerifier(targetDirectory, "sample2");
await verifier.VerifyFile(filePath);
}
[ModuleInitializer]
public static void Init() =>
VerifierSettings.RegisterFileConverter(
"innersplit",
(stream, _) =>
{
var reader = new StreamReader(stream);
return new(
"the info",
[
new("txt", reader.ReadToEnd()),
new("txt", "text1"),
new("txt", "text2")
]);
});
[Fact]
public async Task Split()
{
using var verifier = new InnerVerifier(targetDirectory, "split");
await verifier.VerifyFile(splitFilePath);
}
}