예제 #1
0
        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);
        }
예제 #2
0
 public (bool, ISession) TryConnect(INetworkAddress networkAddress)
 {
     return(SafeExecution.TryCatchWithResult(() => TryConnectInternal(networkAddress), ExceptionHandler));
 }