[Test] public void FoldedWithoutExtraTextFormatsBody() { var cell = new CellBase(string.Empty); cell.SetAttribute(CellAttribute.Body, "stuff"); cell.SetAttribute(CellAttribute.Folded, string.Empty); Assert.AreEqual(FormatFolded("stuff"), TreeCellWriter.Body(cell)); }
[Test] public void FoldedWithExtraTextIsFormatted() { var cell = new CellBase(string.Empty); cell.SetAttribute(CellAttribute.Body, string.Empty); cell.SetAttribute(CellAttribute.Folded, "more"); Assert.AreEqual(FormatFolded("more"), TreeCellWriter.Body(cell)); }
static void AddBranch(TreeList <CellBase> source, string body) { var branchNode = new CellBase("text"); branchNode.SetAttribute(CellAttribute.Body, body); branchNode.SetAttribute(CellAttribute.EndTag, "</leaftag>"); branchNode.SetAttribute(CellAttribute.StartTag, "<leaftag>"); source.AddBranchValue(branchNode); }
static TreeList <CellBase> MakeRootNode() { var sourceNode = new CellBase("text"); sourceNode.SetAttribute(CellAttribute.EndTag, "</tag>"); sourceNode.SetAttribute(CellAttribute.Leader, "leader"); sourceNode.SetAttribute(CellAttribute.StartTag, "<tag stuff>"); sourceNode.SetAttribute(CellAttribute.Trailer, "trailer"); return(new TreeList <CellBase>(sourceNode)); }
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); } }
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); } }