From f994cfe8084ee81916a546715254d93c9f2a9380 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Thu, 30 Jul 2015 14:06:01 +0100 Subject: Handle field names of "descriptor" and "types". --- csharp/src/Google.Protobuf.Test/IssuesTest.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'csharp/src/Google.Protobuf.Test/IssuesTest.cs') diff --git a/csharp/src/Google.Protobuf.Test/IssuesTest.cs b/csharp/src/Google.Protobuf.Test/IssuesTest.cs index b5ad34ae..47a10c50 100644 --- a/csharp/src/Google.Protobuf.Test/IssuesTest.cs +++ b/csharp/src/Google.Protobuf.Test/IssuesTest.cs @@ -52,5 +52,13 @@ namespace Google.Protobuf // TODO(jonskeet): Reflection... // Assert.AreEqual(3, (int)message[field]); } + + [Test] + public void ReservedNames() + { + var message = new ReservedNames { Types_ = 10, Descriptor_ = 20 }; + // Underscores aren't reflected in the JSON. + Assert.AreEqual("{ \"types\": 10, \"descriptor\": 20 }", message.ToString()); + } } } -- cgit v1.2.3