Beispiel #1
0
        public static void Shrink_LeaveAtLeast_0(string expected, string html)
        {
            // Arrange
            ShrinkHelper.LeaveAtLeast = 0;
            var buffer = Encoding.UTF8.GetBytes(html);

            // Act
            var length = ShrinkHelper.Shrink(buffer, 0, buffer.Length);

            // Assert
            Assert.Equal(expected, Encoding.UTF8.GetString(buffer, 0, length));
        }
Beispiel #2
0
        public static void Shrink1(string html)
        {
            // Arrange
            ShrinkHelper.LeaveAtLeast = 1;

            // Act
            for (int i = 0; i < 100; i++)
            {
                var buffer = Encoding.UTF8.GetBytes(html.Repeat(1000));
                var length = ShrinkHelper.Shrink(buffer, 0, buffer.Length);
            }

            // Assert
        }
Beispiel #3
0
            public override void Write(byte[] buffer, int offset, int count)
            {
                var length = ShrinkHelper.Shrink(buffer, offset, count);

                base.Write(buffer, offset, length);
            }