Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
        public override void DoTable(Parse theTable)
        {
            Parse embeddedTables = GetEmbeddedTables(theTable);
            Parse expectedCell = GetExpectedCell(theTable);

            var writer = new StoryTestCopyWriter();
            var storyTest = new StoryTest(Processor, writer)
                .WithParsedInput(new Parse("div", string.Empty, embeddedTables, null));
            storyTest.Execute(new Service.Service(Processor));

            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);
                }
            }
        }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 public Parse PlainTest(string plainTest) {
     var writer = new StoryTestStringWriter(Processor);
     var storyTest = new StoryTest(Processor, writer)
         .WithInput("test@\n" + plainTest);
     storyTest.Execute(new Service.Service(Processor));
     var resultString = writer.Tables.Substring(11);
     var parseResult = Processor.Compose(new StoryTestString(resultString));
     return (Parse)parseResult.Branches[0];
 }
Ejemplo n.º 5
0
        public void String(string storyTestText)
        {
            var writer    = new StoryTestStringWriter(processor);
            var storyTest = new StoryTest(processor, writer).WithInput(storyTestText);

            if (storyTest.IsExecutable)
            {
                storyTest.Execute();
                Result = writer.Tables;
            }
            else
            {
                Result = storyTestText;
            }
        }
Ejemplo n.º 6
0
        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); 
			}
		}
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
            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;
	            }

                storyTest.OnAbandonSuite(() => { SuiteIsAbandoned = true; });

                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);
            }