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); } }
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)); } }
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")); }