public void ValidateHash_NullInput_Throws() { // Arrange var algorithm = new SHA384(); // Act && Assert Assert.Throws <ArgumentNullException>(() => algorithm.ValidateHash(null, "not an SHA384 hash")); Assert.Throws <ArgumentNullException>(() => algorithm.ValidateHash("Hello world", null)); }
public void ValidateHash_InvalidCorrectHash_Throws() { // Arrange var algorithm = new SHA384(); // Act && Assert Assert.Throws <ArgumentException>(() => algorithm.ValidateHash("Hello world", "not an SHA384 hash")); }
public void ValidateHash_MatchingHash_ReturnsTrue() { // Arrange var algorithm = new SHA384(); // Act var helloWorldHash = algorithm.CreateHash("Hello world"); var validHash = algorithm.ValidateHash("Hello world", helloWorldHash); // Assert Assert.True(validHash); }
public void ValidateHash_NotMatchingHash_ReturnsFalse() { // Arrange var algorithm = new SHA384(); // Act var helloWorldHash = algorithm.CreateHash("Hello world"); var validHash = algorithm.ValidateHash("Definately not hello world", helloWorldHash); // Assert Assert.False(validHash); }