Ejemplo n.º 1
0
            public void Parameter_checks()
            {
                var ane = Assert.Throws <ArgumentNullException>(delegate { HashUtil.ComputeHashForFile(null); });

                Assert.That(ane.Message, Contains.Substring("path"), "Test 1");

                ane = Assert.Throws <ArgumentNullException>(delegate { HashUtil.ComputeHashForFile(""); });
                Assert.That(ane.Message, Contains.Substring("path"), "Test 2");

                ane = Assert.Throws <ArgumentNullException>(delegate { HashUtil.ComputeHashForFile("  "); });
                Assert.That(ane.Message, Contains.Substring("path"), "Test 3");

                string invalidPath = this.testFilePath + ".invalid";
                var    fnfe        = Assert.Throws <FileNotFoundException>(delegate { HashUtil.ComputeHashForFile(invalidPath); });

                Assert.That(fnfe.Message, Contains.Substring("At path:"), "Test 3");
            }
Ejemplo n.º 2
0
            public void Validate_hash()
            {
                string resultingHash = HashUtil.ComputeHashForFile(this.testFilePath);

                Assert.AreEqual(this.expectedHash, resultingHash);
            }