public void DynamicMessagePackedSerialization() { IBuilder builder = DynamicMessage.CreateBuilder(TestPackedTypes.Descriptor); packedReflectionTester.SetPackedFieldsViaReflection(builder); IMessage message = builder.WeakBuild(); ByteString rawBytes = message.ToByteString(); TestPackedTypes message2 = TestPackedTypes.ParseFrom(rawBytes); TestUtil.AssertPackedFieldsSet(message2); // In fact, the serialized forms should be exactly the same, byte-for-byte. Assert.AreEqual(TestUtil.GetPackedSet().ToByteString(), rawBytes); }