void MarkCellWithCounts(Cell target, TestCounts beforeCounts) { string style = Processor.TestStatus.Counts.Subtract(beforeCounts).Style; if (!string.IsNullOrEmpty(style) && string.IsNullOrEmpty(target.GetAttribute(CellAttribute.Status))) { target.SetAttribute(CellAttribute.Status, style); } }
void MarkCellWithCounts(ExecuteParameters parameters, TestCounts beforeCounts) { string style = Processor.TestStatus.Counts.Subtract(beforeCounts).Style; if (!string.IsNullOrEmpty(style) && string.IsNullOrEmpty(parameters.Cell.GetAttribute(CellAttribute.Status))) { parameters.Cell.SetAttribute(CellAttribute.Status, style); } }
public void WriteTest(Tree<Cell> test, TestCounts counts) { var tables = (Parse) test.Branches[0]; for (var table = tables; table != null; table = table.More) { CopyTable(table); } }
public SuiteRunner(Memory memory, ProgressReporter theReporter, Func<Memory, CellProcessor> newService) { TestCounts = new TestCounts(); myReporter = theReporter; this.memory = memory; this.newService = newService; }
void MarkCellWithCounts(TestCounts beforeCounts) { string style = processor.TestStatus.Counts.Subtract(beforeCounts).Style; if (!string.IsNullOrEmpty(style) && string.IsNullOrEmpty(Cells.Value.GetAttribute(CellAttribute.Status))) { Cells.Value.SetAttribute(CellAttribute.Status, style); } }
void Input(ExecuteContext context, ExecuteParameters parameters) { var beforeCounts = new TestCounts(Processor.TestStatus.Counts); Processor.InvokeWithThrow(context.SystemUnderTest, GetMemberName(parameters.Members), new CellTree(parameters.Cells)); MarkCellWithLastResults(parameters, p => MarkCellWithCounts(p, beforeCounts)); }
public static void CheckCounts(TestCounts counts, int right, int wrong, int ignore, int exception) { Assert.AreEqual(right, counts.GetCount(TestStatus.Right)); Assert.AreEqual(wrong, counts.GetCount(TestStatus.Wrong)); Assert.AreEqual(ignore, counts.GetCount(TestStatus.Ignore)); Assert.AreEqual(exception, counts.GetCount(TestStatus.Exception)); }
void WriteCounts(TestCounts summary, string tag) { writer.WriteStartElement(tag); writer.WriteElementString("right", summary.GetCount(TestStatus.Right).ToString()); writer.WriteElementString("wrong", summary.GetCount(TestStatus.Wrong).ToString()); writer.WriteElementString("ignores", summary.GetCount(TestStatus.Ignore).ToString()); writer.WriteElementString("exceptions", summary.GetCount(TestStatus.Exception).ToString()); writer.WriteEndElement(); }
public void WriteTest(Tree<Cell> test, TestCounts counts) { if (!writesTables) { var testResult = processor.ParseTree<Cell, StoryTestString>(test).ToString(); if (!string.IsNullOrEmpty(testResult)) HandleTableResult(testResult); } handleCounts(counts); Counts = counts; }
public static String FormatCounts(TestCounts status) { var builder = new StringBuilder(); builder.Append(FormatInteger(0)); builder.Append(FormatInteger(status.GetCount(TestStatus.Right))); builder.Append(FormatInteger(status.GetCount(TestStatus.Wrong))); builder.Append(FormatInteger(status.GetCount(TestStatus.Ignore))); builder.Append(FormatInteger(status.GetCount(TestStatus.Exception))); return builder.ToString(); }
public void HandleFinalCount(TestCounts summary) { if(verbose) { output.WriteLine(); output.WriteLine("Test Pages: " + pageCounts.Description); output.WriteLine("Assertions: " + summary.Description); } resultWriter.WriteFinalCount(summary); }
public TypedValue Execute(object systemUnderTest, Tree<Cell> memberName, Tree<Cell> parameters, Cell targetCell) { var beforeCounts = new TestCounts(Processor.TestStatus.Counts); var targetObjectProvider = systemUnderTest as TargetObjectProvider; var name = Processor.ParseTree<Cell, MemberName>(memberName).ToString(); var result = Processor.Invoke( new TypedValue(targetObjectProvider != null ? targetObjectProvider.GetTargetObject() : systemUnderTest), name, parameters); MarkCellWithLastResults(new CellTree(targetCell), p => MarkCellWithCounts(p, beforeCounts)); return result; }
public TypedValue Do() { var beforeCounts = new TestCounts(processor.TestStatus.Counts); var targetObjectProvider = Target.Value as TargetObjectProvider; string name = GetMemberName(Member); TypedValue result = processor.Invoke( targetObjectProvider != null ? new TypedValue(targetObjectProvider.GetTargetObject()) : Target, name, Parameters); MarkCellWithLastResults(beforeCounts); return result; }
TypedValue Invoke(ExecuteContext context, ExecuteParameters parameters) { var beforeCounts = new TestCounts(Processor.TestStatus.Counts); TypedValue target = context.Target.Value; var targetObjectProvider = target.Value as TargetObjectProvider; string name = GetMemberName(parameters.Members); TypedValue result = Processor.Invoke( targetObjectProvider != null ? new TypedValue(targetObjectProvider.GetTargetObject()) : target, name, parameters.Parameters); MarkCellWithLastResults(parameters, p => MarkCellWithCounts(p, beforeCounts)); return result; }
public void Do(Tree<Cell> cell) { var instance = new TypedValue(targetProvider.GetTargetObject()); if (cell.IsLeaf && cell.Value.Text.Length == 0) { var actual = processor.Invoke(instance, GetMemberName(memberCell), new CellTree()); if (actual.IsValid) ShowActual(cell.Value, actual.Value); } else { var beforeCounts = new TestCounts(processor.TestStatus.Counts); processor.InvokeWithThrow(instance, GetMemberName(memberCell), new CellTree(cell)); processor.TestStatus.MarkCellWithLastResults(cell.Value, beforeCounts); } }
public void SetUp() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan='5'>ExampleTableFixture</td></tr>"); builder.Append("<tr><td>0,0</td><td>0,1</td><td>0,2</td><td>37</td><td></td></tr>"); builder.Append("</table>"); table = builder.Parse.Parts; fixture = new ExampleTableFixture {Processor = new Service.Service()}; fixture.DoTable(table); resultCounts = fixture.TestStatus.Counts; }
private void SpecifyWriter(Tree<Cell> theTables, TestCounts counts) { var tables = (Parse) theTables.Value; for (Parse table = tables; table != null; table = table.More) { Parse newTable = table.Copy(); if (resultTables == null) { resultTables = newTable; } else { resultTables.Last.More = newTable; } } }
private void SaveTestResult(Tree<Cell> theTables, TestCounts counts) { var tables = (Parse) theTables.Branches[0]; for (Parse table = tables; table != null; table = table.More) { Parse newTable = table.Copy(); if (resultTables == null) { resultTables = newTable; } else { resultTables.Last.More = newTable; } } }
public static TestCounts MakeTestCounts() { var counts = new TestCounts(); counts.AddCount(TestStatus.Right); counts.AddCount(TestStatus.Wrong); counts.AddCount(TestStatus.Wrong); counts.AddCount(TestStatus.Ignore); counts.AddCount(TestStatus.Ignore); counts.AddCount(TestStatus.Ignore); counts.AddCount(TestStatus.Exception); counts.AddCount(TestStatus.Exception); counts.AddCount(TestStatus.Exception); counts.AddCount(TestStatus.Exception); return counts; }
public TypedValue Execute(object systemUnderTest, Tree<Cell> memberName, Tree<Cell> parameters, Cell targetCell) { var beforeCounts = new TestCounts(Processor.TestStatus.Counts); var targetObjectProvider = systemUnderTest as TargetObjectProvider; var name = Processor.ParseTree<Cell, MemberName>(memberName); TypedValue result; Processor.Get<Logging>().BeginCell(targetCell); try { result = Processor.Invoke( new TypedValue(targetObjectProvider != null ? targetObjectProvider.GetTargetObject() : systemUnderTest), name, parameters); } finally { Processor.Get<Logging>().EndCell(targetCell); } Processor.TestStatus.MarkCellWithLastResults(targetCell, beforeCounts); return result; }
public TestResult(Folder folder, TestFile file) { this.file = file; if (file.IsFolder) return; var path = file.FileName + ".html"; if (!folder.Pages.Contains(path)) return; using (var input = folder.Pages[path].Reader) { var line = input.ReadLine(); if (line.Length < 8) return; var content = line.Substring(4, line.Length - 7).Split(','); if (content.Length < 5) return; runTime = content[0]; counts = new TestCounts(); counts.SetCount(TestStatus.Right, int.Parse(content[1])); counts.SetCount(TestStatus.Wrong, int.Parse(content[2])); counts.SetCount(TestStatus.Ignore, int.Parse(content[3])); counts.SetCount(TestStatus.Exception, int.Parse(content[4])); } }
public PageResult(string title, string content, TestCounts testCounts) : this(title, content, testCounts, new ElapsedTime()) { }
public void ListFile(string theFileName, TestCounts counts, ElapsedTime elapsedTime) { if (myReport != null) { myReport.ListFile(theFileName, counts, elapsedTime); } else { myParent.ListFile(theFileName, counts, elapsedTime); } }
public void ListFile(string thePath, TestCounts counts, ElapsedTime elapsedTime) { myReport.WriteLine("<br /><a href=\"{0}\">{0}</a> <span class=\"{2}\">{1}</span> in {3}", thePath.Substring(myReportPath.Length + 1).Replace('\\', '/'), counts.Description, counts.Style, elapsedTime); }
private void WriteFile(StoryTestString testResult, TestCounts counts) { WriteResult(testResult, counts, elapsedTime); resultWriter.WritePageResult(new PageResult(myPath.Name, testResult.ToString(), counts)); handler(counts); }
private void WriteResult(StoryTestString testResult, TestCounts counts, ElapsedTime elapsedTime) { string outputFile = OutputPath; var output = new StringWriter(); output.Write(testResult); output.Close(); myFolderModel.MakeFile(outputFile, output.ToString()); myFolder.ListFile(outputFile, counts, elapsedTime); }
void SimpleWriter(Tree<Cell> theTables, TestCounts counts) { finishedTable = (Parse) theTables.Branches[0].Value; resultCounts = counts; }
private void WriteResults(string tables, TestCounts counts) { reporter.WriteLine("\tTransmitting tables of length " + tables.Length); clientSocket.SendDocument(tables); reporter.WriteLine("\tTest Document finished"); clientSocket.SendCounts(counts); totalCounts.TallyCounts(counts); reporter.WriteLine("\tresults: " + counts.Description); }
void RunTest(Fixture fixture, Parse parse) { fixture.Processor = processor; fixture.DoTable(parse.Parts); resultCounts = fixture.TestStatus.Counts; testResult = new ParseStoryTestString().Parse(typeof(StoryTableString), new TypedValue(), parse.Parts).ValueString; }
private void WriteCounts(TestCounts counts) { reporter.WriteLine("\tTest Document finished"); clientSocket.SendCounts(counts); totalCounts.TallyCounts(counts); reporter.WriteLine("\tresults: " + counts.Description); }
public void MarkCellWithLastResults(Cell cell, TestCounts beforeCounts) { MarkCellWithLastResults(cell, c => MarkWithCounts(c, beforeCounts)); }
private void WriteTestRunner(string data, TestCounts counts) { int indexOfFirstLineBreak = data.IndexOf("\n"); string pageTitle = data.Substring(0, indexOfFirstLineBreak); data = data.Substring(indexOfFirstLineBreak + 1); AcceptResults(new PageResult(pageTitle, data, counts)); }
public TestStatus() { Summary = new Hashtable(); Counts = new TestCounts(); }