Exemplo n.º 1
0
        public void Test()
        {
            var data    = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            var encoded = Base62Converter.Encode(data);
            var decoded = Base62Converter.Decode(encoded);

            Assert.Equal(data, decoded);
        }
Exemplo n.º 2
0
        public void ASCII_AND_UTF8_Can_RoundTrip(string input, string expected)
        {
            var converter = new Base62Converter(Base62Converter.CharacterSet.DEFAULT);
            var encoded   = converter.Encode(input);
            var decoded   = converter.Decode(encoded);

            Assert.AreEqual(expected, encoded);
            Assert.AreEqual(input, decoded);
        }
Exemplo n.º 3
0
        public void NonAscii_CanBe_Decoded()
        {
            var input     = "love爱";
            var converter = new Base62Converter(Base62Converter.CharacterSet.DEFAULT);
            var encoded   = converter.Encode(input);

            var decoded = converter.Decode(encoded);

            Assert.AreEqual(input, decoded);
        }
Exemplo n.º 4
0
        public void Encoded_Inverted_CanBe_Decoded()
        {
            var input     = "Whatup";
            var converter = new Base62Converter(Base62Converter.CharacterSet.INVERTED);
            var encoded   = converter.Encode(input);

            var decoded = converter.Decode(encoded);

            Assert.AreEqual(input, decoded);
        }
Exemplo n.º 5
0
        public void Encoded_CanBe_Decoded()
        {
            var input     = "120";
            var converter = new Base62Converter();
            var encoded   = converter.Encode(input);

            var decoded = converter.Decode(encoded);

            Assert.AreEqual(input, decoded);
        }
Exemplo n.º 6
0
        public void TestEquality()
        {
            var bytes = new byte[ByteLength];

            random.GetBytes(bytes);

            var s      = Base62Converter.Encode(bytes);
            var decode = Base62Converter.Decode(s.ToCharArray());
            var encode = Base62Converter.Encode(decode);

            Assert.AreEqual(s, encode);
        }
Exemplo n.º 7
0
 public static string Base62Decode(string base62EncodedData)
 {
     return(_base62Converter.Decode(base62EncodedData));
 }