aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
diff options
context:
space:
mode:
authorJon Skeet <skeet@pobox.com>2016-05-06 06:29:03 +0100
committerJon Skeet <skeet@pobox.com>2016-05-06 06:29:03 +0100
commit5b5e369b185325c49ee450965ceceb6ac5586b16 (patch)
tree5dac86476f4d2cafa84333d3c1114a9632c71395 /csharp/src/Google.Protobuf.Test/JsonParserTest.cs
parent17b6fc31eb8a9b65501cd7c53235a88efdc94394 (diff)
parent61307b86f561721ac47ecd74d9fd1dffa0acad53 (diff)
downloadprotobuf-5b5e369b185325c49ee450965ceceb6ac5586b16.tar.gz
protobuf-5b5e369b185325c49ee450965ceceb6ac5586b16.tar.bz2
protobuf-5b5e369b185325c49ee450965ceceb6ac5586b16.zip
Merge pull request #1471 from jskeet/any-host
Allow custom type URL prefixes in Any.Pack
Diffstat (limited to 'csharp/src/Google.Protobuf.Test/JsonParserTest.cs')
-rw-r--r--csharp/src/Google.Protobuf.Test/JsonParserTest.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
index 684f52b4..c3ad851b 100644
--- a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
+++ b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
@@ -811,6 +811,17 @@ namespace Google.Protobuf
}
[Test]
+ public void Any_CustomPrefix()
+ {
+ var registry = TypeRegistry.FromMessages(TestAllTypes.Descriptor);
+ var message = new TestAllTypes { SingleInt32 = 10 };
+ var original = Any.Pack(message, "custom.prefix/middle-part");
+ var parser = new JsonParser(new JsonParser.Settings(10, registry));
+ string json = "{ \"@type\": \"custom.prefix/middle-part/protobuf_unittest.TestAllTypes\", \"singleInt32\": 10 }";
+ Assert.AreEqual(original, parser.Parse<Any>(json));
+ }
+
+ [Test]
public void Any_UnknownType()
{
string json = "{ \"@type\": \"type.googleapis.com/bogus\" }";