@@ -180,28 +180,23 @@ public void GetAlternateLookup_FailsWhenIncompatible()
180180 Assert . False ( hashSet . TryGetAlternateLookup < string , int > ( out _ ) ) ;
181181 }
182182
183+ public static IEnumerable < object [ ] > Dictionary_GetAlternateLookup_OperationsMatchUnderlyingDictionary_MemberData ( )
184+ {
185+ yield return new object [ ] { EqualityComparer < string > . Default } ;
186+ yield return new object [ ] { StringComparer . Ordinal } ;
187+ yield return new object [ ] { StringComparer . OrdinalIgnoreCase } ;
188+ yield return new object [ ] { StringComparer . InvariantCulture } ;
189+ yield return new object [ ] { StringComparer . InvariantCultureIgnoreCase } ;
190+ yield return new object [ ] { StringComparer . CurrentCulture } ;
191+ yield return new object [ ] { StringComparer . CurrentCultureIgnoreCase } ;
192+ }
193+
183194 [ Theory ]
184- [ InlineData ( 0 ) ]
185- [ InlineData ( 1 ) ]
186- [ InlineData ( 2 ) ]
187- [ InlineData ( 3 ) ]
188- [ InlineData ( 4 ) ]
189- [ InlineData ( 5 ) ]
190- [ InlineData ( 6 ) ]
191- public void Dictionary_GetAlternateLookup_OperationsMatchUnderlyingDictionary ( int mode )
195+ [ MemberData ( nameof ( Dictionary_GetAlternateLookup_OperationsMatchUnderlyingDictionary_MemberData ) ) ]
196+ public void Dictionary_GetAlternateLookup_OperationsMatchUnderlyingDictionary ( IEqualityComparer < string > comparer )
192197 {
193198 // Test with a variety of comparers to ensure that the alternate lookup is consistent with the underlying dictionary
194- Dictionary < string , int > dictionary = new ( mode switch
195- {
196- 0 => EqualityComparer < string > . Default ,
197- 1 => StringComparer . Ordinal ,
198- 2 => StringComparer . OrdinalIgnoreCase ,
199- 3 => StringComparer . InvariantCulture ,
200- 4 => StringComparer . InvariantCultureIgnoreCase ,
201- 5 => StringComparer . CurrentCulture ,
202- 6 => StringComparer . CurrentCultureIgnoreCase ,
203- _ => throw new ArgumentOutOfRangeException ( nameof ( mode ) )
204- } ) ;
199+ Dictionary < string , int > dictionary = new ( comparer ) ;
205200 Dictionary < string , int > . AlternateLookup < ReadOnlySpan < char > > lookup = dictionary . GetAlternateLookup < string , int , ReadOnlySpan < char > > ( ) ;
206201 Assert . Same ( dictionary , lookup . Dictionary ) ;
207202 Assert . Same ( lookup . Dictionary , lookup . Dictionary ) ;
0 commit comments