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); } } }
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; }
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; }
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); } }
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); } }
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); } }
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); }
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); } }
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); } } }
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()); }
void RunTest(Parse parse) { var test = new StoryTest(parse, (t,c) => { resultCounts = c;}); test.Execute(new TypeDictionary()); }
void RunTest() { myStoryTest = new StoryTest(table, (t,c) => { resultCounts = c;}); myStoryTest.Execute(configuration); }
void RunTest(Parse parse) { var test = new StoryTest(parse, (t,c) => { resultCounts = c;}); test.Execute(configuration); }
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); } }
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(); }
private void RunTest(Parse parse) { var test = new StoryTest(parse, (t,c) => { resultCounts = c;}); test.Execute(); }
void RunTest() { myStoryTest = new StoryTest(storyTables, (t, c) => { resultCounts = c; }); myStoryTest.Execute(configuration); }
void RunTest(Parse parse) { var test = new StoryTest(parse, (t, c) => { resultCounts = c; }); test.Execute(new Configuration()); }
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); }
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; }
private void RunTest() { myStoryTest = new StoryTest(table, (t,c) => { resultCounts = c;}); myStoryTest.Execute(); }