Skip to content

Commit 9d88508

Browse files
Shorten testcases (#2360)
[no important files changed]
1 parent 8f999a6 commit 9d88508

File tree

30 files changed

+128
-128
lines changed

30 files changed

+128
-128
lines changed

exercises/practice/acronym/.meta/Generator.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ using Xunit;
22

33
public class AcronymTests
44
{
5-
{{for testCase in testCases}}
5+
{{for test in tests}}
66
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{testCase.testMethodName}}()
7+
public void {{test.methodName}}()
88
{
9-
Assert.Equal({{testCase.expected | string.literal}}, Acronym.Abbreviate({{testCase.input.phrase | string.literal}}));
9+
Assert.Equal({{test.expected | string.literal}}, Acronym.Abbreviate({{test.input.phrase | string.literal}}));
1010
}
1111
{{end}}
1212
}

exercises/practice/affine-cipher/.meta/Generator.tpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ using Xunit;
33

44
public class AffineCipherTests
55
{
6-
{{for testCase in testCases}}
6+
{{for test in tests}}
77
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
8-
public void {{testCase.shortTestMethodName}}()
8+
public void {{test.shortMethodName}}()
99
{
10-
{{if testCase.expected.error}}
11-
Assert.Throws<ArgumentException>(() => AffineCipher.{{testCase.property | string.capitalize}}({{testCase.input.phrase | string.literal}}, {{testCase.input.key.a}}, {{testCase.input.key.b}}));
10+
{{if test.expected.error}}
11+
Assert.Throws<ArgumentException>(() => AffineCipher.{{test.property | string.capitalize}}({{test.input.phrase | string.literal}}, {{test.input.key.a}}, {{test.input.key.b}}));
1212
{{else}}
13-
Assert.Equal({{testCase.expected | string.literal}}, AffineCipher.{{testCase.property | string.capitalize}}({{testCase.input.phrase | string.literal}}, {{testCase.input.key.a}}, {{testCase.input.key.b}}));
13+
Assert.Equal({{test.expected | string.literal}}, AffineCipher.{{test.property | string.capitalize}}({{test.input.phrase | string.literal}}, {{test.input.key.a}}, {{test.input.key.b}}));
1414
{{end}}
1515
}
1616
{{end}}

exercises/practice/all-your-base/.meta/Generator.tpl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ using Xunit;
33

44
public class AllYourBaseTests
55
{
6-
{{for testCase in testCases}}
6+
{{for test in tests}}
77
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
8-
public void {{testCase.testMethodName}}()
8+
public void {{test.methodName}}()
99
{
10-
{{if testCase.expected.error}}
11-
int[] digits = {{testCase.input.digits}};
12-
Assert.Throws<ArgumentException>(() => AllYourBase.Rebase({{testCase.input.inputBase}}, digits, {{testCase.input.outputBase}}));
10+
{{if test.expected.error}}
11+
int[] digits = {{test.input.digits}};
12+
Assert.Throws<ArgumentException>(() => AllYourBase.Rebase({{test.input.inputBase}}, digits, {{test.input.outputBase}}));
1313
{{else}}
14-
int[] digits = {{testCase.input.digits}};
15-
int[] expected = {{testCase.expected}};
16-
Assert.Equal(expected, AllYourBase.Rebase({{testCase.input.inputBase}}, digits, {{testCase.input.outputBase}}));
14+
int[] digits = {{test.input.digits}};
15+
int[] expected = {{test.expected}};
16+
Assert.Equal(expected, AllYourBase.Rebase({{test.input.inputBase}}, digits, {{test.input.outputBase}}));
1717
{{end}}
1818
}
1919
{{end}}

exercises/practice/allergies/.meta/Generator.tpl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ using Xunit;
22

33
public class AllergiesTests
44
{
5-
{{for testCase in testCases | property "allergicTo" }}
5+
{{for test in tests | property "allergicTo" }}
66
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{testCase.testMethodName}}()
7+
public void {{test.methodName}}()
88
{
9-
var sut = new Allergies({{testCase.input.score}});
10-
Assert.{{testCase.expected ? "True" : "False"}}(sut.IsAllergicTo({{testCase.input.item | enum "Allergen"}}));
9+
var sut = new Allergies({{test.input.score}});
10+
Assert.{{test.expected ? "True" : "False"}}(sut.IsAllergicTo({{test.input.item | enum "Allergen"}}));
1111
}
1212
{{end}}
1313

14-
{{for testCase in testCases | property "list"}}
14+
{{for test in tests | property "list"}}
1515
[Fact(Skip = "Remove this Skip property to run this test")]
16-
public void {{testCase.testMethodName}}()
16+
public void {{test.methodName}}()
1717
{
18-
var sut = new Allergies({{testCase.input.score}});
19-
{{if testCase.expected.empty?}}
18+
var sut = new Allergies({{test.input.score}});
19+
{{if test.expected.empty?}}
2020
Assert.Empty(sut.List());
2121
{{else}}
2222
Allergen[] expected = [
23-
{{for expected in testCase.expected}}
23+
{{for expected in test.expected}}
2424
{{expected | enum "Allergen"}}{{if !for.last}},{{end}}
2525
{{end}}
2626
];

exercises/practice/darts/.meta/Generator.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ using Xunit;
22

33
public class DartsTests
44
{
5-
{{for testCase in testCases}}
5+
{{for test in tests}}
66
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{testCase.testMethodName}}()
7+
public void {{test.methodName}}()
88
{
9-
Assert.Equal({{testCase.expected}}, Darts.Score({{testCase.input.x}}, {{testCase.input.y}}));
9+
Assert.Equal({{test.expected}}, Darts.Score({{test.input.x}}, {{test.input.y}}));
1010
}
1111
{{end}}
1212
}

exercises/practice/difference-of-squares/.meta/Generator.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ using Xunit;
22

33
public class DifferenceOfSquaresTests
44
{
5-
{{for testCase in testCases}}
5+
{{for test in tests}}
66
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{testCase.shortTestMethodName}}()
7+
public void {{test.shortMethodName}}()
88
{
9-
Assert.Equal({{testCase.expected}}, DifferenceOfSquares.Calculate{{testCase.property | string.capitalize}}({{testCase.input.number}}));
9+
Assert.Equal({{test.expected}}, DifferenceOfSquares.Calculate{{test.property | string.capitalize}}({{test.input.number}}));
1010
}
1111
{{end}}
1212
}

exercises/practice/eliuds-eggs/.meta/Generator.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ using Xunit;
22

33
public class EliudsEggsTests
44
{
5-
{{for testCase in testCases}}
5+
{{for test in tests}}
66
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{testCase.testMethodName}}()
7+
public void {{test.methodName}}()
88
{
9-
Assert.Equal({{testCase.expected}}, EliudsEggs.EggCount({{testCase.input.number}}));
9+
Assert.Equal({{test.expected}}, EliudsEggs.EggCount({{test.input.number}}));
1010
}
1111
{{end}}
1212
}

exercises/practice/hamming/.meta/Generator.tpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ using Xunit;
33

44
public class HammingTests
55
{
6-
{{for testCase in testCases}}
6+
{{for test in tests}}
77
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
8-
public void {{testCase.testMethodName}}()
8+
public void {{test.methodName}}()
99
{
10-
{{if testCase.expected.error}}
11-
Assert.Throws<ArgumentException>(() => Hamming.Distance({{testCase.input.strand1 | string.literal}}, {{testCase.input.strand2 | string.literal}}));
10+
{{if test.expected.error}}
11+
Assert.Throws<ArgumentException>(() => Hamming.Distance({{test.input.strand1 | string.literal}}, {{test.input.strand2 | string.literal}}));
1212
{{else}}
13-
Assert.Equal({{testCase.expected}}, Hamming.Distance({{testCase.input.strand1 | string.literal}}, {{testCase.input.strand2 | string.literal}}));
13+
Assert.Equal({{test.expected}}, Hamming.Distance({{test.input.strand1 | string.literal}}, {{test.input.strand2 | string.literal}}));
1414
{{end}}
1515
}
1616
{{end}}

exercises/practice/isogram/.meta/Generator.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ using Xunit;
22

33
public class IsogramTests
44
{
5-
{{for testCase in testCases}}
5+
{{for test in tests}}
66
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{testCase.testMethodName}}()
7+
public void {{test.methodName}}()
88
{
9-
Assert.{{testCase.expected ? "True" : "False"}}(Isogram.IsIsogram({{testCase.input.phrase | string.literal}}));
9+
Assert.{{test.expected ? "True" : "False"}}(Isogram.IsIsogram({{test.input.phrase | string.literal}}));
1010
}
1111
{{end}}
1212
}

exercises/practice/leap/.meta/Generator.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ using Xunit;
22

33
public class LeapTests
44
{
5-
{{for testCase in testCases}}
5+
{{for test in tests}}
66
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{testCase.testMethodName}}()
7+
public void {{test.methodName}}()
88
{
9-
Assert.{{testCase.expected ? "True" : "False"}}(Leap.IsLeapYear({{testCase.input.year}}));
9+
Assert.{{test.expected ? "True" : "False"}}(Leap.IsLeapYear({{test.input.year}}));
1010
}
1111
{{end}}
1212
}

0 commit comments

Comments
 (0)