-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSamples.cs
116 lines (99 loc) · 2.31 KB
/
Samples.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
116
[TestFixture]
public class Samples
{
[Test]
public Task Typed()
{
var id = Ulid.NewUlid();
return Verify(id);
}
[Test]
public Task String()
{
var id = Ulid.NewUlid().ToString();
return Verify(id);
}
[Test]
public Task StringDontScrub() =>
Verify("01JGXD29BZA4PD6KSHBZWHMDPQ")
.DontScrubUlids();
[Test]
public Task Prefixed()
{
var id = Ulid.NewUlid().ToString();
return Verify($" {id}");
}
[Test]
public Task Suffixed()
{
var id = Ulid.NewUlid().ToString();
return Verify($"{id} ");
}
[Test]
public Task Padded()
{
var id = Ulid.NewUlid().ToString();
return Verify($" {id} ");
}
[Test]
public Task TooLong() =>
Verify("01JGXD29BZA4PD6KSHBZWHMDPQA");
[Test]
public Task TooLongPrefixed() =>
Verify(" 01JGXD29BZA4PD6KSHBZWHMDPQA");
[Test]
public Task TooLongSuffixed() =>
Verify("01JGXD29BZA4PD6KSHBZWHMDPQA ");
[Test]
public Task TooLongPadded() =>
Verify(" 01JGXD29BZA4PD6KSHBZWHMDPQA ");
#region DontScrub
[Test]
public Task DontScrubFluent()
{
var id = Ulid.Parse("01JGXG0GDGQEP47CBQ65E50HYH");
var target = new Person
{
Id = id,
Name = "Sarah",
Description = $"Sarah ({id})"
};
return Verify(target)
.DontScrubUlids();
}
[Test]
public Task DontScrubInstance()
{
var id = Ulid.Parse("01JGXG0GDGQEP47CBQ65E50HYH");
var target = new Person
{
Id = id,
Name = "Sarah",
Description = $"Sarah ({id})"
};
var settings = new VerifySettings();
settings.DontScrubUlids();
return Verify(target, settings);
}
#endregion
#region Nested
[Test]
public Task UlidScrubbing()
{
var id = Ulid.NewUlid();
var target = new Person
{
Id = id,
Name = "Sarah",
Description = $"Sarah ({id})"
};
return Verify(target);
}
#endregion
}
public class Person
{
public required Ulid Id { get; init; }
public required string Name { get; init; }
public required string Description { get; init; }
}