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