Skip to content

Commit

Permalink
More generators (#2377)
Browse files Browse the repository at this point in the history
* custom-set: add generator

* dnd-character: add generator

* bowling: add generator

* go-counting: add generator

[no important files changed]

* circular-buffer: add generator

* high-scores: add generator

* rational-numbers: add generator

* complex-numbers: add generator

* Remove generators
  • Loading branch information
ErikSchierboom authored Feb 6, 2025
1 parent 9318514 commit cde0f16
Show file tree
Hide file tree
Showing 24 changed files with 842 additions and 1,054 deletions.
26 changes: 26 additions & 0 deletions exercises/practice/bowling/.meta/Generator.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using Xunit;

public class {{ testClass }}
{
{{- for test in tests }}
[Fact{{ if !for.first }}(Skip = "Remove this Skip property to run this test"){{ end }}]
public void {{ test.testMethod }}()
{
var sut = new BowlingGame();
{{- if !test.input.previousRolls.empty? }}
int[] previousRolls = {{ test.input.previousRolls }};
foreach (var roll in previousRolls)
{
sut.Roll(roll);
}
{{- end -}}
{{- if test.expected.error }}
Assert.Throws<ArgumentException>(() => sut.{{ test.testedMethod }}({{ test.input.roll }}));
{{ else }}
Assert.Equal({{ test.expected }}, sut.{{ test.testedMethod }}({{ test.input.roll }}));
{{ end -}}
}
{{ end -}}
}
Loading

0 comments on commit cde0f16

Please sign in to comment.