From 40ea2d3a046c7ad76685183b546be7b1b94fa501 Mon Sep 17 00:00:00 2001
From: Jan Tattermusch <jtattermusch@google.com>
Date: Wed, 9 Aug 2017 10:23:15 +0200
Subject: [PATCH] improve examples in CustomErrorDetails test

---
 .../CustomErrorDetailsTest.cs                 | 21 +++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs b/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs
index be996f91e0..374c6fc23f 100644
--- a/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs
@@ -65,7 +65,7 @@ namespace Grpc.IntegrationTesting
         }
 
         [Test]
-        public async Task UnaryCall()
+        public async Task ErrorDetailsFromCallObject()
         {
             var call = client.UnaryCallAsync(new SimpleRequest { ResponseSize = 10 });
 
@@ -83,7 +83,24 @@ namespace Grpc.IntegrationTesting
             }
         }
 
-        private DebugInfo GetDebugInfo(Metadata trailers)
+        [Test]
+        public async Task ErrorDetailsFromRpcException()
+        {
+            try
+            {
+                await client.UnaryCallAsync(new SimpleRequest { ResponseSize = 10 });
+                Assert.Fail();
+            }
+            catch (RpcException e)
+            {
+                Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode);
+                var debugInfo = GetDebugInfo(e.Trailers);
+                Assert.AreEqual(debugInfo.Detail, ExceptionDetail);
+                Assert.IsNotEmpty(debugInfo.StackEntries);
+            }
+        }
+
+        private static DebugInfo GetDebugInfo(Metadata trailers)
         {
             var entry = trailers.First((e) => e.Key == DebugInfoTrailerName);
             return DebugInfo.Parser.ParseFrom(entry.ValueBytes);
-- 
GitLab