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("/")); }
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")); }
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 })); }
public void Encode_Unknown_Algorithm() { var bytes = new byte[] { 1, 2, 3, 4, 5 }; ExceptionAssert.Throws <KeyNotFoundException>(() => MultiBase.Encode(bytes, "unknown")); }
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])); }
public void Parsing_Wrong_Digest_Size() { var ms = new MemoryStream(new byte[] { 0x11, 0x02, 0x0a, 0x0b }); ExceptionAssert.Throws <InvalidDataException>(() => new MultiHash(ms)); }
public void Write_Null_Stream() { var mh = new MultiHash("QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB"); ExceptionAssert.Throws <ArgumentNullException>(() => mh.Write((CodedOutputStream)null)); }
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])); }