This library provides a collection of fake stream for testing. A constant stream is an lazy stream (not backed by a base stream) and provide a basic reading operations of a stream of bytes (the same byte or stride of bytes). The streams imitate a NetworkStream by providing only the "Read" operation and not "Seek", "Length" or "Write".
$ dotnet add package ConstantStreamA constant streams for testing purposes.
The library have two Stream types:
For example: ConstantByteStream(5, (byte) 'A') -> "AAAAA" ConstantStrideStream(10, Encoding.UTF8.GetBytes("ABC")) -> "ABCABCABCA"
// Creates a 1 Mb stream of zeroes.
var zeroesStream = new ConstantByteStream(1024*1000, (byte)0);
// Creates a 1 Gb stream full of 's'.
var sStream = new ConstantByteStream(1024*1000*1000, (byte)'s');
// Handy factory method (From*)
var zeroesStreamEasy = ConstantByteStream.FromZeroes(1024*1000);
The Stream doesnt have a base stream. Its a fake generator and provide a simple Stream that generates large amounts of data.