Skip to content

Commit 3aaa9d4

Browse files
Minor naming improvement (#2366)
[no important files changed]
1 parent 4fc0a21 commit 3aaa9d4

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

exercises/practice/rest-api/.meta/Generator.tpl

Lines changed: 0 additions & 12 deletions
This file was deleted.

exercises/practice/say/SayTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void Numbers_below_zero_are_out_of_range()
112112
}
113113

114114
[Fact(Skip = "Remove this Skip property to run this test")]
115-
public void Numbers_above_999999999999_are_out_of_range()
115+
public void Numbers_above_999_999_999_999_are_out_of_range()
116116
{
117117
Assert.Throws<ArgumentOutOfRangeException>(() => Say.InEnglish(1000000000000L));
118118
}

exercises/practice/simple-cipher/SimpleCipherTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void Random_key_cipher_can_decode()
1717
}
1818

1919
[Fact(Skip = "Remove this Skip property to run this test")]
20-
public void Random_key_cipher_is_reversible_ie_if_you_apply_decode_in_a_encoded_result_you_must_see_the_same_plaintext_encode_parameter_as_a_result_of_the_decode_method()
20+
public void Random_key_cipher_is_reversible_i_e_if_you_apply_decode_in_a_encoded_result_you_must_see_the_same_plaintext_encode_parameter_as_a_result_of_the_decode_method()
2121
{
2222
var sut = new SimpleCipher();
2323
Assert.Equal("abcdefghij", sut.Decode(sut.Encode("abcdefghij")));
@@ -45,7 +45,7 @@ public void Substitution_cipher_can_decode()
4545
}
4646

4747
[Fact(Skip = "Remove this Skip property to run this test")]
48-
public void Substitution_cipher_is_reversible_ie_if_you_apply_decode_in_a_encoded_result_you_must_see_the_same_plaintext_encode_parameter_as_a_result_of_the_decode_method()
48+
public void Substitution_cipher_is_reversible_i_e_if_you_apply_decode_in_a_encoded_result_you_must_see_the_same_plaintext_encode_parameter_as_a_result_of_the_decode_method()
4949
{
5050
var sut = new SimpleCipher("abcdefghij");
5151
Assert.Equal("abcdefghij", sut.Decode(sut.Encode("abcdefghij")));

generators/Naming.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Text.RegularExpressions;
12
using Humanizer;
23

34
namespace Generators;
@@ -19,7 +20,10 @@ private static string Transform(string str, int index) =>
1920
index == 0 && int.TryParse(str, out var i)
2021
? i.ToWords()
2122
: str.Dehumanize();
23+
24+
private static IEnumerable<string> Words(this string str) =>
25+
Regex.Split(str, @"\W+")
26+
.Where(s => !string.IsNullOrWhiteSpace(s));
2227

23-
private static string[] Words(this string str) => str.Split(' ', '-');
2428
private static string Unwords(this IEnumerable<string> strs) => string.Join(' ', strs);
2529
}

0 commit comments

Comments
 (0)