Skip to content

Commit b2eaeb2

Browse files
authored
Make 'header' parameter nullable in combination ap is (#1682)
* Make 'header' parameter nullable in Combination APIs Change the header parameter from bool header = false to nullable bool? header = null across Verifier Combination methods and VerifyBase wrappers. Files updated: src/Verify.Expecto/Verifier_Combination.cs, src/Verify.Fixie/Verifier_Combination.cs, src/Verify.MSTest/Verifier_Combination.cs, src/Verify.MSTest/VerifyBase_Combination.cs, src/Verify.TUnit/Verifier_Combination.cs, src/Verify.XunitV3/Verifier_Combination.cs, src/Verify.XunitV3/VerifyBase_Combination.cs. This makes the header argument tri-state (true/false/unspecified) and keeps signature forwarding consistent. * .
1 parent 657345b commit b2eaeb2

19 files changed

Lines changed: 204 additions & 7 deletions

src/Verify.Expecto/Verifier_Combination.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static Combination Combination(
88
string name,
99
bool? captureExceptions = null,
1010
VerifySettings? settings = null,
11-
bool header = false,
11+
bool? header = null,
1212
[CallerFilePath] string sourceFile = "")
1313
{
1414
var assembly = Assembly.GetCallingAssembly()!;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
a, b, c : Result,
3+
A, 1, True : a1True,
4+
A, 1, False: a1False,
5+
A, 2, True : a2True,
6+
A, 2, False: a2False,
7+
A, 3, True : a3True,
8+
A, 3, False: a3False,
9+
b, 1, True : b1True,
10+
b, 1, False: b1False,
11+
b, 2, True : b2True,
12+
b, 2, False: b2False,
13+
b, 3, True : b3True,
14+
b, 3, False: b3False,
15+
C, 1, True : c1True,
16+
C, 1, False: c1False,
17+
C, 2, True : c2True,
18+
C, 2, False: c2False,
19+
C, 3, True : c3True,
20+
C, 3, False: c3False
21+
}

src/Verify.Fixie.Tests/CombinationTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ public Task MixedLengths()
7373
a, b, c);
7474
}
7575

76+
public Task WithHeader()
77+
{
78+
string[] a = ["A", "b", "C"];
79+
int[] b = [1, 2, 3];
80+
bool[] c = [true, false];
81+
return Combination(header: true)
82+
.Verify(
83+
(a, b, c) => a.ToLower() + b + c,
84+
a, b, c);
85+
}
86+
7687
public Task WithException()
7788
{
7889
string[] a = ["A", "b", "C"];

src/Verify.Fixie/Verifier_Combination.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public static partial class Verifier
66
public static Combination Combination(
77
bool? captureExceptions = null,
88
VerifySettings? settings = null,
9-
bool header = false,
9+
bool? header = null,
1010
[CallerFilePath] string sourceFile = "") =>
1111
new(
1212
captureExceptions,
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
a, b, c : Result,
3+
A, 1, True : a1True,
4+
A, 1, False: a1False,
5+
A, 2, True : a2True,
6+
A, 2, False: a2False,
7+
A, 3, True : a3True,
8+
A, 3, False: a3False,
9+
b, 1, True : b1True,
10+
b, 1, False: b1False,
11+
b, 2, True : b2True,
12+
b, 2, False: b2False,
13+
b, 3, True : b3True,
14+
b, 3, False: b3False,
15+
C, 1, True : c1True,
16+
C, 1, False: c1False,
17+
C, 2, True : c2True,
18+
C, 2, False: c2False,
19+
C, 3, True : c3True,
20+
C, 3, False: c3False
21+
}

src/Verify.MSTest.Tests/CombinationTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ public Task MixedLengths()
8181
a, b, c);
8282
}
8383

84+
[TestMethod]
85+
public Task WithHeader()
86+
{
87+
string[] a = ["A", "b", "C"];
88+
int[] b = [1, 2, 3];
89+
bool[] c = [true, false];
90+
return Combination(header: true)
91+
.Verify(
92+
(a, b, c) => a.ToLower() + b + c,
93+
a, b, c);
94+
}
95+
8496
[TestMethod]
8597
public Task WithException()
8698
{

src/Verify.MSTest/Verifier_Combination.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public static partial class Verifier
66
public static Combination Combination(
77
bool? captureExceptions = null,
88
VerifySettings? settings = null,
9-
bool header = false,
9+
bool? header = null,
1010
[CallerFilePath] string sourceFile = "") =>
1111
new(
1212
captureExceptions,

src/Verify.MSTest/VerifyBase_Combination.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public partial class VerifyBase
88
public Combination Combination(
99
bool? captureExceptions = null,
1010
VerifySettings? settings = null,
11-
bool header = false,
11+
bool? header = null,
1212
[CallerFilePath] string sourceFile = "") =>
1313
Verifier.Combination(captureExceptions, settings ?? settings, header, sourceFile);
1414
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
a, b, c : Result,
3+
A, 1, True : a1True,
4+
A, 1, False: a1False,
5+
A, 2, True : a2True,
6+
A, 2, False: a2False,
7+
A, 3, True : a3True,
8+
A, 3, False: a3False,
9+
b, 1, True : b1True,
10+
b, 1, False: b1False,
11+
b, 2, True : b2True,
12+
b, 2, False: b2False,
13+
b, 3, True : b3True,
14+
b, 3, False: b3False,
15+
C, 1, True : c1True,
16+
C, 1, False: c1False,
17+
C, 2, True : c2True,
18+
C, 2, False: c2False,
19+
C, 3, True : c3True,
20+
C, 3, False: c3False
21+
}

src/Verify.NUnit.Tests/CombinationTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ public Task MixedLengths()
8181
a, b, c);
8282
}
8383

84+
[Test]
85+
public Task WithHeader()
86+
{
87+
string[] a = ["A", "b", "C"];
88+
int[] b = [1, 2, 3];
89+
bool[] c = [true, false];
90+
return Combination(header: true)
91+
.Verify(
92+
(a, b, c) => a.ToLower() + b + c,
93+
a, b, c);
94+
}
95+
8496
[Test]
8597
public Task WithException()
8698
{

0 commit comments

Comments
 (0)