/// <summary> /// Asserts two file have the same contents (does not check the file /// names are the same). /// </summary> /// <param name="actualFilePath">Path to actual file in the comparison.</param> /// <param name="expectedFilePath">Path to expected file in the comparison.</param> public static void AreSame(string actualFilePath, string expectedFilePath) { var service = new FileChecksumService(new Md5Algorithm(), EncodingType.Base64); var actualHash = service.Calculate(actualFilePath); var expectedHash = service.Calculate(expectedFilePath); Assert.That(actualHash, Is.EqualTo(expectedHash)); }
public void WhenEncodingTypeInvalid_ThenThrowException() { Assert.Throws <InvalidOperationException>(() => _ = new FileChecksumService(new Md5Algorithm(), (EncodingType)99)); }
public void WhenHashAlgorithmIsNull_ThenThrowException() { Assert.Throws <ArgumentNullException>(() => _ = new FileChecksumService(null)); }
public void SetUp() { _sutBase64 = new FileChecksumService(new Md5Algorithm(), EncodingType.Base64); _sutHex = new FileChecksumService(new Md5Algorithm(), EncodingType.Hex); }