Beispiel #1
0
 public void InvalidHexStrings()
 {
     ExceptionAssert.Throws <InvalidDataException>(() => HexString.Decode("0"));
     ExceptionAssert.Throws <InvalidDataException>(() => HexString.Decode("0Z"));
 }
 public void Missing_Protocol_Name()
 {
     ExceptionAssert.Throws<FormatException>(() => new MultiAddress("/"));
 }
Beispiel #3
0
 public void InvalidFormatSpecifier()
 {
     ExceptionAssert.Throws <FormatException>(() => HexString.Encode(new byte[0], "..."));
 }
 public void Reading_Empty()
 {
     ExceptionAssert.Throws<Exception>(() => new MultiAddress(new byte[0]));
 }
 public void Unknown_Protocol_Name()
 {
     ExceptionAssert.Throws<FormatException>(() => new MultiAddress("/foobar/123"));
 }
Beispiel #6
0
 public void Encode_Null_Data_Not_Allowed()
 {
     ExceptionAssert.Throws <ArgumentNullException>(() => MultiBase.Encode(null));
 }
 public void Reading_Invalid_Code()
 {
     ExceptionAssert.Throws<InvalidDataException>(() => new MultiAddress(new byte[] { 0x7F }));
 }
Beispiel #8
0
        public void Encode_Unknown_Algorithm()
        {
            var bytes = new byte[] { 1, 2, 3, 4, 5 };

            ExceptionAssert.Throws <KeyNotFoundException>(() => MultiBase.Encode(bytes, "unknown"));
        }
Beispiel #9
0
 public void Invalid_Digest()
 {
     ExceptionAssert.Throws <ArgumentNullException>(() => new MultiHash("sha1", null));
     ExceptionAssert.Throws <ArgumentException>(() => new MultiHash("sha1", new byte[0]));
     ExceptionAssert.Throws <ArgumentException>(() => new MultiHash("sha1", new byte[21]));
 }
Beispiel #10
0
        public void Parsing_Wrong_Digest_Size()
        {
            var ms = new MemoryStream(new byte[] { 0x11, 0x02, 0x0a, 0x0b });

            ExceptionAssert.Throws <InvalidDataException>(() => new MultiHash(ms));
        }
Beispiel #11
0
        public void Write_Null_Stream()
        {
            var mh = new MultiHash("QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB");

            ExceptionAssert.Throws <ArgumentNullException>(() => mh.Write((CodedOutputStream)null));
        }
Beispiel #12
0
 public void Unknown_Hash_Name()
 {
     ExceptionAssert.Throws <ArgumentNullException>(() => new MultiHash(null, new byte[0]));
     ExceptionAssert.Throws <ArgumentException>(() => new MultiHash("", new byte[0]));
     ExceptionAssert.Throws <ArgumentException>(() => new MultiHash("md5", new byte[0]));
 }