@@ -190,6 +190,16 @@ public void ObserveDuration_Func_NullOnObserveException_ObservesDirectly()
190190 observer . Received ( 1 ) . Observe ( Arg . Is < double > ( d => d >= 0 ) ) ;
191191 }
192192
193+ [ Fact ]
194+ public void ObserveDuration_Func_NullOnObserveException_ObserveException_Throws ( )
195+ {
196+ var observer = Substitute . For < IValueObserver > ( ) ;
197+ observer . When ( o => o . Observe ( Arg . Any < double > ( ) ) ) . Throw ( new InvalidOperationException ( "observe" ) ) ;
198+
199+ Assert . Throws < InvalidOperationException > ( ( ) =>
200+ observer . ObserveDuration ( ( ) => 42 , null ) ) ;
201+ }
202+
193203 [ Fact ]
194204 public async Task ObserveDurationAsync_Action_NullOnObserveException_ObservesDirectly ( )
195205 {
@@ -211,6 +221,26 @@ public async Task ObserveDurationAsync_Func_NullOnObserveException_ObservesDirec
211221 observer . Received ( 1 ) . Observe ( Arg . Is < double > ( d => d >= 0 ) ) ;
212222 }
213223
224+ [ Fact ]
225+ public async Task ObserveDurationAsync_Action_NullOnObserveException_ObserveException_Throws ( )
226+ {
227+ var observer = Substitute . For < IValueObserver > ( ) ;
228+ observer . When ( o => o . Observe ( Arg . Any < double > ( ) ) ) . Throw ( new InvalidOperationException ( "observe" ) ) ;
229+
230+ await Assert . ThrowsAsync < InvalidOperationException > ( ( ) =>
231+ observer . ObserveDurationAsync ( ( ) => Task . CompletedTask , null ) ) ;
232+ }
233+
234+ [ Fact ]
235+ public async Task ObserveDurationAsync_Func_NullOnObserveException_ObserveException_Throws ( )
236+ {
237+ var observer = Substitute . For < IValueObserver > ( ) ;
238+ observer . When ( o => o . Observe ( Arg . Any < double > ( ) ) ) . Throw ( new InvalidOperationException ( "observe" ) ) ;
239+
240+ await Assert . ThrowsAsync < InvalidOperationException > ( ( ) =>
241+ observer . ObserveDurationAsync ( ( ) => Task . FromResult ( 42 ) , null ) ) ;
242+ }
243+
214244 [ Fact ]
215245 public void ObserveDuration_Action_MethodException_StillObservesWithOnObserveException ( )
216246 {
0 commit comments