private static void CheckRoundTrip(string input) { var service = new Service.Service(); var source = (Parse)service.Compose(new StoryTestString(input)); var result = service.Parse(typeof(StoryTestString), TypedValue.Void, source); Assert.AreEqual(input, result.ValueString); }
[Test] public void CellIsMadeWithSimpleString() { var service = new Service.Service(); var cell = (Parse)service.Compose("something"); Assert.AreEqual("<td><span class=\"fit_grey\">something</span></td>", cell.ToString()); }
[Test] public void CellIsMadeWithArray() { var service = new Service.Service(); var cell = (Parse)service.Compose(new [] { "something", "else" }); Assert.AreEqual("<td><span class=\"fit_grey\">something, else</span></td>", cell.ToString()); }
[Test] public void NoTablesReturnsEmptyTree() { var service = new Service.Service(); Tree <Cell> result = service.Compose(new StoryTestString("<b>stuff</b>")); Assert.AreEqual(0, result.Branches.Count); }
static void CheckRoundTrip(string input) { var service = new Service.Service(); var source = service.Compose(StoryTestSource.FromString(input)); var result = source.WriteBranches(); Assert.AreEqual(input, result); }
[Test] public void CellIsMadeWithEmbeddedTable() { var service = new Service.Service(); Parse table = Parse.ParseFrom("<table><tr><td>11</td><td>12</td></tr><tr><td>21</td><td>22</td></tr></table>"); var cell = (Parse) service.Compose(new ParseTable(table)); Assert.AreEqual("\n<td>\n<table>\n<tr>\n<td><span class=\"fit_grey\">11</span></td>\n<td><span class=\"fit_grey\">12</span></td></tr>" + "\n<tr>\n<td><span class=\"fit_grey\">21</span></td>\n<td><span class=\"fit_grey\">22</span></td></tr></table></td>", cell.ToString()); }
private static void CheckRoundTrip(string input) { var service = new Service.Service(); var source = service.Compose(new StoryTestString(input)); var result = source.Branches.Aggregate(string.Empty, (current, table) => current + service.Parse(typeof(StoryTableString), TypedValue.Void, table)); Assert.AreEqual(input, result); }
private static void CheckRoundTrip(string input) { var service = new Service.Service(); var source = (Parse)service.Compose(new StoryTestString(input)); var result = service.Parse(typeof(StoryTestString), TypedValue.Void, source); Assert.AreEqual(input, result.ValueString); }
[Test] public void HtmlStringIsParsed() { var service = new Service.Service(); Tree<Cell> result = service.Compose(new StoryTestString("<table><tr><td>hello</td></tr></table>")); var table = ((Parse)result).Parts; Assert.AreEqual("<table>", table.Tag); Parse cell = table.Parts.Parts; Assert.AreEqual("<td>", cell.Tag); Assert.AreEqual("hello", cell.Body); }
[Test] public void CellIsMadeWithEmbeddedTable() { var service = new Service.Service(); Parse table = Parse.ParseFrom("<table><tr><td>11</td><td>12</td></tr><tr><td>21</td><td>22</td></tr></table>"); var cell = (Parse)service.Compose(new ParseTable(table)); Assert.AreEqual("\n<td>\n<table>\n<tr><td><span class=\"fit_grey\">11</span></td><td><span class=\"fit_grey\">12</span></td></tr>" + "\n<tr><td><span class=\"fit_grey\">21</span></td><td><span class=\"fit_grey\">22</span></td></tr></table></td>", cell.ToString()); }
[Test] public void HtmlStringIsParsed() { var service = new Service.Service(); Tree <Cell> result = service.Compose(new StoryTestString("<table><tr><td>hello</td></tr></table>")); var table = ((Parse)result).Parts; Assert.AreEqual("<table>", table.Tag); Parse cell = table.Parts.Parts; Assert.AreEqual("<td>", cell.Tag); Assert.AreEqual("hello", cell.Body); }
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(); 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); } }
[Test] public void CellIsMadeWithSimpleString() { var service = new Service.Service(); var cell = (Parse) service.Compose("something"); Assert.AreEqual("\n<td><span class=\"fit_grey\">something</span></td>", cell.ToString()); }
public void NoTablesReturnsEmptyTree() { var service = new Service.Service(); Tree<Cell> result = service.Compose(new StoryTestString("<b>stuff</b>")); Assert.AreEqual(0, result.Branches.Count); }
public void NoTablesReturnsNull() { var service = new Service.Service(); Tree<Cell> result = service.Compose(new StoryTestString("<b>stuff</b>")); Assert.IsNull(result); }
private static void CheckRoundTrip(string input) { var service = new Service.Service(); var source = service.Compose(new StoryTestString(input)); var result = source.Branches.Aggregate(string.Empty, (current, table) => current + service.Parse(typeof (StoryTableString), TypedValue.Void, table)); Assert.AreEqual(input, result); }
[Test] public void CellIsMadeWithArray() { var service = new Service.Service(); var cell = (Parse) service.Compose(new [] {"something", "else"}); Assert.AreEqual("\n<td><span class=\"fit_grey\">something, else</span></td>", cell.ToString()); }
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); }