public void TestReadChunk()
        {
            ByteArrayBuilder builder     = new ByteArrayBuilder();
            string           firstChunk  = "123";
            string           secondChunk = "ab";
            string           thirdChunk  = "--+";

            byte[] firstChunkBytes  = GetBytesFromString(firstChunk);
            byte[] secondChunkBytes = GetBytesFromString(secondChunk);
            byte[] thirdChunkBytes  = GetBytesFromString(thirdChunk);

            builder.AddChunkReference(firstChunkBytes, 3);
            builder.AddChunkReference(secondChunkBytes, 2);
            builder.AddChunkReference(thirdChunkBytes, 3);

            byte[] returnedBytes       = builder.ReadChunk();
            string returnedBytesString = Encoding.UTF8.GetString(returnedBytes);

            Assert.AreEqual(firstChunk, returnedBytesString);
            returnedBytes       = builder.ReadChunk();
            returnedBytesString = Encoding.UTF8.GetString(returnedBytes);
            Assert.AreEqual(secondChunk, returnedBytesString);
            //reset the current chunk
            builder.ResetChunkPosition();
            returnedBytes       = builder.ReadChunk();
            returnedBytesString = Encoding.UTF8.GetString(returnedBytes);
            Assert.AreEqual(firstChunk, returnedBytesString);
            //read to end
            returnedBytes = builder.ReadChunk();
            returnedBytes = builder.ReadChunk();
            returnedBytes = builder.ReadChunk();
            Assert.IsNull(returnedBytes);
            //test that the builder resets to the beggining now
            returnedBytes       = builder.ReadChunk();
            returnedBytesString = Encoding.UTF8.GetString(returnedBytes);
            Assert.AreEqual(firstChunk, returnedBytesString);
        }