@@ -284,17 +284,22 @@ public void Test_ReadOnlyObservableGroupedCollection_RemoveGroupInSource_ShoudRe
284
284
[ TestMethod ]
285
285
[ DataRow ( 1 , 0 ) ]
286
286
[ DataRow ( 0 , 1 ) ]
287
+ [ DataRow ( 0 , 2 ) ]
287
288
public void Test_ReadOnlyObservableGroupedCollection_MoveGroupInSource_ShoudMoveGroup ( int oldIndex , int newIndex )
288
289
{
289
290
NotifyCollectionChangedEventArgs ? collectionChangedEventArgs = null ;
290
291
int collectionChangedEventsCount = 0 ;
291
292
bool isCountPropertyChangedEventRaised = false ;
292
293
int [ ] aItemsList = new [ ] { 1 , 2 , 3 } ;
293
- int [ ] bItemsList = new [ ] { 2 , 4 , 6 } ;
294
+ int [ ] bItemsList = new [ ] { 4 , 5 , 6 } ;
295
+ int [ ] cItemsList = new [ ] { 7 , 8 , 9 } ;
296
+ int [ ] dItemsList = new [ ] { 10 , 11 , 12 } ;
294
297
List < IGrouping < string , int > > groups = new ( )
295
298
{
296
299
new IntGroup ( "A" , aItemsList ) ,
297
300
new IntGroup ( "B" , bItemsList ) ,
301
+ new IntGroup ( "C" , cItemsList ) ,
302
+ new IntGroup ( "D" , dItemsList ) ,
298
303
} ;
299
304
ObservableGroupedCollection < string , int > source = new ( groups ) ;
300
305
ReadOnlyObservableGroupedCollection < string , int > readOnlyGroup = new ( source ) ;
@@ -307,13 +312,22 @@ public void Test_ReadOnlyObservableGroupedCollection_MoveGroupInSource_ShoudMove
307
312
308
313
source . Move ( oldIndex , newIndex ) ;
309
314
310
- Assert . AreEqual ( readOnlyGroup . Count , 2 ) ;
315
+ Assert . AreEqual ( groups . Count , readOnlyGroup . Count ) ;
311
316
312
317
Assert . AreEqual ( readOnlyGroup [ 0 ] . Key , "B" ) ;
313
318
CollectionAssert . AreEquivalent ( readOnlyGroup [ 0 ] , bItemsList ) ;
314
319
315
- Assert . AreEqual ( readOnlyGroup [ 1 ] . Key , "A" ) ;
316
- CollectionAssert . AreEquivalent ( readOnlyGroup [ 1 ] , aItemsList ) ;
320
+ List < IGrouping < string , int > > tempList = new ( groups ) ;
321
+ IGrouping < string , int > tempItem = tempList [ oldIndex ] ;
322
+
323
+ tempList . RemoveAt ( oldIndex ) ;
324
+ tempList . Insert ( newIndex , tempItem ) ;
325
+
326
+ for ( int i = 0 ; i < tempList . Count ; i ++ )
327
+ {
328
+ Assert . AreEqual ( tempList [ i ] . Key , readOnlyGroup [ i ] . Key ) ;
329
+ CollectionAssert . AreEqual ( tempList [ i ] . ToArray ( ) , readOnlyGroup [ i ] . ToArray ( ) ) ;
330
+ }
317
331
318
332
Assert . IsFalse ( isCountPropertyChangedEventRaised ) ;
319
333
Assert . IsNotNull ( collectionChangedEventArgs ) ;
0 commit comments