コード例 #1
0
        public void VerifyFileChecksum_Pass(string algoritm, string hash)
        {
            var task = new VerifyFileHash
            {
                File        = Path.Combine(AppContext.BaseDirectory, "TestResources", "lorem.bin"),
                BuildEngine = new MockEngine(),
                Algorithm   = algoritm,
                Hash        = hash,
            };

            Assert.True(task.Execute(), "Task should pass");
        }
コード例 #2
0
        public void VerifyFileChecksum_Pass(TestBinary testBinary)
        {
            VerifyFileHash task = new VerifyFileHash
            {
                File         = testBinary.FilePath,
                BuildEngine  = _mockEngine,
                Algorithm    = testBinary.HashAlgorithm,
                Hash         = testBinary.FileHash,
                HashEncoding = testBinary.HashEncoding,
            };

            task.Execute().ShouldBeTrue();
        }
コード例 #3
0
        public void VerifyFileChecksum_FailsForMismatch(string algoritm, string hash)
        {
            VerifyFileHash task = new VerifyFileHash
            {
                File        = Path.Combine(AppContext.BaseDirectory, "TestResources", "lorem.bin"),
                BuildEngine = _mockEngine,
                Algorithm   = algoritm,
                Hash        = hash,
            };

            task.Execute().ShouldBeFalse(() => _mockEngine.Log);

            _mockEngine.Log.ShouldContain("MSB3952");
        }
コード例 #4
0
        public void VerifyFileChecksum_Fails(string algoritm, string hash)
        {
            var task = new VerifyFileHash
            {
                File        = Path.Combine(AppContext.BaseDirectory, "TestResources", "lorem.bin"),
                BuildEngine = new MockEngine {
                    ContinueOnError = true
                },
                Algorithm = algoritm,
                Hash      = hash,
            };

            Assert.False(task.Execute(), "Task should fail");
        }