Exemple #1
0
 public void SafelyHandleError_CallsHandlerOnError()
 {
     SafeErrorUtil.SafelyHandleError(() => { throw new TestException(); }, handler);
     handler.Received().Invoke(Arg.Is<Exception>(e => e is TestException));
 }
Exemple #2
0
 public void SafelyHandleError_HandlerThrows()
 {
     handler.When(x => x.Invoke(Arg.Any<Exception>())).Throw<HandlerException>();
     SafeErrorUtil.SafelyHandleError(() => { throw new TestException(); }, handler);
 }
Exemple #3
0
 public void SafelyHandleError_DoesNotCallHandlerOnSuccess()
 {
     SafeErrorUtil.SafelyHandleError(() => { }, handler);
     handler.DidNotReceiveWithAnyArgs().Invoke(null);
 }