public void TryCatchWithResult_OnSuccess_ShouldReturnResult() { var wasCatched = false; bool TestMethod() { return(true); } var result = SafeExecution.TryCatchWithResult(TestMethod, exception => wasCatched = true); Assert.False(wasCatched); Assert.True(result); }
public (bool, ISession) TryConnect(INetworkAddress networkAddress) { return(SafeExecution.TryCatchWithResult(() => TryConnectInternal(networkAddress), ExceptionHandler)); }