public void ComputeMD5Hash_SameFile_ReturnsSameHash() { var assembly = Assembly.GetExecutingAssembly(); var file1 = new FileInfo(assembly.Location); var file2 = new FileInfo(assembly.Location); var hash1 = file1.ComputeMD5Hash(); var hash2 = file2.ComputeMD5Hash(); Assert.That(hash1, Is.EqualTo(hash2)); }
public void ComputeMD5Hash_DifferentFile_ReturnsDifferentHash() { var assembly1 = Assembly.GetExecutingAssembly(); var assembly2 = Assembly.GetCallingAssembly(); Assert.That(assembly1, Is.Not.EqualTo(assembly2)); var file1 = new FileInfo(assembly1.Location); var file2 = new FileInfo(assembly2.Location); var hash1 = file1.ComputeMD5Hash(); var hash2 = file2.ComputeMD5Hash(); Assert.That(hash1, Is.Not.EqualTo(hash2)); }
private void ComputeButton_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(FilePathTextBox.Text)) return; var file = new FileInfo(FilePathTextBox.Text); string hash; if (MD5RadioButton.IsChecked ?? false) { hash = file.ComputeMD5Hash(); } else { hash = file.ComputeNodeId(); } HashTextBox.Text = hash; }