aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2016-01-15 13:45:53 +0000
committerGravatar Jon Skeet <jonskeet@google.com>2016-01-15 13:45:53 +0000
commit52db5139c4f122bbd34ef34b4103d0b650e7c218 (patch)
tree09d211be7f7058a9123d0218bd9ab7b4c0302506 /csharp/src/Google.Protobuf.Test/JsonParserTest.cs
parentf437b67f600545f432863457a39870cb74675d34 (diff)
Change handling of unknown enums: we now write out the value as a number.
Diffstat (limited to 'csharp/src/Google.Protobuf.Test/JsonParserTest.cs')
-rw-r--r--csharp/src/Google.Protobuf.Test/JsonParserTest.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
index e8666b36..fb5e083e 100644
--- a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
+++ b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
@@ -876,18 +876,18 @@ namespace Google.Protobuf
}
[Test]
- [TestCase("\"FOREIGN_BAR\"")]
- [TestCase("5")]
- public void EnumValid(string value)
+ [TestCase("\"FOREIGN_BAR\"", ForeignEnum.FOREIGN_BAR)]
+ [TestCase("5", ForeignEnum.FOREIGN_BAR)]
+ [TestCase("100", (ForeignEnum) 100)]
+ public void EnumValid(string value, ForeignEnum expectedValue)
{
string json = "{ \"singleForeignEnum\": " + value + " }";
var parsed = TestAllTypes.Parser.ParseJson(json);
- Assert.AreEqual(new TestAllTypes { SingleForeignEnum = ForeignEnum.FOREIGN_BAR }, parsed);
+ Assert.AreEqual(new TestAllTypes { SingleForeignEnum = expectedValue }, parsed);
}
[Test]
[TestCase("\"NOT_A_VALID_VALUE\"")]
- [TestCase("100")]
[TestCase("5.5")]
public void Enum_Invalid(string value)
{