improve test coverage
diff --git a/csharp/src/Google.Protobuf.Test/MessageParsingHelpers.cs b/csharp/src/Google.Protobuf.Test/MessageParsingHelpers.cs
index d629d9c..4877ae6 100644
--- a/csharp/src/Google.Protobuf.Test/MessageParsingHelpers.cs
+++ b/csharp/src/Google.Protobuf.Test/MessageParsingHelpers.cs
@@ -54,6 +54,21 @@
assert(parsedStream);
}
+ public static void AssertReadingMessage(MessageParser parser, byte[] bytes, Action<IMessage> assert)
+ {
+ var parsedStream = parser.ParseFrom(bytes);
+
+ // Load content as single segment
+ var parsedBuffer = parser.ParseFrom(new ReadOnlySequence<byte>(bytes));
+ assert(parsedBuffer);
+
+ // Load content as multiple segments
+ parsedBuffer = parser.ParseFrom(ReadOnlySequenceFactory.CreateWithContent(bytes));
+ assert(parsedBuffer);
+
+ assert(parsedStream);
+ }
+
public static void AssertReadingMessageThrows<TMessage, TException>(MessageParser<TMessage> parser, byte[] bytes)
where TMessage : IMessage<TMessage>
where TException : Exception