public void TruncatedMessageFieldThrows()
        {
            // 130, 3 is the message tag
            // 1 is the data length - but there's no data.
            var data = new byte[] { 130, 3, 1 };

            MessageParsingHelpers.AssertReadingMessageThrows <TestAllTypes, InvalidProtocolBufferException>(TestAllTypes.Parser, data);
        }
        public void ExtraEndGroupThrows()
        {
            var stream = new MemoryStream();
            var output = new CodedOutputStream(stream);

            output.WriteTag(TestAllTypes.SingleFixed32FieldNumber, WireFormat.WireType.Fixed32);
            output.WriteFixed32(123);
            output.WriteTag(100, WireFormat.WireType.EndGroup);

            output.Flush();

            stream.Position = 0;
            MessageParsingHelpers.AssertReadingMessageThrows <TestAllTypes, InvalidProtocolBufferException>(TestAllTypes.Parser, stream.ToArray());
        }