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

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

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

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

            try
            {
                interceptedTask.Wait();
            }
            catch (AggregateException ae)
            {
                CheckForHelloException(ae);
            }
        }
Exemple #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.");
            }
        }
Exemple #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.");
            }
        }