From: Marcos Henrich Date: Thu, 25 Feb 2016 18:38:05 +0000 (+0000) Subject: [corlib] Test FileStream with Read and Writes X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=abaf937ca57e87b32804ca25f3bcfb2df37f4a14;p=mono.git [corlib] Test FileStream with Read and Writes Covers #11699 --- diff --git a/mcs/class/corlib/Test/System.IO/FileStreamTest.cs b/mcs/class/corlib/Test/System.IO/FileStreamTest.cs index 2eae58e3e44..84a9d638ed6 100644 --- a/mcs/class/corlib/Test/System.IO/FileStreamTest.cs +++ b/mcs/class/corlib/Test/System.IO/FileStreamTest.cs @@ -1725,5 +1725,30 @@ namespace MonoTests.System.IO } } #endif + + [Test] // Covers #11699 + public void ReadWriteFileLength () + { + int bufferSize = 128; + int readLength = 1; + int writeLength = bufferSize + 1; + + string path = TempFolder + DSC + "readwritefilelength.tmp"; + + try { + File.WriteAllBytes (path, new byte [readLength + 1]); + + using (var file = new FileStream (path, FileMode.Open, FileAccess.ReadWrite, FileShare.Read, + bufferSize, FileOptions.SequentialScan)) + { + file.Read (new byte [readLength], 0, readLength); + file.Write (new byte [writeLength], 0, writeLength); + + Assert.AreEqual (readLength + writeLength, file.Length); + } + } finally { + DeleteFile (path); + } + } } }