[Test] public void LongTimeIsShown() { Clock.Instance = TestClock.Instance; TestClock.Instance.UtcNow = new DateTime(2009, 1, 2, 3, 4, 5, 6); var elapsed = new ElapsedTime(); TestClock.Instance.UtcNow = new DateTime(2010, 1, 2, 6, 4, 5, 7); Assert.AreEqual("8763:00:00.001", elapsed.ToString()); }
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); }
public void ListFile(string theFileName, TestCounts counts, ElapsedTime elapsedTime) { if (myReport != null) { myReport.ListFile(theFileName, counts, elapsedTime); } else { myParent.ListFile(theFileName, counts, elapsedTime); } }
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); }
public void ExecuteStoryPage(Action<StoryPageName, StoryTestString, Action<StoryTestString, TestCounts>, Action> executor, ResultWriter resultWriter, Action<TestCounts> handler) { elapsedTime = new ElapsedTime(); this.resultWriter = resultWriter; this.handler = handler; if (HasTestName) { executor(myPath, DecoratedContent, WriteFile, HandleNoTest); return; } if (myPath.IsSuiteSetUp || myPath.IsSuiteTearDown) { executor(myPath, PlainContent, WriteFile, HandleNoTest); return; } HandleNoTest(); }
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); }
public void Do(StoryTestPage page) { var elapsedTime = new ElapsedTime(); var input = page.TestContent; if (string.IsNullOrEmpty(input)) { page.WriteNonTest(); DoNoTest(); } var service = new Service.Service(configuration); Tree<Cell> result = service.Compose(new StoryTestString(input)); if (result == null || result.Branches.Count == 0) { page.WriteNonTest(); DoNoTest(); return; } var writer = new StoryTestStringWriter(service); var storyTest = new StoryTest((Parse) result, writer); if (page.Name.IsSuitePage) { storyTest.ExecuteOnConfiguration(configuration); } else { storyTest.Execute(configuration); } var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime); page.WriteTest(pageResult); handleCounts(writer.Counts); resultWriter.WritePageResult(pageResult); }
public PageResult(string title, string content, TestCounts testCounts, ElapsedTime elapsedTime) { Title = title; Content = content; TestCounts = testCounts; ElapsedTime = elapsedTime; }