Exemple #1
0
        public void Base16GetCharCountAndGetByteCountReturnCorrectValues()
        {
            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.GetCharCount(block));
                Assert.IsTrue(Codec.GetByteCount(encodedText) == blockSize);
            }
        }