Inheritance: IHashProvider
Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        public void Given_Null_Value_Compute_Hash_Throws()
        {
            var hashProvider = new HashProvider();

            Assert.Throws<ArgumentNullException>(() => hashProvider.ComputeHash(null));
        }