Example #1
0
        public void TestInterceptFuncDelegateNoException()
        {
            Func <int> interceptedFunc = UnaryRpcInterceptor.Intercept(returnIntFunc);

            Assert.DoesNotThrow(delegate()
            {
                interceptedFunc();
            });
        }
Example #2
0
        public void TestInterceptTaskNoException()
        {
            Task <int> interceptedTask = UnaryRpcInterceptor.Intercept(Task.Run(returnIntFunc));

            Assert.DoesNotThrow(delegate()
            {
                interceptedTask.Wait();
            });
        }
Example #3
0
        public void TestInterceptActionNoException()
        {
            Action interceptedAction = UnaryRpcInterceptor.Intercept(returnAction);

            Assert.DoesNotThrow(delegate()
            {
                interceptedAction();
            });
        }
Example #4
0
        public void TestInterceptTaskWithException()
        {
            Task <int> interceptedTask = UnaryRpcInterceptor.Intercept <int, HelloException>(
                Task.Run(throwExceptionFunc));

            try
            {
                interceptedTask.Wait();
            }
            catch (AggregateException ae)
            {
                CheckForHelloException(ae);
            }
        }
Example #5
0
        public void TestInterceptActionWithException()
        {
            Action interceptedTask = UnaryRpcInterceptor.Intercept(throwExceptionAction);

            try
            {
                interceptedTask();
            }
            catch (GoogleAdsException)
            {
                Assert.Pass("Exception parsed correctly.");
            }
            catch
            {
                Assert.Pass("Exception could not be parsed.");
            }
        }
Example #6
0
        public void TestInterceptFuncDelegateWithException()
        {
            Func <int> interceptedFunc = UnaryRpcInterceptor.Intercept(throwExceptionFunc);

            try
            {
                interceptedFunc();
            }
            catch (GoogleAdsException)
            {
                Assert.Pass("Exception parsed correctly.");
            }
            catch
            {
                Assert.Pass("Exception could not be parsed.");
            }
        }