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

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

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

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

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