示例#1
0
        public void EmptyData()
        {
            var empty = new byte[0];

            foreach (var alg in MultiBaseAlgorithm.All)
            {
                var s = MultiBase.Encode(empty, alg.Name);
                CollectionAssert.AreEqual(empty, MultiBase.Decode(s), alg.Name);
            }
        }
示例#2
0
 public void CheckMultiBase()
 {
     foreach (var v in TestVectors)
     {
         var bytes = Encoding.UTF8.GetBytes(v.Input);
         var s     = MultiBase.Encode(bytes, v.Algorithm);
         Assert.AreEqual(v.Output, s);
         CollectionAssert.AreEqual(bytes, MultiBase.Decode(s));
     }
 }
示例#3
0
        public void Decode_Bad_Formats()
        {
            ExceptionAssert.Throws <ArgumentNullException>(() => MultiBase.Decode(null));
            ExceptionAssert.Throws <ArgumentNullException>(() => MultiBase.Decode(""));
            ExceptionAssert.Throws <ArgumentNullException>(() => MultiBase.Decode("   "));

            ExceptionAssert.Throws <FormatException>(() => MultiBase.Decode("?"));
            ExceptionAssert.Throws <FormatException>(() => MultiBase.Decode("??"));
            ExceptionAssert.Throws <FormatException>(() => MultiBase.Decode("???"));
            ExceptionAssert.Throws <FormatException>(() => MultiBase.Decode("fXX"));
        }