diff options
author | Jon Skeet <jonskeet@google.com> | 2016-01-15 11:39:54 +0000 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2016-01-15 11:39:54 +0000 |
commit | 022a9b267561a3fccfcfaa7023779b969692bf74 (patch) | |
tree | 5f1644de36c2e597e394d396c87336ca73c9e403 /csharp/src/Google.Protobuf.Test | |
parent | 1fc485928fc7a6483b700867f1a6cb2acfa8da5d (diff) | |
download | protobuf-022a9b267561a3fccfcfaa7023779b969692bf74.tar.gz protobuf-022a9b267561a3fccfcfaa7023779b969692bf74.tar.bz2 protobuf-022a9b267561a3fccfcfaa7023779b969692bf74.zip |
Allow the original field name (rather than camel-cased) when parsing JSON
Diffstat (limited to 'csharp/src/Google.Protobuf.Test')
-rw-r--r-- | csharp/src/Google.Protobuf.Test/JsonParserTest.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs index d3c3a489..aa090d12 100644 --- a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs +++ b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs @@ -72,6 +72,14 @@ namespace Google.Protobuf } [Test] + public void OriginalFieldNameAccepted() + { + var json = "{ \"single_int32\": 10 }"; + var expected = new TestAllTypes { SingleInt32 = 10 }; + Assert.AreEqual(expected, TestAllTypes.Parser.ParseJson(json)); + } + + [Test] public void SourceContextRoundtrip() { AssertRoundtrip(new SourceContext { FileName = "foo.proto" }); |