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)); }
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 }
public override void Write(byte[] buffer, int offset, int count) { var length = ShrinkHelper.Shrink(buffer, offset, count); base.Write(buffer, offset, length); }