From 877f426d352de8e1f062aa28c2ea4d2039ef96bf Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 5 Jun 2019 10:52:53 -0400 Subject: [PATCH] add special_status_message testcase to C# interop client --- .../Grpc.IntegrationTesting/InteropClient.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 47503530820..83b0095f7f0 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -185,6 +185,9 @@ namespace Grpc.IntegrationTesting case "unimplemented_service": RunUnimplementedService(new UnimplementedService.UnimplementedServiceClient(channel)); break; + case "special_status_message": + await RunSpecialStatusMessageAsync(client); + break; case "unimplemented_method": RunUnimplementedMethod(client); break; @@ -567,6 +570,33 @@ namespace Grpc.IntegrationTesting Console.WriteLine("Passed!"); } + private static async Task RunSpecialStatusMessageAsync(TestService.TestServiceClient client) + { + Console.WriteLine("running special_status_message"); + + var echoStatus = new EchoStatus + { + Code = 2, + Message = "\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP 😈\t\n" + }; + + try + { + await client.UnaryCallAsync(new SimpleRequest + { + ResponseStatus = echoStatus + }); + Assert.Fail(); + } + catch (RpcException e) + { + Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode); + Assert.AreEqual(echoStatus.Message, e.Status.Detail); + } + + Console.WriteLine("Passed!"); + } + public static void RunUnimplementedService(UnimplementedService.UnimplementedServiceClient client) { Console.WriteLine("running unimplemented_service");