public void Given_Url_Is_Not_Null_Id_Returns_MD5_Hash_Of_It() { var item = new Item { Url = "http://sergejus.blogas.lt" }; var hash = new HashProvider(new MD5CryptoServiceProvider()).ComputeHash(item.Url); Assert.That(item.Id, Is.EqualTo(hash)); }
public void Given_String_Compute_Hash_Calculates_Correct_MD5_Hash() { var dotNetGroupValue = "DotNetGroup"; var dotNetGroupHash = "4779ccd6ffccfac7cf91cfe585d02db0"; var hashProvider = new HashProvider(new MD5CryptoServiceProvider()); var hash = hashProvider.ComputeHash(dotNetGroupValue); Assert.That(hash, Is.EqualTo(dotNetGroupHash)); }
public void Given_Null_Value_Compute_Hash_Throws() { var hashProvider = new HashProvider(); Assert.Throws<ArgumentNullException>(() => hashProvider.ComputeHash(null)); }