public void TestInvalidBlockCrcStream()
        {
            BZip2DecoderStream decoder = new BZip2DecoderStream(new MemoryStream(InvalidBlockCrcData), Ownership.Dispose);

            byte[] buffer = new byte[1024];
            Assert.Throws <InvalidDataException>(() => decoder.Read(buffer, 0, 1024));
        }
        public void TestCombinedCrcStream_ExactLengthRead()
        {
            BZip2DecoderStream decoder = new BZip2DecoderStream(new MemoryStream(InvalidCombinedCrcData), Ownership.Dispose);

            byte[] buffer = new byte[21];
            Assert.Throws <InvalidDataException>(() => decoder.Read(buffer, 0, 21));
        }
        public void TestValidStream()
        {
            BZip2DecoderStream decoder = new BZip2DecoderStream(new MemoryStream(ValidData), Ownership.Dispose);

            byte[] buffer  = new byte[1024];
            int    numRead = decoder.Read(buffer, 0, 1024);

            Assert.Equal(21, numRead);

            string s = Encoding.ASCII.GetString(buffer, 0, numRead);

            Assert.Equal("This is a test string", s);
        }