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(theTest, SaveTestResult); story.Execute(Processor.Configuration); return resultTables; }
private void ProcessTestDocument(string document, StoryTestWriter writer) { try { var storyTest = new StoryTest(service, writer) .WithInput(document) .OnAbandonSuite(() => { suiteIsAbandoned = true; }); 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); } }
public override void DoTable(Parse theTable) { Parse embeddedTables = GetEmbeddedTables(theTable); Parse expectedCell = GetExpectedCell(theTable); var storyTest = new StoryTest(new Parse("div", string.Empty, embeddedTables, null), SpecifyWriter); storyTest.Execute(Processor.Configuration); 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(CellAttribute.Status, TestStatus.Wrong); } } }
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; }
public string Run(string input) { var storyTestText = "<style type=\"text/css\">\n" + ".pass {background-color: #AAFFAA;}\n" + ".fail {background-color: #FFAAAA;}\n" + ".error {background-color: #FFFFAA;}\n" + ".ignore {background-color: #CCCCCC;}\n" + ".fit_stacktrace {font-size: 0.7em;}\n" + ".fit_label {font-style: italic; color: #C08080;}\n" + ".fit_grey {color: #808080;}\n" + ".fit_extension {border: solid 1px grey;}\n" + ".fit_table {border: solid 1px grey; border-collapse: collapse; margin: 2px 0px;}\n" + "table.fit_table tr td {border: solid 1px grey; padding: 2px 2px 2px 2px;}\n" + "</style>\n" + "test@\n" + input; service = new Service(memory); var writer = new StoryTestStringWriter(service); var storyTest = new StoryTest(service, writer).WithInput(storyTestText); storyTest.Execute(); return(writer.Tables); }
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; }
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 CellBase(parseError, "div"); parse.SetAttribute(CellAttribute.Body, parseError); testStatus.MarkException(parse, e); WriteResults(new CellTree().AddBranchValue(parse), testStatus.Counts, writer); } }
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; }
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) { var writer = new StoryTestCopyWriter(); var story = new StoryTest(new Parse("div", string.Empty, theTest, null), writer); story.Execute(Processor.Configuration); return(writer.ResultTables); }
public Parse TestResult(Parse theTest) { var writer = new StoryTestCopyWriter(); var storyTest = new StoryTest(Processor, writer) .WithParsedInput(new Parse("div", string.Empty, theTest, null)); storyTest.Execute(new Service.Service(Processor)); return(writer.ResultTables); }
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 Configuration()); }
public Parse PlainTest(string plainTest) { var writer = new StoryTestStringWriter(); var storyTest = new StoryTest(Processor, writer) .WithInput(StoryTestSource.FromString("test@\n" + plainTest)); TestClock.Instance.Elapsed = new TimeSpan(); Clock.Instance = TestClock.Instance; storyTest.Execute(new Service.Service(Processor)); Clock.Instance = new Clock(); var resultString = writer.Tables.Substring(11); var parseResult = Processor.Compose(StoryTestSource.FromString(resultString)); return (Parse)parseResult.Branches[0]; }
public Parse PlainTest(string plainTest) { var writer = new StoryTestStringWriter(); var storyTest = new StoryTest(Processor, writer) .WithInput(StoryTestSource.FromString("test@\n" + plainTest)); storyTest.Execute(new Service.Service(Processor)); var resultString = writer.Tables.Substring(11); var parseResult = Processor.Compose(StoryTestSource.FromString(resultString)); return((Parse)parseResult.Branches[0]); }
public void TestLoadHandler() { TestUtils.InitAssembliesAndNamespaces(); StringBuilder builder = new StringBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">cell handler loader</td></tr>"); builder.Append("<tr><td>load</td><td>substring handler</td></tr>"); builder.Append("</table>"); Assert.IsFalse(Context.Configuration.GetItem<Service.Service>().Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); StoryTest test = new StoryTest(new Parse(builder.ToString())); test.ExecuteOnConfiguration(); Assert.IsTrue(Context.Configuration.GetItem<Service.Service>().Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); }
static string ProcessRequest(string request, Memory memory) { if (request == exitRequest) { return(exitReply); } var service = new Service.Service(memory); var writer = new StoryTestStringWriter(service); var storyTest = new StoryTest(service, writer).WithInput("test@\n" + request); storyTest.Execute(); return(writer.Tables); }
public void TestRemoveHandler() { Configuration configuration = TestUtils.InitAssembliesAndNamespaces(); new Service.Service(configuration).AddOperator(new CompareSubstring()); var builder = new StringBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">CellHandlerLoader</td></tr>"); builder.Append("<tr><td>remove</td><td>SubstringHandler</td></tr>"); builder.Append("</table>"); Assert.IsTrue(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); var test = new StoryTest(new Parse(builder.ToString())); test.ExecuteOnConfiguration(configuration); Assert.IsFalse(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); }
void CreateStoryTest(string input, out StoryTestStringWriter writer, out StoryTest storyTest) { CellProcessorBase processor = CreateProcessor(); writer = new StoryTestStringWriter(processor); storyTest = new StoryTest(processor, writer).WithInput(input); var tree = new fitSharp.Slim.Model.SlimTree(); if (!storyTest.IsExecutable) { throw new InvalidFormatException("Input content is not in executable format"); } }
public void TestLoadHandler() { Configuration configuration = TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">cell handler loader</td></tr>"); builder.Append("<tr><td>load</td><td>substring handler</td></tr>"); builder.Append("</table>"); Assert.IsFalse(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); StoryTest test = builder.MakeStoryTest(); test.ExecuteOnConfiguration(configuration); Assert.IsTrue(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); }
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 Do(StoryTestPage page) { var elapsedTime = new ElapsedTime(); if (!page.HasTestContent) { page.WriteNonTest(); DoNoTest(); return; } StoreCurrentlyExecutingPagePath(page.Name.Name); var service = newService(memory); var writer = new StoryTestStringWriter(); var storyTest = new StoryTest(service, writer).WithInput(page.TestContent); if (!storyTest.IsExecutable) { page.WriteNonTest(); DoNoTest(); return; } storyTest.OnAbandonSuite(() => { SuiteIsAbandoned = true; }); if (page.Name.IsSuitePage) { storyTest.Execute(); } else { storyTest.Execute(newService(service.Memory.Copy())); } var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime); page.WriteTest(pageResult); report.ListFile(page.OutputFile, writer.Counts, elapsedTime); handleCounts(writer.Counts); resultWriter.WritePageResult(pageResult); }
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); } }
public void Do(StoryTestPage page) { var elapsedTime = new ElapsedTime(); var input = page.TestContent; if (string.IsNullOrEmpty(input)) { page.WriteNonTest(); DoNoTest(); } StoreCurrentlyExecutingPagePath(page.Name.Name); var service = new Service.Service(memory); var writer = new StoryTestStringWriter(service); var storyTest = new StoryTest(service, writer).WithInput(input); if (!storyTest.IsExecutable) { page.WriteNonTest(); DoNoTest(); return; } if (page.Name.IsSuitePage) { storyTest.Execute(); } else { storyTest.Execute(new Service.Service(service)); } var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime); page.WriteTest(pageResult); handleCounts(writer.Counts); resultWriter.WritePageResult(pageResult); }
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); } }
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 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); }
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()); }
private void RunTest() { myStoryTest = new StoryTest(table, (t,c) => { resultCounts = c;}); myStoryTest.Execute(); }
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); }
void RunTest(Parse parse) { var test = new StoryTest(parse, (t, c) => { resultCounts = c; }); test.Execute(new 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(); }
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; }
void RunTest() { myStoryTest = new StoryTest(storyTables, (t, c) => { resultCounts = c; }); myStoryTest.Execute(configuration); }
private void RunTest(Parse parse) { var test = new StoryTest(parse, (t,c) => { resultCounts = c;}); test.Execute(); }
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); }