public void TestExtractRpcException() { AggregateException ae = new AggregateException(TEST_EXCEPTION); RpcException innerException = UnaryRpcInterceptor.ExtractRpcException(ae); Assert.IsInstanceOf <AdsBaseException>(innerException); }
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; } }); }