@@ -1411,9 +1411,9 @@ public void When_DataContext_Changing()
1411
1411
var datacontext2 = new NullablePropertyOwner { MyNullable = 42 } ;
1412
1412
var datacontext3 = new NullablePropertyOwner { MyNullable = 84 } ;
1413
1413
1414
- var changes = new List < DependencyPropertyChangedEventArgs > ( ) ;
1414
+ var values = new List < object > ( ) ;
1415
1415
1416
- SUT . MyNullableChanged += ( snd , evt ) => changes . Add ( evt ) ;
1416
+ SUT . MyNullableChanged += ( snd , evt ) => values . Add ( evt . NewValue ) ;
1417
1417
1418
1418
SUT . SetBinding (
1419
1419
NullablePropertyOwner . MyNullableProperty ,
@@ -1424,28 +1424,28 @@ public void When_DataContext_Changing()
1424
1424
) ;
1425
1425
1426
1426
SUT . DataContext = datacontext1 ;
1427
- changes . Count . Should ( ) . Be ( 1 ) ;
1428
- changes . Last ( ) . NewValue . Should ( ) . Be ( 42 ) ;
1427
+ values . Count . Should ( ) . Be ( 1 ) ;
1428
+ values . Last ( ) . Should ( ) . Be ( 42 ) ;
1429
1429
1430
1430
SUT . DataContext = datacontext2 ;
1431
- changes . Count . Should ( ) . Be ( 1 ) ; // Here we ensure we're not receiving a default value, still no changes
1431
+ values . Count . Should ( ) . Be ( 1 ) ; // Here we ensure we're not receiving a default value, still no changes
1432
1432
1433
1433
SUT . DataContext = datacontext3 ;
1434
- changes . Count . Should ( ) . Be ( 2 ) ;
1435
- changes . Last ( ) . NewValue . Should ( ) . Be ( 84 ) ;
1434
+ values . Count . Should ( ) . Be ( 2 ) ;
1435
+ values . Last ( ) . Should ( ) . Be ( 84 ) ;
1436
1436
1437
1437
SUT . DataContext = null ;
1438
- changes . Count . Should ( ) . Be ( 3 ) ;
1439
- changes . Last ( ) . NewValue . Should ( ) . Be ( null ) ;
1438
+ values . Count . Should ( ) . Be ( 3 ) ;
1439
+ values . Last ( ) . Should ( ) . Be ( null ) ;
1440
1440
1441
1441
var parent = new Border { Child = SUT } ;
1442
1442
1443
1443
parent . DataContext = datacontext1 ;
1444
- changes . Count . Should ( ) . Be ( 3 ) ;
1444
+ values . Count . Should ( ) . Be ( 3 ) ;
1445
1445
1446
1446
SUT . DataContext = DependencyProperty . UnsetValue ; // Propagate the datacontext from parent
1447
- changes . Count . Should ( ) . Be ( 4 ) ;
1448
- changes . Last ( ) . NewValue . Should ( ) . Be ( 42 ) ;
1447
+ values . Count . Should ( ) . Be ( 4 ) ;
1448
+ values . Last ( ) . Should ( ) . Be ( 42 ) ;
1449
1449
}
1450
1450
1451
1451
[ TestMethod ]
0 commit comments