示例#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);
                }
            }
        }
示例#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;
 }
示例#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;
 }
示例#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);
     }
 }
示例#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);
     }
 }
示例#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);
     }
 }
示例#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);
            }
示例#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);
            }
        }
示例#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);
                }
            }
        }
示例#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());
 }
示例#12
0
 void RunTest(Parse parse)
 {
     var test = new StoryTest(parse, (t,c) => { resultCounts = c;});
     test.Execute(new TypeDictionary());
 }
示例#13
0
 void RunTest()
 {
     myStoryTest = new StoryTest(table, (t,c) => { resultCounts = c;});
     myStoryTest.Execute(configuration);
 }
示例#14
0
 void RunTest(Parse parse)
 {
     var test = new StoryTest(parse, (t,c) => { resultCounts = c;});
     test.Execute(configuration);
 }
示例#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);
            }
        }
示例#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();
 }
示例#17
0
 private void RunTest(Parse parse)
 {
     var test = new StoryTest(parse, (t,c) => { resultCounts = c;});
     test.Execute();
 }
示例#18
0
 void RunTest()
 {
     myStoryTest = new StoryTest(storyTables, (t, c) => { resultCounts = c; });
     myStoryTest.Execute(configuration);
 }
示例#19
0
        void RunTest(Parse parse)
        {
            var test = new StoryTest(parse, (t, c) => { resultCounts = c; });

            test.Execute(new Configuration());
        }
示例#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);
 }
示例#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;
 }
示例#22
0
 private void RunTest()
 {
     myStoryTest = new StoryTest(table, (t,c) => { resultCounts = c;});
     myStoryTest.Execute();
 }