public void WriteWholePackedFieldsMessage()
        {
            TestPackedTypes message = TestUtil.GetPackedSet();

            byte[] rawBytes = message.ToByteArray();
            TestUtil.AssertEqualBytes(TestUtil.GetGoldenPackedFieldsMessage().ToByteArray(),
                                      rawBytes);
        }
示例#2
0
        public void TestRoundTripPackedTypes()
        {
            TestPackedTypes msg     = AddPackedTypes(new TestPackedTypes.Builder(), 5).Build();
            object          content = SerializeMessage <TestPackedTypes, TestPackedTypes.Builder>(msg);

            TestPackedTypes copy = DeserializeMessage <TestPackedTypes, TestPackedTypes.Builder>(content, TestPackedTypes.CreateBuilder(), ExtensionRegistry.Empty).Build();

            Assert.AreEqual(msg, copy);
            AssertOutputEquals(content, SerializeMessage <TestPackedTypes, TestPackedTypes.Builder>(copy));
            Assert.AreEqual(Convert.ToBase64String(msg.ToByteArray()), Convert.ToBase64String(copy.ToByteArray()));
        }