Beispiel #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");
        }
Beispiel #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();
        }
Beispiel #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");
        }
Beispiel #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");
        }