public void Should_compute_for_stream_values(IChecksumImplementation impl, string expectedChecksum) { byte[] sourceBytes = Encoding.ASCII.GetBytes("CodeBits"); var ms = new MemoryStream(sourceBytes); string checksum = impl.FromStream(ms); checksum.ShouldBe(expectedChecksum); }
public void Should_throw_if_file_not_found(IChecksumImplementation impl) { Should.Throw <FileNotFoundException>(() => impl.FromFile(string.Empty)); Should.Throw <FileNotFoundException>(() => impl.FromFile(string.Empty, 4096)); Should.Throw <FileNotFoundException>(() => impl.FromFile(@"Z:\should_not_exist.txt")); Should.Throw <FileNotFoundException>(() => impl.FromFile(@"Z:\should_not_exist.txt", 4096)); }
public void Should_throw_for_null_values(IChecksumImplementation impl) { Should.Throw <ArgumentNullException>(() => impl.FromBytes(null)); Should.Throw <ArgumentNullException>(() => impl.FromFile(null)); Should.Throw <ArgumentNullException>(() => impl.FromFile(null, 4096)); Should.Throw <ArgumentNullException>(() => impl.FromStream(null)); Should.Throw <ArgumentNullException>(() => impl.FromString(null)); }
public void Should_compute_for_string_values(IChecksumImplementation impl, string expectedChecksum) { string checksum = impl.FromString("CodeBits"); checksum.ShouldBe(expectedChecksum); }
public void Empty_byte_array_checksum_should_be_same_as_empty_string_checksum(IChecksumImplementation impl) { string emptyByteArray = impl.FromBytes(new byte[0]); string emptyString = impl.FromString(string.Empty); emptyByteArray.ShouldBe(emptyString); }