Skip to content

Commit bf85b84

Browse files
Allow "overloading"
1 parent a9fde92 commit bf85b84

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class {{exercise.name}}Tests
44
{
55
{{for test_case in test_cases}}
66
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
7-
public void {{test_case.path | method_name}}()
7+
public void {{test_case.path | method_name}}()
88
{
99
Assert.Equal("{{test_case.expected}}", {{exercise.name}}.Abbreviate("{{test_case.input.phrase}}"));
1010
}

exercises/practice/isogram/IsogramTests.cs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,26 @@ public void IsogramWithDuplicatedHyphen()
6363
}
6464

6565
[Fact(Skip = "Remove this Skip property to run this test")]
66-
public void["madeUpNameThatIsAnIsogram()
67-
{
68-
Assert.True(Isogram.IsIsogram( "Emily Jung Schwartzkopf" ) ) ; }
69-
70-
[Fact(Skip = "Remove this Skip property to run this test")]
71-
public void DuplicatedCharacterInTheMiddle()
72-
{
73-
Assert.False(Isogram.IsIsogram("accentor"));
74-
}
66+
public void MadeUpNameThatIsAnIsogram()
67+
{
68+
Assert.True(Isogram.IsIsogram("Emily Jung Schwartzkopf"));
69+
}
7570

76-
[Fact(Skip = "Remove this Skip property to run this test")]
77-
public void SameFirstAndLastCharacters()
78-
{
79-
Assert.False(Isogram.IsIsogram("angola"));
80-
}
71+
[Fact(Skip = "Remove this Skip property to run this test")]
72+
public void DuplicatedCharacterInTheMiddle()
73+
{
74+
Assert.False(Isogram.IsIsogram("accentor"));
75+
}
8176

82-
[Fact(Skip = "Remove this Skip property to run this test")]
83-
public void WordWithDuplicatedCharacterAndWithTwoHyphens()
84-
{
85-
Assert.False(Isogram.IsIsogram("up-to-date"));
86-
} }
77+
[Fact(Skip = "Remove this Skip property to run this test")]
78+
public void SameFirstAndLastCharacters()
79+
{
80+
Assert.False(Isogram.IsIsogram("angola"));
81+
}
8782

83+
[Fact(Skip = "Remove this Skip property to run this test")]
84+
public void WordWithDuplicatedCharacterAndWithTwoHyphens()
85+
{
86+
Assert.False(Isogram.IsIsogram("up-to-date"));
87+
}
88+
}

generators.new/TemplateRenderer.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ private static Dictionary<string, TestCase[]> GroupTestCasesByProperty(TestCase[
3232
.ToDictionary(kv => kv.Key, kv => kv.ToArray());
3333

3434
private class CustomFunctions : ScriptObject
35-
{
36-
public static string MethodName(params string[] path) => string.Join(" ", path).Dehumanize();
35+
{
36+
public static string MethodName(params object[] path)
37+
{
38+
var flattenedPath = path.SelectMany(element => element as IEnumerable<string> ?? [element.ToString()!]);
39+
return string.Join(" ", flattenedPath).Dehumanize();
40+
}
3741
}
3842
}

0 commit comments

Comments
 (0)