@@ -5,136 +5,153 @@ public class AnagramTests
55 [ Fact ]
66 public void No_matches ( )
77 {
8- var candidates = new [ ] { "hello" , "world" , "zombies" , "pants" } ;
8+ string [ ] candidates = [ "hello" , "world" , "zombies" , "pants" ] ;
99 var sut = new Anagram ( "diaper" ) ;
1010 Assert . Empty ( sut . FindAnagrams ( candidates ) ) ;
1111 }
1212
1313 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
1414 public void Detects_two_anagrams ( )
1515 {
16- var candidates = new [ ] { "lemons" , "cherry" , "melons" } ;
16+ string [ ] candidates = [ "lemons" , "cherry" , "melons" ] ;
1717 var sut = new Anagram ( "solemn" ) ;
18- var expected = new [ ] { "lemons" , "melons" } ;
18+ string [ ] expected = [ "lemons" , "melons" ] ;
1919 Assert . Equal ( expected , sut . FindAnagrams ( candidates ) ) ;
2020 }
2121
2222 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
2323 public void Does_not_detect_anagram_subsets ( )
2424 {
25- var candidates = new [ ] { "dog" , "goody" } ;
25+ string [ ] candidates = [ "dog" , "goody" ] ;
2626 var sut = new Anagram ( "good" ) ;
2727 Assert . Empty ( sut . FindAnagrams ( candidates ) ) ;
2828 }
2929
3030 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
3131 public void Detects_anagram ( )
3232 {
33- var candidates = new [ ] { "enlists" , "google" , "inlets" , "banana" } ;
33+ string [ ] candidates = [ "enlists" , "google" , "inlets" , "banana" ] ;
3434 var sut = new Anagram ( "listen" ) ;
35- var expected = new [ ] { "inlets" } ;
35+ string [ ] expected = [ "inlets" ] ;
3636 Assert . Equal ( expected , sut . FindAnagrams ( candidates ) ) ;
3737 }
3838
3939 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
4040 public void Detects_three_anagrams ( )
4141 {
42- var candidates = new [ ] { "gallery" , "ballerina" , "regally" , "clergy" , "largely" , "leading" } ;
42+ string [ ] candidates = [ "gallery" , "ballerina" , "regally" , "clergy" , "largely" , "leading" ] ;
4343 var sut = new Anagram ( "allergy" ) ;
44- var expected = new [ ] { "gallery" , "regally" , "largely" } ;
44+ string [ ] expected = [ "gallery" , "regally" , "largely" ] ;
4545 Assert . Equal ( expected , sut . FindAnagrams ( candidates ) ) ;
4646 }
4747
4848 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
4949 public void Detects_multiple_anagrams_with_different_case ( )
5050 {
51- var candidates = new [ ] { "Eons" , "ONES" } ;
51+ string [ ] candidates = [ "Eons" , "ONES" ] ;
5252 var sut = new Anagram ( "nose" ) ;
53- var expected = new [ ] { "Eons" , "ONES" } ;
53+ string [ ] expected = [ "Eons" , "ONES" ] ;
5454 Assert . Equal ( expected , sut . FindAnagrams ( candidates ) ) ;
5555 }
5656
5757 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
5858 public void Does_not_detect_non_anagrams_with_identical_checksum ( )
5959 {
60- var candidates = new [ ] { "last" } ;
60+ string [ ] candidates = [ "last" ] ;
6161 var sut = new Anagram ( "mass" ) ;
6262 Assert . Empty ( sut . FindAnagrams ( candidates ) ) ;
6363 }
6464
6565 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
6666 public void Detects_anagrams_case_insensitively ( )
6767 {
68- var candidates = new [ ] { "cashregister" , "Carthorse" , "radishes" } ;
68+ string [ ] candidates = [ "cashregister" , "Carthorse" , "radishes" ] ;
6969 var sut = new Anagram ( "Orchestra" ) ;
70- var expected = new [ ] { "Carthorse" } ;
70+ string [ ] expected = [ "Carthorse" ] ;
7171 Assert . Equal ( expected , sut . FindAnagrams ( candidates ) ) ;
7272 }
7373
7474 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
7575 public void Detects_anagrams_using_case_insensitive_subject ( )
7676 {
77- var candidates = new [ ] { "cashregister" , "carthorse" , "radishes" } ;
77+ string [ ] candidates = [ "cashregister" , "carthorse" , "radishes" ] ;
7878 var sut = new Anagram ( "Orchestra" ) ;
79- var expected = new [ ] { "carthorse" } ;
79+ string [ ] expected = [ "carthorse" ] ;
8080 Assert . Equal ( expected , sut . FindAnagrams ( candidates ) ) ;
8181 }
8282
8383 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
8484 public void Detects_anagrams_using_case_insensitive_possible_matches ( )
8585 {
86- var candidates = new [ ] { "cashregister" , "Carthorse" , "radishes" } ;
86+ string [ ] candidates = [ "cashregister" , "Carthorse" , "radishes" ] ;
8787 var sut = new Anagram ( "orchestra" ) ;
88- var expected = new [ ] { "Carthorse" } ;
88+ string [ ] expected = [ "Carthorse" ] ;
8989 Assert . Equal ( expected , sut . FindAnagrams ( candidates ) ) ;
9090 }
9191
9292 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
9393 public void Does_not_detect_an_anagram_if_the_original_word_is_repeated ( )
9494 {
95- var candidates = new [ ] { "go Go GO" } ;
95+ string [ ] candidates = [ "goGoGO" ] ;
9696 var sut = new Anagram ( "go" ) ;
9797 Assert . Empty ( sut . FindAnagrams ( candidates ) ) ;
9898 }
9999
100100 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
101101 public void Anagrams_must_use_all_letters_exactly_once ( )
102102 {
103- var candidates = new [ ] { "patter" } ;
103+ string [ ] candidates = [ "patter" ] ;
104104 var sut = new Anagram ( "tapper" ) ;
105105 Assert . Empty ( sut . FindAnagrams ( candidates ) ) ;
106106 }
107107
108108 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
109109 public void Words_are_not_anagrams_of_themselves ( )
110110 {
111- var candidates = new [ ] { "BANANA" } ;
111+ string [ ] candidates = [ "BANANA" ] ;
112112 var sut = new Anagram ( "BANANA" ) ;
113113 Assert . Empty ( sut . FindAnagrams ( candidates ) ) ;
114114 }
115115
116116 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
117117 public void Words_are_not_anagrams_of_themselves_even_if_letter_case_is_partially_different ( )
118118 {
119- var candidates = new [ ] { "Banana" } ;
119+ string [ ] candidates = [ "Banana" ] ;
120120 var sut = new Anagram ( "BANANA" ) ;
121121 Assert . Empty ( sut . FindAnagrams ( candidates ) ) ;
122122 }
123123
124124 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
125125 public void Words_are_not_anagrams_of_themselves_even_if_letter_case_is_completely_different ( )
126126 {
127- var candidates = new [ ] { "banana" } ;
127+ string [ ] candidates = [ "banana" ] ;
128128 var sut = new Anagram ( "BANANA" ) ;
129129 Assert . Empty ( sut . FindAnagrams ( candidates ) ) ;
130130 }
131131
132132 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
133133 public void Words_other_than_themselves_can_be_anagrams ( )
134134 {
135- var candidates = new [ ] { "LISTEN" , "Silent" } ;
135+ string [ ] candidates = [ "LISTEN" , "Silent" ] ;
136136 var sut = new Anagram ( "LISTEN" ) ;
137- var expected = new [ ] { "Silent" } ;
137+ string [ ] expected = [ "Silent" ] ;
138138 Assert . Equal ( expected , sut . FindAnagrams ( candidates ) ) ;
139139 }
140+
141+ [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
142+ public void Handles_case_of_greek_letters ( )
143+ {
144+ string [ ] candidates = [ "ΒΓΑ" , "ΒΓΔ" , "γβα" , "αβγ" ] ;
145+ var sut = new Anagram ( "ΑΒΓ" ) ;
146+ string [ ] expected = [ "ΒΓΑ" , "γβα" ] ;
147+ Assert . Equal ( expected , sut . FindAnagrams ( candidates ) ) ;
148+ }
149+
150+ [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
151+ public void Different_characters_may_have_the_same_bytes ( )
152+ {
153+ string [ ] candidates = [ "€a" ] ;
154+ var sut = new Anagram ( "a⬂" ) ;
155+ Assert . Empty ( sut . FindAnagrams ( candidates ) ) ;
156+ }
140157}
0 commit comments