diff options
author | Jie Luo <anandolee@gmail.com> | 2017-02-28 10:51:19 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-28 10:51:19 -0800 |
commit | 606cb7ed2c55d5bda8aad2c88e5b0af09230fb3b (patch) | |
tree | 1bc5c982a660f16604317f27365e769b3710b3ca /csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs | |
parent | d41c47fff992a7729a36ca61f8090aa40596e948 (diff) | |
download | protobuf-606cb7ed2c55d5bda8aad2c88e5b0af09230fb3b.tar.gz protobuf-606cb7ed2c55d5bda8aad2c88e5b0af09230fb3b.tar.bz2 protobuf-606cb7ed2c55d5bda8aad2c88e5b0af09230fb3b.zip |
There might be duplicated enum values when allow_alias is true. Add PreferredAlias into OriginalNameAttribute to remove the duplication (#2727)
Diffstat (limited to 'csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs')
-rw-r--r-- | csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs index 302f8143..3b5bf773 100644 --- a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs +++ b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs @@ -67,6 +67,18 @@ namespace Google.Protobuf } [Test] + public void EnumAllowAlias() + { + var message = new TestEnumAllowAlias + { + Value = TestEnumWithDupValue.Foo2, + }; + var actualText = JsonFormatter.Default.Format(message); + var expectedText = "{ 'value': 'FOO1' }"; + AssertJson(expectedText, actualText); + } + + [Test] public void AllSingleFields() { var message = new TestAllTypes |