public HttpEntity(HttpHeaderDictionary messageheaders, Stream entityBodyStream)
 {
     Headers = messageheaders;
     if (entityBodyStream != null)
     {
         Stream = new LengthTrackingStream(entityBodyStream);
     }
     Errors = new List<Error>();
 }
        public void the_correct_number_of_bytes_is_recorded()
        {
            var stream = new MemoryStream();
            var tracker = new LengthTrackingStream(stream);

            stream.Write(new byte[2 << 4]);

            tracker.Length
                .ShouldBe(stream.Length)
                .ShouldBe(32);
        }
        public void the_correct_number_of_bytes_is_recorded()
        {
            var stream = new DeflateStream(new MemoryStream(), CompressionMode.Compress);

            var tracker = new LengthTrackingStream(stream);

            tracker.Write(new byte[50]);

            tracker.Length
                .ShouldBe(50);
        }