public void CreateHash_NullInput_Throws() { // Arrange var algorithm = new SHA384(); // Act && Assert Assert.Throws <ArgumentNullException>(() => algorithm.CreateHash(null)); }
public void IsThisAlgorithm_ValidInput_ReturnsTrue() { // Arrange var algorithm = new SHA384(); // Act var hash = algorithm.CreateHash("Hello world"); var isThisAlgorithm = algorithm.IsThisAlgorithm(hash); // Assert Assert.True(isThisAlgorithm); }
public void CreateHash_ProperInput_Hashes() { // Arrange var algorithm = new SHA384(); // Act var hash = algorithm.CreateHash("Hello world"); // Assert Assert.NotNull(hash); Assert.Equal(algorithm.HashLength, hash.Length); }
public void CreateHash_EmptyInput_Hashes() { // Arrange var algorithm = new SHA384(); // Act var hash = algorithm.CreateHash(string.Empty); // Assert Assert.NotNull(hash); Assert.Equal(algorithm.HashLength, hash.Length); }
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); }