diff options
author | Jon Skeet <jonskeet@google.com> | 2016-04-29 10:10:40 +0100 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2016-04-29 10:20:03 +0100 |
commit | 61307b86f561721ac47ecd74d9fd1dffa0acad53 (patch) | |
tree | bda7a9541f0639d05bfb9b1c0acde474e8e14133 /csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs | |
parent | b53417c7356deab70f44b60bd7e6270023ddc3b6 (diff) | |
download | protobuf-61307b86f561721ac47ecd74d9fd1dffa0acad53.tar.gz protobuf-61307b86f561721ac47ecd74d9fd1dffa0acad53.tar.bz2 protobuf-61307b86f561721ac47ecd74d9fd1dffa0acad53.zip |
Allow custom type URL prefixes in Any.Pack
(And likewise ignore the prefix in unpack.)
Fixes issue #1459.
Diffstat (limited to 'csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs')
-rw-r--r-- | csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs index 0b6cd7e6..827a7595 100644 --- a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs +++ b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs @@ -481,6 +481,15 @@ namespace Google.Protobuf } [Test] + public void AnyMessageType_CustomPrefix() + { + var formatter = new JsonFormatter(new JsonFormatter.Settings(false, TypeRegistry.FromMessages(TestAllTypes.Descriptor))); + var message = new TestAllTypes { SingleInt32 = 10 }; + var any = Any.Pack(message, "foo.bar/baz"); + AssertJson("{ '@type': 'foo.bar/baz/protobuf_unittest.TestAllTypes', 'singleInt32': 10 }", formatter.Format(any)); + } + + [Test] public void AnyNested() { var registry = TypeRegistry.FromMessages(TestWellKnownTypes.Descriptor, TestAllTypes.Descriptor); |