Skip to content

Commit d1e7758

Browse files
Fix
1 parent c515d81 commit d1e7758

File tree

10 files changed

+73
-73
lines changed

10 files changed

+73
-73
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using Xunit;
22

3-
public class {{testClass}}
3+
public class {{ testClass }}
44
{
5-
{{for test in tests}}
6-
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{test.testMethod}}()
5+
{{- for test in tests }}
6+
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
7+
public void {{ test.testMethod }}()
88
{
9-
Assert.Equal({{test.expected | string.literal}}, {{testedClass}}.{{test.testedMethod}}({{test.input.plaintext | string.literal}}));
9+
Assert.Equal({{ test.expected | string.literal }}, {{ testedClass }}.{{ test.testedMethod }}({{ test.input.plaintext | string.literal }}));
1010
}
11-
{{end}}
11+
{{ end -}}
1212
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using Xunit;
22

3-
public class {{testClass}}
3+
public class {{ testClass }}
44
{
5-
{{for test in tests}}
6-
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{test.testMethod}}()
5+
{{- for test in tests }}
6+
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
7+
public void {{ test.testMethod }}()
88
{
9-
Assert.{{test.expected ? "True" : "False"}}({{testedClass}}.{{test.testedMethod}}([{{for pair in test.input.dominoes}}({{pair[0]}}, {{pair[1]}}){{if !for.last}}, {{end}}{{end}}]));
9+
Assert.{{ test.expected ? "True" : "False" }}({{ testedClass }}.{{ test.testedMethod }}([{{for pair in test.input.dominoes}}({{ pair[0] }}, {{ pair[1] }}){{ if !for.last}}, {{ end }}{{ end }}]));
1010
}
11-
{{end}}
11+
{{ end -}}
1212
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
using System;
22
using Xunit;
33

4-
public class {{testClass}}
4+
public class {{ testClass }}
55
{
6-
{{for test in tests}}
7-
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
8-
public void {{test.testMethod}}()
6+
{{- for test in tests }}
7+
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
8+
public void {{ test.testMethod }}()
99
{
10-
{{if test.expected.error}}
11-
Assert.Throws<InvalidOperationException>(() => {{testedClass}}.{{test.testedMethod}}({{test.input.instructions}}));
12-
{{else}}
13-
Assert.Equal("{{test.expected | array.join " "}}", {{testedClass}}.{{test.testedMethod}}({{test.input.instructions}}));
14-
{{end}}
10+
{{- if test.expected.error }}
11+
Assert.Throws<InvalidOperationException>(() => {{ testedClass }}.{{ test.testedMethod }}({{ test.input.instructions }}));
12+
{{ else }}
13+
Assert.Equal("{{test.expected | array.join " "}}", {{ testedClass }}.{{ test.testedMethod }}({{ test.input.instructions }}));
14+
{{ end -}}
1515
}
16-
{{end}}
16+
{{ end -}}
1717
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using Xunit;
3-
41
{{func datetime
52
d = date.parse $0
63
if d.hour + d.minute + d.second == 0
@@ -10,13 +7,16 @@ using Xunit;
107
end
118
end}}
129

13-
public class {{testClass}}
10+
using System;
11+
using Xunit;
12+
13+
public class {{ testClass }}
1414
{
15-
{{for test in tests}}
16-
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
17-
public void {{test.testMethod}}()
15+
{{- for test in tests }}
16+
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
17+
public void {{ test.testMethod }}()
1818
{
19-
Assert.Equal({{test.expected | datetime}}, {{testedClass}}.{{test.testedMethod}}({{test.input.moment | datetime}}));
19+
Assert.Equal({{test.expected | datetime}}, {{ testedClass }}.{{ test.testedMethod }}({{ test.input.moment | datetime }}));
2020
}
21-
{{end}}
21+
{{ end -}}
2222
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using Xunit;
22

3-
public class {{testClass}}
3+
public class {{ testClass }}
44
{
5-
{{for test in tests}}
6-
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{test.testMethod}}()
5+
{{- for test in tests }}
6+
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
7+
public void {{ test.testMethod }}()
88
{
9-
Assert.{{test.expected ? "True" : "False"}}({{testedClass}}.{{test.testedMethod}}({{test.input.isbn | string.literal}}));
9+
Assert.{{ test.expected ? "True" : "False" }}({{ testedClass }}.{{ test.testedMethod }}({{ test.input.isbn | string.literal }}));
1010
}
11-
{{end}}
11+
{{ end -}}
1212
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using Xunit;
22

3-
public class {{testClass}}
3+
public class {{ testClass }}
44
{
5-
{{for test in tests}}
6-
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{test.testMethod}}()
5+
{{- for test in tests }}
6+
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
7+
public void {{ test.testMethod }}()
88
{
99
(int weight, int value)[] items = [{{for item in test.input.items}}(weight: {{item.weight}}, value: {{item.value}}){{if !for.last}}, {{end}}{{end}}];
10-
Assert.Equal({{test.expected}}, {{testedClass}}.{{test.testedMethod}}({{test.input.maximumWeight}}, items));
10+
Assert.Equal({{ test.expected }}, {{ testedClass }}.{{ test.testedMethod }}({{ test.input.maximumWeight }}, items));
1111
}
12-
{{end}}
12+
{{ end -}}
1313
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
using Xunit;
22

3-
public class {{testClass}}
3+
public class {{ testClass }}
44
{
5-
{{for test in tests}}
6-
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{test.testMethod}}()
5+
{{- for test in tests }}
6+
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
7+
public void {{ test.testMethod }}()
88
{
9-
var sut = new Meetup({{test.input.month}}, {{test.input.year}});
9+
var sut = new Meetup({{ test.input.month }}, {{ test.input.year }});
1010
var expected = new DateTime({{test.expected | string.replace "-0" "-" | string.replace "-" ", "}});
11-
Assert.Equal(expected, sut.Day({{test.input.dayofweek | enum "DayOfWeek"}}, {{test.input.week | enum "Schedule"}}));
11+
Assert.Equal(expected, sut.Day({{ test.input.dayofweek | enum "DayOfWeek" }}, {{ test.input.week | enum "Schedule" }}));
1212
}
13-
{{end}}
13+
{{ end -}}
1414
}
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
using Xunit;
22

3-
public class {{testClass}}
3+
public class {{ testClass }}
44
{
5-
{{for test in tests}}
6-
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{test.testMethod}}()
5+
{{- for test in tests }}
6+
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
7+
public void {{ test.testMethod }}()
88
{
9-
{{if test.expected.empty?}}
10-
Assert.Empty({{testedClass}}.Calculate({{test.input.count}}));
11-
{{else}}
12-
int[][] expected = {{test.expected}};
13-
Assert.Equal(expected, {{testedClass}}.Calculate({{test.input.count}}));
14-
{{end}}
9+
{{- if test.expected.empty? }}
10+
Assert.Empty({{ testedClass }}.Calculate({{ test.input.count }}));
11+
{{ else }}
12+
int[][] expected = {{ test.expected }};
13+
Assert.Equal(expected, {{ testedClass }}.Calculate({{ test.input.count }}));
14+
{{ end -}}
1515
}
16-
{{end}}
16+
{{ end -}}
1717
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
using Xunit;
22

3-
public class {{testClass}}
3+
public class {{ testClass }}
44
{
5-
{{for test in tests}}
6-
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{test.testMethod}}()
5+
{{- for test in tests }}
6+
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
7+
public void {{ test.testMethod }}()
88
{
9-
string[] hands = {{test.input.hands}};
10-
string[] expected = {{test.expected}};
11-
Assert.Equal(expected, {{testedClass}}.{{test.testedMethod}}(hands));
9+
string[] hands = {{ test.input.hands }};
10+
string[] expected = {{ test.expected }};
11+
Assert.Equal(expected, {{ testedClass }}.{{ test.testedMethod }}(hands));
1212
}
13-
{{end}}
13+
{{ end -}}
1414
}

generators/TemplateGenerator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private static bool ExpectsError(this JsonNode testCase) =>
6161
testCase["expected"] is JsonObject jsonObject && jsonObject.ContainsKey("error");
6262

6363
private const string GeneratorTemplate = @"
64-
{{if error}}using System;{{ end }}
64+
{{ if error }}using System;{{ end }}
6565
using Xunit;
6666
6767
public class {%{{{ testClass }}}%}
@@ -72,12 +72,12 @@ public class {%{{{ testClass }}}%}
7272
{
7373
{{- if error }}
7474
{%{{{- if test.expected.error }}}%}
75-
{{throws}}
75+
{{ throws }}
7676
{%{{{ else }}}%}
77-
{{assert}}
77+
{{ assert }}
7878
{%{{{ end -}}}%}
7979
{{- else }}
80-
{{assert}}
80+
{{ assert }}
8181
{{- end }}
8282
}
8383
{%{{{end -}}}%}

0 commit comments

Comments
 (0)