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