@@ -121,13 +121,51 @@ public void ToUnorderedTest()
121
121
}
122
122
123
123
[ Fact ]
124
- public void ToImmutableSortedSetTest ( )
124
+ public void ToImmutableSortedSetFromArrayTest ( )
125
125
{
126
126
var set = new [ ] { 1 , 2 , 2 } . ToImmutableSortedSet ( ) ;
127
127
Assert . Same ( Comparer < int > . Default , set . KeyComparer ) ;
128
128
Assert . Equal ( 2 , set . Count ) ;
129
129
}
130
130
131
+ [ Theory ]
132
+ [ InlineData ( new int [ ] { } , new int [ ] { } ) ]
133
+ [ InlineData ( new int [ ] { 1 } , new int [ ] { 1 } ) ]
134
+ [ InlineData ( new int [ ] { 1 , 1 } , new int [ ] { 1 } ) ]
135
+ [ InlineData ( new int [ ] { 1 , 1 , 1 } , new int [ ] { 1 } ) ]
136
+ [ InlineData ( new int [ ] { 1 , 2 , 3 } , new int [ ] { 1 , 2 , 3 } ) ]
137
+ [ InlineData ( new int [ ] { 3 , 2 , 1 } , new int [ ] { 1 , 2 , 3 } ) ]
138
+ [ InlineData ( new int [ ] { 1 , 1 , 3 } , new int [ ] { 1 , 3 } ) ]
139
+ [ InlineData ( new int [ ] { 1 , 2 , 2 } , new int [ ] { 1 , 2 } ) ]
140
+ [ InlineData ( new int [ ] { 1 , 2 , 2 , 3 , 3 , 3 } , new int [ ] { 1 , 2 , 3 } ) ]
141
+ [ InlineData ( new int [ ] { 1 , 2 , 3 , 1 , 2 , 3 } , new int [ ] { 1 , 2 , 3 } ) ]
142
+ [ InlineData ( new int [ ] { 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 3 } , new int [ ] { 1 , 2 , 3 } ) ]
143
+ public void ToImmutableSortedSetFromEnumerableTest ( int [ ] input , int [ ] expectedOutput )
144
+ {
145
+ IEnumerable < int > enumerableInput = input . Select ( i => i ) ; // prevent querying for indexable interfaces
146
+ var set = enumerableInput . ToImmutableSortedSet ( ) ;
147
+ Assert . Equal ( ( IEnumerable < int > ) expectedOutput , set . ToArray ( ) ) ;
148
+ }
149
+
150
+ [ Theory ]
151
+ [ InlineData ( new int [ ] { } , new int [ ] { 1 } ) ]
152
+ [ InlineData ( new int [ ] { 1 } , new int [ ] { 1 } ) ]
153
+ [ InlineData ( new int [ ] { 1 , 1 } , new int [ ] { 1 } ) ]
154
+ [ InlineData ( new int [ ] { 1 , 1 , 1 } , new int [ ] { 1 } ) ]
155
+ [ InlineData ( new int [ ] { 1 , 2 , 3 } , new int [ ] { 1 , 2 , 3 } ) ]
156
+ [ InlineData ( new int [ ] { 3 , 2 , 1 } , new int [ ] { 1 , 2 , 3 } ) ]
157
+ [ InlineData ( new int [ ] { 1 , 1 , 3 } , new int [ ] { 1 , 3 } ) ]
158
+ [ InlineData ( new int [ ] { 1 , 2 , 2 } , new int [ ] { 1 , 2 } ) ]
159
+ [ InlineData ( new int [ ] { 1 , 2 , 2 , 3 , 3 , 3 } , new int [ ] { 1 , 2 , 3 } ) ]
160
+ [ InlineData ( new int [ ] { 1 , 2 , 3 , 1 , 2 , 3 } , new int [ ] { 1 , 2 , 3 } ) ]
161
+ [ InlineData ( new int [ ] { 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 3 } , new int [ ] { 1 , 2 , 3 } ) ]
162
+ public void UnionWithEnumerableTest ( int [ ] input , int [ ] expectedOutput )
163
+ {
164
+ IEnumerable < int > enumerableInput = input . Select ( i => i ) ; // prevent querying for indexable interfaces
165
+ var set = ImmutableSortedSet . Create ( 1 ) . Union ( enumerableInput ) ;
166
+ Assert . Equal ( ( IEnumerable < int > ) expectedOutput , set . ToArray ( ) ) ;
167
+ }
168
+
131
169
[ Fact ]
132
170
public void IndexOfTest ( )
133
171
{
0 commit comments