Exemplo n.º 1
0
        public void SerializationPacked()
        {
            TestPackedTypes message  = TestUtil.GetPackedSet();
            ByteString      rawBytes = message.ToByteString();

            Assert.AreEqual(rawBytes.Length, message.SerializedSize);
            TestPackedTypes message2 = TestPackedTypes.ParseFrom(rawBytes);

            TestUtil.AssertPackedFieldsSet(message2);
        }
Exemplo n.º 2
0
        public void testDynamicMessagePackedParsing()
        {
            TestPackedTypes.Builder builder = TestPackedTypes.CreateBuilder();
            TestUtil.SetPackedFields(builder);
            TestPackedTypes message = builder.Build();

            ByteString rawBytes = message.ToByteString();

            IMessage message2 = DynamicMessage.ParseFrom(TestPackedTypes.Descriptor, rawBytes);

            packedReflectionTester.AssertPackedFieldsSetViaReflection(message2);
        }
Exemplo n.º 3
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);
        }