Esempio n. 1
0
        public override void DoTable(Parse theTable)
        {
            Parse embeddedTables = GetEmbeddedTables(theTable);
            Parse expectedCell = GetExpectedCell(theTable);

            var writer = new StoryTestCopyWriter();
            var storyTest = new StoryTest(new Parse("div", string.Empty, embeddedTables, null), writer);
            storyTest.Execute(Processor.Configuration);

            SetEmbeddedTables(theTable, writer.ResultTables);

            if (expectedCell != null) {
                var actual = new FixtureTable(writer.ResultTables);
                var expected = new FixtureTable(expectedCell.Parts);
                string differences = actual.Differences(expected);
                if (differences.Length == 0) {
                    Right(expectedCell);
                }
                else {
                    Wrong(expectedCell);
                    expectedCell.More = ParseNode.MakeCells(Escape(differences));
                    expectedCell.More.SetAttribute(CellAttribute.Status, TestStatus.Wrong);
                }
            }
        }
Esempio n. 2
0
 public Parse TestResult(Parse theTest)
 {
     resultTables = null;
     var story = new StoryTest(new Parse("div", string.Empty, theTest, null), SaveTestResult);
     story.Execute(Processor.Configuration);
     return resultTables;
 }
Esempio n. 3
0
 public Parse TestResult(Parse theTest)
 {
     resultTables = null;
     var story = new StoryTest(theTest, SaveTestResult);
     story.Execute(Processor.Configuration);
     return resultTables;
 }
 public Parse TestResult(Parse theTest)
 {
     var writer = new StoryTestCopyWriter();
     var story = new StoryTest(new Parse("div", string.Empty, theTest, null), writer);
     story.Execute(Processor.Configuration);
     return writer.ResultTables;
 }
Esempio n. 5
0
 private void ProcessTestDocument(string document, StoryTestWriter writer)
 {
     try {
         var storyTest = new StoryTest(service, writer).WithInput(document);
         reporter.WriteLine(storyTest.Leader);
         if (suiteSetupIdentifier.IsStartOf(storyTest.Leader) || IMaybeProcessingSuiteSetup)
         {
             storyTest.Execute();
         }
         else
         {
             storyTest.Execute(new Service.Service(service));
         }
     }
     catch (Exception e)
     {
         var testStatus = new TestStatus();
         var parse      = new CellBase(parseError, "div");
         parse.SetAttribute(CellAttribute.Body, parseError);
         testStatus.MarkException(parse, e);
         writer.WriteTable(new CellTree(parse));
         writer.WriteTest(new CellTree().AddBranchValue(parse), testStatus.Counts);
     }
 }
Esempio n. 6
0
 private void ProcessTestDocument(string document, Action<string, TestCounts> writer)
 {
     try
     {
         Tree<Cell> result = service.Compose(new StoryTestString(document));
         var parse = result != null ? (Parse)result.Value : null;
         var storyTest = new StoryTest(parse, (tables, counts) => WriteResults(tables, counts, writer));
         reporter.WriteLine(parse.Leader);
         if (suiteSetupIdentifier.IsStartOf(parse.Leader) || IMaybeProcessingSuiteSetup)
             storyTest.ExecuteOnConfiguration(service.Configuration);
         else
             storyTest.Execute(service.Configuration);
     }
     catch (Exception e)
     {
         var testStatus = new TestStatus();
         var parse = new Parse("div", "Unable to parse input. Input ignored.", null, null);
         testStatus.MarkException(parse, e);
         WriteResults(parse, testStatus.Counts, writer);
     }
 }
Esempio n. 7
0
 private void ProcessTestDocument(string document, StoryTestWriter writer)
 {
     try
     {
         Tree<Cell> result = service.Compose(new StoryTestString(document));
         var parse = result != null ? (Parse)result.Value : null;
         var storyTest = new StoryTest(parse, writer);
         reporter.WriteLine(parse.Leader);
         if (suiteSetupIdentifier.IsStartOf(parse.Leader) || IMaybeProcessingSuiteSetup)
             storyTest.ExecuteOnConfiguration(service.Configuration);
         else
             storyTest.Execute(service.Configuration);
     }
     catch (Exception e)
     {
         var testStatus = new TestStatus();
         var parse = new CellBase(parseError, "div");
         parse.SetAttribute(CellAttribute.Body, parseError );
         testStatus.MarkException(parse, e);
         writer.WriteTable(new CellTree(parse));
         writer.WriteTest(new CellTree().AddBranchValue(parse), testStatus.Counts);
     }
 }
Esempio n. 8
0
            public void Do(StoryTestPage page)
            {
                var elapsedTime = new ElapsedTime();
                var input       = page.TestContent;

                if (string.IsNullOrEmpty(input))
                {
                    page.WriteNonTest();
                    DoNoTest();
                }
                var         service = new Service.Service(configuration);
                Tree <Cell> result  = service.Compose(new StoryTestString(input));

                if (result == null || result.Branches.Count == 0)
                {
                    page.WriteNonTest();
                    DoNoTest();
                    return;
                }
                var writer    = new StoryTestStringWriter(service);
                var storyTest = new StoryTest((Parse)result, writer);

                if (page.Name.IsSuitePage)
                {
                    storyTest.ExecuteOnConfiguration(configuration);
                }
                else
                {
                    storyTest.Execute(configuration);
                }
                var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime);

                page.WriteTest(pageResult);
                handleCounts(writer.Counts);
                resultWriter.WritePageResult(pageResult);
            }
Esempio n. 9
0
        private void ExecutePage(StoryPageName pageName, StoryTestString input, Action <StoryTestString, TestCounts> handleResults,
                                 Action handleNoTest)
        {
            var         service = new Service.Service(configuration);
            Tree <Cell> result  = service.Compose(input);

            if (result == null || result.Branches.Count == 0)
            {
                handleNoTest();
                return;
            }
            var storyTest = new StoryTest((Parse)result,
                                          (tables, counts) =>
                                          handleResults(service.ParseTree <Cell, StoryTestString>(tables), counts));

            if (pageName.IsSuitePage)
            {
                storyTest.ExecuteOnConfiguration(configuration);
            }
            else
            {
                storyTest.Execute(configuration);
            }
        }
Esempio n. 10
0
        public override void DoTable(Parse theTable)
        {
            Parse embeddedTables = GetEmbeddedTables(theTable);
            Parse expectedCell = GetExpectedCell(theTable);

            var storyTest = new StoryTest(embeddedTables, SpecifyWriter);
            storyTest.Execute();

            SetEmbeddedTables(theTable, resultTables);

            if (expectedCell != null) {
                var actual = new FixtureTable(resultTables);
                var expected = new FixtureTable(expectedCell.Parts);
                string differences = actual.Differences(expected);
                if (differences.Length == 0) {
                    Right(expectedCell);
                }
                else {
                    Wrong(expectedCell);
                    expectedCell.More = ParseNode.MakeCells(Escape(differences));
                    expectedCell.More.SetAttribute(CellAttributes.StatusKey, CellAttributes.WrongStatus);
                }
            }
        }
Esempio n. 11
0
 public void SetUp()
 {
     TestUtils.InitAssembliesAndNamespaces();
     var builder = new TestBuilder();
     builder.Append("<table>");
     builder.Append("<tr><td colspan='5'>ExampleTableFixture</td></tr>");
     builder.Append("<tr><td>0,0</td><td>0,1</td><td>0,2</td><td>37</td><td></td></tr>");
     builder.Append("</table>");
     myStoryTest = new StoryTest(builder.Parse, SimpleWriter);
     myStoryTest.Execute(new TypeDictionary());
 }
Esempio n. 12
0
 void RunTest(Parse parse)
 {
     var test = new StoryTest(parse, (t,c) => { resultCounts = c;});
     test.Execute(new TypeDictionary());
 }
Esempio n. 13
0
 void RunTest()
 {
     myStoryTest = new StoryTest(table, (t,c) => { resultCounts = c;});
     myStoryTest.Execute(configuration);
 }
Esempio n. 14
0
 void RunTest(Parse parse)
 {
     var test = new StoryTest(parse, (t,c) => { resultCounts = c;});
     test.Execute(configuration);
 }
Esempio n. 15
0
        private void ExecutePage(StoryPageName pageName, StoryTestString input, Action<StoryTestString, TestCounts> handleResults,
	                             Action handleNoTest)
        {
            var service = new Service.Service(configuration);
            Tree<Cell> result = service.Compose(input);
            if (result == null) {
                handleNoTest();
                return;
            }
            var storyTest = new StoryTest((Parse) result.Value,
                                          (tables, counts) =>
                                          handleResults(service.ParseTree<Cell, StoryTestString>(tables), counts));
            if (pageName.IsSuitePage) {
                storyTest.ExecuteOnConfiguration(configuration);
            }
            else {
                storyTest.Execute(configuration);
            }
        }
Esempio n. 16
0
 public void SetUp()
 {
     TestUtils.InitAssembliesAndNamespaces();
     var builder = new StringBuilder();
     builder.Append("<table>");
     builder.Append("<tr><td colspan='5'>ExampleTableFixture</td></tr>");
     builder.Append("<tr><td>0,0</td><td>0,1</td><td>0,2</td><td>37</td><td></td></tr>");
     builder.Append("</table>");
     table = builder.ToString();
     myStoryTest = new StoryTest(new Parse(table), SimpleWriter);
     myStoryTest.Execute();
 }
Esempio n. 17
0
 private void RunTest(Parse parse)
 {
     var test = new StoryTest(parse, (t,c) => { resultCounts = c;});
     test.Execute();
 }
Esempio n. 18
0
 void RunTest()
 {
     myStoryTest = new StoryTest(storyTables, (t, c) => { resultCounts = c; });
     myStoryTest.Execute(configuration);
 }
Esempio n. 19
0
        void RunTest(Parse parse)
        {
            var test = new StoryTest(parse, (t, c) => { resultCounts = c; });

            test.Execute(new Configuration());
        }
Esempio n. 20
0
 public void Do(StoryTestPage page)
 {
     var elapsedTime = new ElapsedTime();
     var input = page.TestContent;
     if (string.IsNullOrEmpty(input)) {
         page.WriteNonTest();
         DoNoTest();
     }
     var service = new Service.Service(configuration);
     Tree<Cell> result = service.Compose(new StoryTestString(input));
     if (result == null || result.Branches.Count == 0) {
         page.WriteNonTest();
         DoNoTest();
         return;
     }
     var writer = new StoryTestStringWriter(service);
     var storyTest = new StoryTest((Parse) result, writer);
     if (page.Name.IsSuitePage) {
         storyTest.ExecuteOnConfiguration(configuration);
     }
     else {
         storyTest.Execute(configuration);
     }
     var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime);
     page.WriteTest(pageResult);
     handleCounts(writer.Counts);
     resultWriter.WritePageResult(pageResult);
 }
Esempio n. 21
0
 void RunTest(Parse parse)
 {
     var test = new StoryTest(parse, (t,c) => { resultCounts = c;});
     test.Execute(configuration);
     testResult = new ParseStoryTestString().Parse(null, new TypedValue(), parse).ValueString;
 }
Esempio n. 22
0
 private void RunTest()
 {
     myStoryTest = new StoryTest(table, (t,c) => { resultCounts = c;});
     myStoryTest.Execute();
 }