예제 #1
0
        [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));
        }
예제 #2
0
        [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));
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
     }
 }
예제 #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 CellBase(parseError, "div");
         parse.SetAttribute(CellAttribute.Body, parseError);
         testStatus.MarkException(parse, e);
         WriteResults(new CellTree().AddBranchValue(parse), testStatus.Counts, writer);
     }
 }