From cdd524a0bdfc16853271cca7b8fa95577b75085d Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Mon, 12 Jun 2017 07:04:22 +0100 Subject: Ensure leaveOpen is true when writing to a buffer Note that the compatibility tests have had to cahnge as well, to cope with internal changes. (The test project has access to internals in the main project.) Fixes #3209. --- csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs') diff --git a/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs b/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs index 48bf6d60..98cabd55 100644 --- a/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs +++ b/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs @@ -334,7 +334,7 @@ namespace Google.Protobuf } // Now test Input stream: { - CodedInputStream cin = new CodedInputStream(new MemoryStream(bytes), new byte[50], 0, 0); + CodedInputStream cin = new CodedInputStream(new MemoryStream(bytes), new byte[50], 0, 0, false); Assert.AreEqual(0, cin.Position); // Field 1: uint tag = cin.ReadTag(); @@ -415,5 +415,12 @@ namespace Google.Protobuf Assert.AreEqual(1, memoryStream.Position); // Flushed data from CodedOutputStream to MemoryStream Assert.IsTrue(memoryStream.CanWrite); // We left the stream open } + + [Test] + public void Dispose_FromByteArray() + { + var stream = new CodedOutputStream(new byte[10]); + stream.Dispose(); + } } } \ No newline at end of file -- cgit v1.2.3