Пример #1
0
        public void BytecodeApi_ConvertEx()
        {
            byte[] data = MathEx.RandomNumberGenerator.GetBytes(100);
            Assert.IsTrue(ConvertEx.FromHexadecimalString(ConvertEx.ToHexadecimalString(data)).Compare(data));
            Assert.IsTrue(ConvertEx.FromBase32String(ConvertEx.ToBase32String(data)).Compare(data));

            for (int i = 0; i < 1000; i++)
            {
                Assert.AreEqual(ConvertEx.FromExcelColumnString(ConvertEx.ToExcelColumnString(i)), i);
                Assert.AreEqual(ConvertEx.From7BitEncodedInt(ConvertEx.To7BitEncodedInt(i)), i);
            }

            for (int i = 1; i <= 3999; i++)
            {
                Assert.AreEqual(ConvertEx.FromRomanNumber(ConvertEx.ToRomanNumber(i)), i);
            }

            Point point = ConvertEx.ToStructure <Point>(ConvertEx.FromStructure(new Point(1337, 4242)));

            Assert.IsTrue(point.X == 1337 && point.Y == 4242);
        }