コード例 #1
0
        public void ParsePackedExtensions()
        {
            // Ensure that packed extensions can be properly parsed.
            TestPackedExtensions message  = TestUtil.GetPackedExtensionsSet();
            ByteString           rawBytes = message.ToByteString();

            ExtensionRegistry registry = TestUtil.CreateExtensionRegistry();

            TestPackedExtensions message2 = TestPackedExtensions.ParseFrom(rawBytes, registry);

            TestUtil.AssertPackedExtensionsSet(message2);
        }
コード例 #2
0
        public void SerializePackedExtensions()
        {
            // TestPackedTypes and TestPackedExtensions should have compatible wire
            // formats; check that they serialize to the same string.
            TestPackedExtensions message  = TestUtil.GetPackedExtensionsSet();
            ByteString           rawBytes = message.ToByteString();

            TestPackedTypes message2  = TestUtil.GetPackedSet();
            ByteString      rawBytes2 = message2.ToByteString();

            Assert.AreEqual(rawBytes, rawBytes2);
        }