Beispiel #1
0
        public void Base16MaxCharCountAndMaxByteCountReturnCorrectishValues()
        {
            var random = new Random(10);

            for (int blockSize = 0; blockSize < 2048; blockSize++)
            {
                byte[] block = new byte[blockSize];
                for (int iIndex = 0; iIndex < blockSize; iIndex++)
                {
                    block[iIndex] = (byte)random.Next(256);
                }

                string encodedText = Codec.GetString(block);
                Assert.IsNotNull(encodedText);

                Assert.IsTrue(encodedText.Length <= Codec.GetMaxCharCount(blockSize));
                Assert.IsTrue(Codec.GetMaxByteCount(encodedText.Length) >= blockSize);
            }
        }