@@ -284,17 +284,22 @@ public void Test_ReadOnlyObservableGroupedCollection_RemoveGroupInSource_ShoudRe
284284 [ TestMethod ]
285285 [ DataRow ( 1 , 0 ) ]
286286 [ DataRow ( 0 , 1 ) ]
287+ [ DataRow ( 0 , 2 ) ]
287288 public void Test_ReadOnlyObservableGroupedCollection_MoveGroupInSource_ShoudMoveGroup ( int oldIndex , int newIndex )
288289 {
289290 NotifyCollectionChangedEventArgs ? collectionChangedEventArgs = null ;
290291 int collectionChangedEventsCount = 0 ;
291292 bool isCountPropertyChangedEventRaised = false ;
292293 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 } ;
294297 List < IGrouping < string , int > > groups = new ( )
295298 {
296299 new IntGroup ( "A" , aItemsList ) ,
297300 new IntGroup ( "B" , bItemsList ) ,
301+ new IntGroup ( "C" , cItemsList ) ,
302+ new IntGroup ( "D" , dItemsList ) ,
298303 } ;
299304 ObservableGroupedCollection < string , int > source = new ( groups ) ;
300305 ReadOnlyObservableGroupedCollection < string , int > readOnlyGroup = new ( source ) ;
@@ -307,13 +312,22 @@ public void Test_ReadOnlyObservableGroupedCollection_MoveGroupInSource_ShoudMove
307312
308313 source . Move ( oldIndex , newIndex ) ;
309314
310- Assert . AreEqual ( readOnlyGroup . Count , 2 ) ;
315+ Assert . AreEqual ( groups . Count , readOnlyGroup . Count ) ;
311316
312317 Assert . AreEqual ( readOnlyGroup [ 0 ] . Key , "B" ) ;
313318 CollectionAssert . AreEquivalent ( readOnlyGroup [ 0 ] , bItemsList ) ;
314319
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+ }
317331
318332 Assert . IsFalse ( isCountPropertyChangedEventRaised ) ;
319333 Assert . IsNotNull ( collectionChangedEventArgs ) ;
0 commit comments