public void op_Compute_stringEmpty_Encoding() { MD5Hash expected = Convert.FromBase64String(_emptyHash); var actual = MD5Hash.Compute(string.Empty, Encoding.Default); Assert.Equal(expected, actual); }
public void op_Compute_string_Encoding() { MD5Hash expected = Convert.FromBase64String(_jigsawHash); var actual = MD5Hash.Compute(_jigsawHtml, Encoding.Default); Assert.Equal(expected, actual); }
public void op_Compute_byte() { MD5Hash expected = Convert.FromBase64String(_jigsawHash); var actual = MD5Hash.Compute(Encoding.Default.GetBytes(_jigsawHtml)); Assert.Equal(expected, actual); }
public void op_Compute_FileSystemInfoEmpty() { MD5Hash expected = Convert.FromBase64String(_emptyHash); var actual = MD5Hash.Compute(new FileInfo(@"Security\Cryptography\empty.html")); Assert.Equal(expected, actual); }
public void op_Compute_byteEmpty() { MD5Hash expected = Convert.FromBase64String(_emptyHash); var actual = MD5Hash.Compute(new byte[] { }); Assert.Equal(expected, actual); }
public void op_Compute_streamEmpty() { MD5Hash expected = Convert.FromBase64String(_emptyHash); MD5Hash actual; using (var stream = new MemoryStream()) { actual = MD5Hash.Compute(stream); } Assert.Equal(expected, actual); }
public void op_Compute_Uri() { try { MD5Hash expected = Convert.FromBase64String(_jigsawHash); var actual = MD5Hash.Compute(new Uri("http://jigsaw.w3.org/HTTP/h-content-md5.html")); Assert.Equal(expected, actual); } catch (SocketException) { } }
public void op_Compute_stream() { MD5Hash expected = Convert.FromBase64String(_jigsawHash); MD5Hash actual; using (var stream = new MemoryStream()) { using (var writer = new StreamWriter(stream)) { writer.Write(_jigsawHtml); writer.Flush(); stream.Position = 0; actual = MD5Hash.Compute(stream); } } Assert.Equal(expected, actual); }
public void op_Compute_string_EncodingNull() { Assert.Throws <ArgumentNullException>(() => MD5Hash.Compute("test", null)); }
public void op_Compute_stringNull_Encoding() { Assert.Throws <ArgumentNullException>(() => MD5Hash.Compute(null, Encoding.Default)); }
public void op_Compute_stringNull() { Assert.Throws <ArgumentNullException>(() => MD5Hash.Compute(null as string)); }
public void op_Compute_byteNull() { Assert.Throws <ArgumentNullException>(() => MD5Hash.Compute(null as byte[])); }
public void op_Compute_UriNull() { Assert.Throws <ArgumentNullException>(() => MD5Hash.Compute(null as Uri)); }
public void op_Compute_FileSystemInfoNull() { Assert.Throws <ArgumentNullException>(() => MD5Hash.Compute(null as FileSystemInfo)); }