コード例 #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));
 }