public TestCasesRootContainer()
 {
     TestCasesRoot = TestCasesRoot.CreateSimpleTable();
     TestCasesRoot.ActionsBeginChange    += TestCasesRootOnActionsChanged;
     TestCasesRoot.ActionsEndChange      += TestCasesRootOnActionsChanged;
     TestCasesRoot.ConditionsBeginChange += TestCasesRootOnConditionsChanged;
     TestCasesRoot.ConditionsEndChange   += TestCasesRootOnConditionsChanged;
 }
        public void FirstHtmlContentFromTemplateResource()
        {
            string        resultPath = Path.Combine(TestSupport.CreatedFilesDirectory, "output.html");
            TestCasesRoot tcRoot     = TestCasesRoot.CreateSimpleTable();
            var           result     = tcRoot.GenerateFromTemplateString(DecisionTableCreator.Templates.Resources.HtmlTemplate);

            Assert.That(!result.ErrorListener.ErrorReported);
            File.WriteAllText(resultPath, result.GeneratedContent);
            Assert.That(TestSupport.CompareFile(TestSupport.CreatedFilesDirectory, TestSupport.ReferenceFilesDirectory, Path.GetFileName(resultPath)));
        }
        public void CreateHtmlTableTest()
        {
            string        templPath   = Path.Combine(TestSupport.TestFilesDirectory, "HtmlTemplate.stg");
            string        resultPath  = Path.Combine(TestSupport.CreatedFilesDirectory, "output.htm");
            TestCasesRoot tcRoot      = TestCasesRoot.CreateSimpleTable();
            var           templResult = tcRoot.GenerateFromtemplate(templPath);

            File.WriteAllText(resultPath, templResult.GeneratedContent);
            Assert.That(!templResult.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)));
        }
Example #5
0
        public void Save100()
        {
            string        savePath = Path.Combine(TestSupport.CreatedFilesDirectory, "Save.dtc");
            TestCasesRoot root     = TestCasesRoot.CreateSimpleTable();

            root.Save(savePath);

            root.New();

            root.Load(savePath);

            Assert.That(TestSupport.CompareFile(TestSupport.CreatedFilesDirectory, TestSupport.ReferenceFilesDirectory, Path.GetFileName(savePath)));
            //ProcessStartInfo info = new ProcessStartInfo(@"C:\Program Files (x86)\Notepad++\notepad++.exe", savePath);
            //Process.Start(info);
        }
Example #6
0
        public void SaveTestCaseDescription()
        {
            string        savePath = Path.Combine(TestSupport.CreatedFilesDirectory, "Save.dtc");
            TestCasesRoot root     = TestCasesRoot.CreateSimpleTable();

            root.TestCases[0].Description = "test description";
            Assert.True(root.TestCases[1].Description == "");
            root.Save(savePath);

            root.New();

            root.Load(savePath);

            Assert.True(root.TestCases[0].Description == "test description");
            Assert.True(root.TestCases[1].Description == "");
        }
        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)));
        }