Example #1
0
        public void TestEmptyData()
        {
            var chunked = new ChunkedStream(EmptyData.Instance, 10);

            Assert.Equal(5, chunked.Length);
            var result = ASCIIEncoding.ASCII.GetString(chunked.ReadBytes());

            Assert.Equal("0\r\n\r\n", result);
        }
Example #2
0
        public void TestReadBytes(string input, int chunkSize, string expected)
        {
            var inner   = new ByteArray(ASCIIEncoding.ASCII.GetBytes(input));
            var chunked = new ChunkedStream(inner, chunkSize);

            Assert.Equal(expected.Length, chunked.Length);
            var result = ASCIIEncoding.ASCII.GetString(chunked.ReadBytes());

            Assert.Equal(expected, result);
            TestReadByte(input, chunkSize, expected);
        }