コード例 #1
0
        public void Base36EncodeTest()
        {
            // positive number
            long   inputNumber = 512344131333132;
            long   result      = 0;
            string base36      = "";

            base36 = StringUtils.Base36Encode(inputNumber);
            Assert.IsTrue(!string.IsNullOrEmpty(base36), "Base36 number resulted in empty or null");
            result = StringUtils.Base36Decode(base36);
            Assert.AreEqual(inputNumber, result, "Base36 conversion failed.");

            // negative number
            inputNumber = -512344131333132;

            base36 = StringUtils.Base36Encode(inputNumber);
            Assert.IsTrue(!string.IsNullOrEmpty(base36), "Base36 number resulted in empty or null");
            result = StringUtils.Base36Decode(base36);
            Assert.AreEqual(inputNumber, result, "Base36 conversion failed.");

            inputNumber = 0;

            base36 = StringUtils.Base36Encode(inputNumber);
            Assert.IsTrue(!string.IsNullOrEmpty(base36), "Base36 number resulted in empty or null");
            result = StringUtils.Base36Decode(base36);
            Assert.AreEqual(inputNumber, result, "Base36 conversion failed.");
        }