-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* affine-cipher: add template * allergies: add template * strain: add template * sublist: add template [no important files changed] * darts: add template * triangle: add template * Remove deprecated
- Loading branch information
1 parent
d504da2
commit f2c700c
Showing
14 changed files
with
250 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using Xunit; | ||
|
||
public class AffineCipherTests | ||
{ | ||
{{#test_cases_by_property.encode}} | ||
[Fact{{#unless @first}}(Skip = "Remove this Skip property to run this test"){{/unless}}] | ||
public void {{short_test_method_name}}() | ||
{ | ||
{{#if expected.error}} | ||
Assert.Throws<ArgumentException>(() => AffineCipher.Encode({{lit input.phrase}}, {{input.key.a}}, {{input.key.b}})); | ||
{{else}} | ||
Assert.Equal({{lit expected}}, AffineCipher.Encode({{lit input.phrase}}, {{input.key.a}}, {{input.key.b}})); | ||
{{/if}} | ||
} | ||
{{/test_cases_by_property.encode}} | ||
|
||
{{#test_cases_by_property.decode}} | ||
[Fact(Skip = "Remove this Skip property to run this test")] | ||
public void {{short_test_method_name}}() | ||
{ | ||
{{#if expected.error}} | ||
Assert.Throws<ArgumentException>(() => AffineCipher.Decode({{lit input.phrase}}, {{input.key.a}}, {{input.key.b}})); | ||
{{else}} | ||
Assert.Equal({{lit expected}}, AffineCipher.Decode({{lit input.phrase}}, {{input.key.a}}, {{input.key.b}})); | ||
{{/if}} | ||
} | ||
{{/test_cases_by_property.decode}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Xunit; | ||
|
||
public class AllergiesTests | ||
{ | ||
{{#test_cases_by_property.allergicTo}} | ||
[Fact{{#unless @first}}(Skip = "Remove this Skip property to run this test"){{/unless}}] | ||
public void {{test_method_name}}() | ||
{ | ||
var sut = new Allergies({{input.score}}); | ||
Assert.{{expected}}(sut.IsAllergicTo(Allergen.{{Capitalize input.item}})); | ||
} | ||
{{/test_cases_by_property.allergicTo}} | ||
|
||
{{#test_cases_by_property.list}} | ||
[Fact(Skip = "Remove this Skip property to run this test")] | ||
public void {{test_method_name}}() | ||
{ | ||
var sut = new Allergies({{input.score}}); | ||
{{#isempty expected}} | ||
Assert.Empty(sut.List()); | ||
{{else}} | ||
Allergen[] expected = [{{#each ../expected}}Allergen.{{Capitalize .}}{{#unless @last}},{{/unless}}{{/each}}]; | ||
Assert.Equal(expected, sut.List()); | ||
{{/isempty}} | ||
} | ||
{{/test_cases_by_property.list}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Xunit; | ||
|
||
public class DartsTests | ||
{ | ||
{{#test_cases}} | ||
[Fact{{#unless @first}}(Skip = "Remove this Skip property to run this test"){{/unless}}] | ||
public void {{test_method_name}}() | ||
{ | ||
Assert.Equal({{expected}}, Darts.Score({{input.x}}, {{input.y}})); | ||
} | ||
{{/test_cases}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Xunit; | ||
|
||
public class StrainTests | ||
{ | ||
{{#test_cases_by_property.keep}} | ||
[Fact{{#unless @first}}(Skip = "Remove this Skip property to run this test"){{/unless}}] | ||
public void {{test_method_name}}() | ||
{ | ||
{{#equals description "keeps lists"}} | ||
int[][] expected = [{{../expected}}]; | ||
int[][] input = [{{#../input.list}}[{{.}}]{{#unless @last}}, {{/unless}}{{/../input.list}}]; | ||
Assert.Equal(expected, input.Keep(x => x.Contains(5)).ToArray()); | ||
{{else}} | ||
{{#equals ../description "keeps strings"}} | ||
string[] expected = [{{#../../expected}}{{lit .}}{{#unless @last}}, {{/unless}}{{/../../expected}}]; | ||
string[] input = [{{#../../input.list}}{{lit .}}{{#unless @last}}, {{/unless}}{{/../../input.list}}]; | ||
Assert.Equal(expected, input.Keep(x => x.StartsWith('z')).ToArray()); | ||
{{else}} | ||
int[] expected = [{{../../expected}}]; | ||
int[] input = [{{../../input.list}}]; | ||
Assert.Equal(expected, input.Keep(x => {{replace ../../input.predicate "fn(x) -> " ""}}).ToArray()); | ||
{{/equals}} | ||
{{/equals}} | ||
} | ||
{{/test_cases_by_property.keep}} | ||
|
||
{{#test_cases_by_property.discard}} | ||
[Fact(Skip = "Remove this Skip property to run this test")] | ||
public void {{test_method_name}}() | ||
{ | ||
{{#equals description "discards lists"}} | ||
int[][] expected = [{{../expected}}]; | ||
int[][] input = [{{#../input.list}}[{{.}}]{{#unless @last}}, {{/unless}}{{/../input.list}}]; | ||
Assert.Equal(expected, input.Discard(x => x.Contains(5)).ToArray()); | ||
{{else}} | ||
{{#equals ../description "discards strings"}} | ||
string[] expected = [{{#../../expected}}{{lit .}}{{#unless @last}}, {{/unless}}{{/../../expected}}]; | ||
string[] input = [{{#../../input.list}}{{lit .}}{{#unless @last}}, {{/unless}}{{/../../input.list}}]; | ||
Assert.Equal(expected, input.Discard(x => x.StartsWith('z')).ToArray()); | ||
{{else}} | ||
int[] expected = [{{../../expected}}]; | ||
int[] input = [{{../../input.list}}]; | ||
Assert.Equal(expected, input.Discard(x => {{replace ../../input.predicate "fn(x) -> " ""}}).ToArray()); | ||
{{/equals}} | ||
{{/equals}} | ||
} | ||
{{/test_cases_by_property.discard}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.