public void TestForOverflow() { var webReponseStream = new WebResponseStream(new FakeStream(), int.MaxValue * 2L); webReponseStream.Read(null, 0, 0); webReponseStream.Read(null, 0, 0); Assert.AreEqual(webReponseStream.GetBytesRead(), int.MaxValue * 2L); }
private static Stream GetRequestedStream(Stream source, long length) { var webReponseStream = new WebResponseStream(source, length); var requestStream = new MemoryStream(); if (webReponseStream.Position != 0) { webReponseStream.Seek(0, SeekOrigin.Begin); } webReponseStream.CopyTo(requestStream, CopyBufferSize); return requestStream; }