public void HashProvider_ValidateHash_ProvideValidData_ReturnsTrue() { HashProvider hashProvider = new HashProvider(); byte[] validHash = Convert.FromBase64String(dataExpectedHashBase64); byte[] dataByte = Encoding.UTF8.GetBytes(data); bool result = hashProvider.ValidateData(dataByte, validHash); Assert.IsTrue(result); }
public void HashProvider_ValidateHash_ProvideInvalidHash_ReturnsFalse() { SecretKeyProvider keygen = new SecretKeyProvider(); HashProvider hashProvider = new HashProvider(); byte[] invalidHash = keygen.NewSecretByte(32); byte[] dataByte = Encoding.UTF8.GetBytes(data); bool result = hashProvider.ValidateData(dataByte, invalidHash); Assert.IsFalse(result); }
public void HashProvider_ValidateHash_ProvideInvalidData_ReturnsFalse() { SecretKeyProvider keygen = new SecretKeyProvider(); HashProvider hashProvider = new HashProvider(); byte[] validHash = Convert.FromBase64String(dataExpectedHashBase64); byte[] dataByte = Encoding.UTF8.GetBytes(invalidData); bool result = hashProvider.ValidateData(dataByte, validHash); Assert.IsFalse(result); }