public void TestBufferTrimming(Encoding encoding, int offset, int count, byte[] expectedLeadingBytes, byte[] expectedTrailingBytes, string description)
        {
            var trimmedBuffer = new TrimmedEncodedBuffer(encoding, buffer, offset, count);

            Assert.AreEqual(expectedLeadingBytes.Length, trimmedBuffer.LeadingExtraBytesCount);
            Assert.AreEqual(expectedTrailingBytes.Length, trimmedBuffer.TrailingExtraBytesCount);
            Assert.AreEqual(trimmedBuffer.LeadingExtraBytesOffset + trimmedBuffer.LeadingExtraBytesCount, trimmedBuffer.Offset);
            Assert.AreEqual(count, trimmedBuffer.LeadingExtraBytesCount + trimmedBuffer.Length + trimmedBuffer.TrailingExtraBytesCount);

            for (var i = 0; i < expectedLeadingBytes.Length; ++i)
            {
                var bufferIndex = i + trimmedBuffer.LeadingExtraBytesOffset;
                Assert.AreEqual(expectedLeadingBytes[i], trimmedBuffer.Buffer[bufferIndex], $"Discrepancy in leading extra bytes at index {bufferIndex}");
            }

            for (var i = 0; i < expectedTrailingBytes.Length; ++i)
            {
                var bufferIndex = i + trimmedBuffer.TrailingExtraBytesOffset;
                Assert.AreEqual(expectedTrailingBytes[i], trimmedBuffer.Buffer[bufferIndex], $"Discrepancy in trailing extra bytes at index {bufferIndex}");
            }
        }
        public void Test_GetLeadingBytesCount(Encoding encoding, int offset, int count, int expectedLeadingByteCount, byte[] bytes, string description)
        {
            var trimmedBuffer = new TrimmedEncodedBuffer(encoding, bytes, offset, count);

            Assert.AreEqual(expectedLeadingByteCount, trimmedBuffer.LeadingExtraBytesCount);
        }