コード例 #1
0
        [Test] public void NoTablesReturnsEmptyTree()
        {
            var service = new Service.Service();
            var result  = service.Compose(StoryTestSource.FromString("<b>stuff</b>"));

            Assert.AreEqual(0, result.Branches.Count);
        }
コード例 #2
0
 private void ProcessTestDocument(string document, StoryTestWriter writer)
 {
     try {
         var storyTest = new StoryTest(service, writer)
                         .WithInput(StoryTestSource.FromString(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);
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 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];
 }
コード例 #5
0
        [Test] public void HtmlStringIsParsed()
        {
            var service = new Service.Service();
            var result  = service.Compose(StoryTestSource.FromString("<table><tr><td>hello</td></tr></table>"));
            var table   = ((Parse)result).Parts;

            Assert.AreEqual("<table>", table.Tag);
            var cell = table.Parts.Parts;

            Assert.AreEqual("<td>", cell.Tag);
            Assert.AreEqual("hello", cell.Body);
        }
コード例 #6
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]);
        }
コード例 #7
0
ファイル: HttpRunner.cs プロジェクト: krishnamhn009/fitsharp
        static string ProcessRequest(string request, Memory memory)
        {
            if (request == exitRequest)
            {
                return(exitReply);
            }
            var service   = new Service.Service(memory);
            var writer    = new StoryTestStringWriter();
            var storyTest = new StoryTest(service, writer).WithInput(StoryTestSource.FromString("test@\n" + request));

            storyTest.Execute();
            return(writer.Tables);
        }
コード例 #8
0
        public void String(string storyTestText)
        {
            var writer    = new StoryTestStringWriter();
            var storyTest = new StoryTest(processor, writer).WithInput(StoryTestSource.FromString(storyTestText));

            if (storyTest.IsExecutable)
            {
                storyTest.Execute();
                Result = writer.Tables;
            }
            else
            {
                Result = storyTestText;
            }
        }
コード例 #9
0
ファイル: StoryTest.cs プロジェクト: PinetNicolas/fitsharp
 public StoryTest WithInput(StoryTestSource withInput)
 {
     input = withInput;
     return(this);
 }