Пример #1
0
        public void TestExtractRpcException()
        {
            AggregateException ae             = new AggregateException(TEST_EXCEPTION);
            RpcException       innerException = UnaryRpcInterceptor.ExtractRpcException(ae);

            Assert.IsInstanceOf <AdsBaseException>(innerException);
        }
Пример #2
0
        public void TestInterceptStreamWithException()
        {
            TestStreamReader <object> testStreamReader = new TestStreamReader <object>(
                new object[] { }, TEST_EXCEPTION);
            StreamingRpcInterceptor <object> interceptor =
                new StreamingRpcInterceptor <object>(testStreamReader,
                                                     delegate(object foo, AggregateException e)
            {
                RpcException innerException = UnaryRpcInterceptor.ExtractRpcException(e);
                Assert.IsInstanceOf <GoogleAdsBaseException>(innerException);
                return;
            });

            Assert.Throws <AggregateException>(delegate()
            {
                bool hasMoreItems = true;

                while (hasMoreItems)
                {
                    Task <bool> task = interceptor.MoveNext();
                    task.Wait();
                    hasMoreItems = task.Result;
                    object temp  = interceptor.Current;
                }
            });
        }