public void ContainsLogo() { void Template(string fileName, bool result) { EngineState s = EngineTests.CreateEngineState(); string pbOriginScript = Path.Combine("%TestBench%", "EncodedFile", fileName); string originScript = StringEscaper.Preprocess(s, pbOriginScript); Script sc = s.Project.LoadScriptRuntime(originScript, new LoadScriptRuntimeOptions()); Assert.AreEqual(EncodedFile.ContainsLogo(sc), result); } Template("Blank.script", true); Template("CompleteBlank.script", false); }
public void DeleteLogo() { EngineState s = EngineTests.CreateEngineState(); string scriptDir = Path.Combine(StringEscaper.Preprocess(s, "%TestBench%"), "EncodedFile"); string logoScriptPath = Path.Combine(scriptDir, "Blank.script"); string noLogoScriptPath = Path.Combine(scriptDir, "CompleteBlank.script"); // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local void Template(string testScriptPath, bool result) { string destDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); string destScript = Path.Combine(destDir, "DeleteLogoTest.script"); Directory.CreateDirectory(destDir); try { File.Copy(testScriptPath, destScript, true); string errMsg; Script sc = s.Project.LoadScriptRuntime(destScript, new LoadScriptRuntimeOptions()); (sc, errMsg) = EncodedFile.DeleteLogo(sc); if (errMsg != null) { Assert.IsFalse(result); return; } Assert.IsTrue(result); Assert.IsFalse(EncodedFile.ContainsLogo(sc)); } finally { if (Directory.Exists(destDir)) { Directory.Delete(destDir, true); } } } Template(logoScriptPath, true); Template(noLogoScriptPath, false); }