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