public void FirstHtmlContentFromTemplateResourceEmptyProject() { string resultPath = Path.Combine(TestSupport.CreatedFilesDirectory, "output.html"); TestCasesRoot tcRoot = new TestCasesRoot(); var result = tcRoot.GenerateFromTemplateString(DecisionTableCreator.Templates.Resources.HtmlTemplate); File.WriteAllText(resultPath, result.GeneratedContent); Assert.That(!result.ErrorListener.ErrorReported); Assert.That(TestSupport.CompareFile(TestSupport.CreatedFilesDirectory, TestSupport.ReferenceFilesDirectory, Path.GetFileName(resultPath))); }
public void CustomErrorListenerTest(int idx, string fileName, bool errorsExpected) { string templatePath = Path.Combine(TestSupport.TestFilesDirectory, fileName); string outputPath = Path.Combine(TestSupport.CreatedFilesDirectory, "output" + idx + ".txt"); string errorsPath = Path.Combine(TestSupport.CreatedFilesDirectory, "errors" + idx + ".txt"); TestCasesRoot tcRoot = TestCasesRoot.CreateSimpleTable(); var output = tcRoot.GenerateFromTemplateString(File.ReadAllText(templatePath)); Assert.That(output.ErrorListener.ErrorReported == errorsExpected); File.WriteAllText(outputPath, output.GeneratedContent); File.WriteAllText(errorsPath, output.GetErrorList()); Assert.That(TestSupport.CompareFile(TestSupport.CreatedFilesDirectory, TestSupport.ReferenceFilesDirectory, Path.GetFileName(outputPath))); Assert.That(TestSupport.CompareFile(TestSupport.CreatedFilesDirectory, TestSupport.ReferenceFilesDirectory, Path.GetFileName(errorsPath))); }
public void PrepareHtmlForClipboard() { string resultPath = Path.Combine(TestSupport.CreatedFilesDirectory, "output.txt"); string resultPathHtml = Path.Combine(TestSupport.CreatedFilesDirectory, "html.txt"); string resultPathFragment = Path.Combine(TestSupport.CreatedFilesDirectory, "fragment.txt"); TestCasesRoot tcRoot = TestCasesRoot.CreateSimpleTable(); var templResult = tcRoot.GenerateFromTemplateString(DecisionTableCreator.Templates.Resources.HtmlTemplate); PrepareForClipboard prepare = new PrepareForClipboard(); string result = prepare.Prepare(templResult.GeneratedContent); Assert.That(!templResult.ErrorListener.ErrorReported); File.WriteAllText(resultPath, result); File.WriteAllText(resultPathHtml, result.Substring(prepare.StartHtml, prepare.EndHtml - prepare.StartHtml)); File.WriteAllText(resultPathFragment, result.Substring(prepare.StartFragment, prepare.EndFragment - prepare.StartFragment)); Assert.That(TestSupport.CompareFile(TestSupport.CreatedFilesDirectory, TestSupport.ReferenceFilesDirectory, Path.GetFileName(resultPathHtml))); Assert.That(TestSupport.CompareFile(TestSupport.CreatedFilesDirectory, TestSupport.ReferenceFilesDirectory, Path.GetFileName(resultPathFragment))); Assert.That(TestSupport.CompareFile(TestSupport.CreatedFilesDirectory, TestSupport.ReferenceFilesDirectory, Path.GetFileName(resultPath))); }