public void Base64BytesDecodeTest(int count)
        {
            var outputBytes = new byte[count];
            var r           = new Random(count);

            r.NextBytes(outputBytes);
            var base64String = Convert.ToBase64String(outputBytes);
            var base64Buffer = base64String.ToCharArray().Select(v => (byte)v).ToArray();

            // transform block
            var inputOffset = r.Next(0, 100);
            var inputBuffer = new byte[inputOffset + base64Buffer.Length + inputOffset];

            Buffer.BlockCopy(base64Buffer, 0, inputBuffer, inputOffset, base64Buffer.Length);
            var outputOffset = r.Next(0, 100);
            var outputBuffer = new byte[outputOffset + outputBytes.Length];
            var written      = Base64Convert.Decode(new ArraySegment <byte>(inputBuffer, inputOffset, base64Buffer.Length), new ArraySegment <byte>(outputBuffer, outputOffset, outputBuffer.Length - outputOffset), out var inputUsed, out var outputUsed);
            var actualOutput = outputBuffer.Skip(outputOffset).ToArray();

            Assert.Equal(outputBytes.Length, Base64Convert.GetBytesCount(inputBuffer, inputOffset, base64Buffer.Length));
            Assert.Equal(outputBytes.Length, written);
            Assert.Equal(outputBytes.Length, outputUsed);
            Assert.Equal(base64Buffer.Length, inputUsed);
            Assert.Equal(outputBytes, actualOutput);
        }