File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
UnitTests/UnitTests.Shared/Mvvm Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,8 @@ public void Test_AsyncRelayCommandOfT_NullWithValueType()
125125 return Task . CompletedTask ;
126126 } ) ;
127127
128- // Special case for null value types
129- Assert . IsTrue ( command . CanExecute ( null ) ) ;
128+ Assert . IsFalse ( command . CanExecute ( null ) ) ;
129+ Assert . ThrowsException < NullReferenceException > ( ( ) => command . Execute ( null ) ) ;
130130
131131 command = new AsyncRelayCommand < int > (
132132 i =>
@@ -135,7 +135,8 @@ public void Test_AsyncRelayCommandOfT_NullWithValueType()
135135 return Task . CompletedTask ;
136136 } , i => i > 0 ) ;
137137
138- Assert . ThrowsException < NullReferenceException > ( ( ) => command . CanExecute ( null ) ) ;
138+ Assert . IsFalse ( command . CanExecute ( null ) ) ;
139+ Assert . ThrowsException < NullReferenceException > ( ( ) => command . Execute ( null ) ) ;
139140 }
140141 }
141142}
Original file line number Diff line number Diff line change @@ -74,12 +74,13 @@ public void Test_RelayCommand_NullWithValueType()
7474
7575 var command = new RelayCommand < int > ( i => n = i ) ;
7676
77- // Special case for null value types
78- Assert . IsTrue ( command . CanExecute ( null ) ) ;
77+ Assert . IsFalse ( command . CanExecute ( null ) ) ;
78+ Assert . ThrowsException < NullReferenceException > ( ( ) => command . Execute ( null ) ) ;
7979
8080 command = new RelayCommand < int > ( i => n = i , i => i > 0 ) ;
8181
82- Assert . ThrowsException < NullReferenceException > ( ( ) => command . CanExecute ( null ) ) ;
82+ Assert . IsFalse ( command . CanExecute ( null ) ) ;
83+ Assert . ThrowsException < NullReferenceException > ( ( ) => command . Execute ( null ) ) ;
8384 }
8485 }
8586}
You can’t perform that action at this time.
0 commit comments