Skip to content

Commit fde4464

Browse files
robot-simulator: add generator
1 parent 318b914 commit fde4464

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{ func sut
2+
$"new RobotSimulator({enum $0.direction "Direction"}, {$0.position.x}, {$0.position.y})"
3+
end }}
4+
5+
using Xunit;
6+
7+
public class {{ testClass }}
8+
{
9+
{{- for test in tests }}
10+
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
11+
public void {{ test.testMethod }}()
12+
{
13+
var sut = {{ test.input | sut }};
14+
{{- if test.property == "move" }}
15+
sut.Move({{ test.input.instructions | string.literal }});
16+
{{- end }}
17+
Assert.Equal({{ test.expected.direction | enum "Direction" }}, sut.Direction);
18+
Assert.Equal({{ test.expected.position.x }}, sut.X);
19+
Assert.Equal({{ test.expected.position.y }}, sut.Y);
20+
}
21+
{{ end -}}
22+
}

0 commit comments

Comments
 (0)