public void record_data() { var spec = new Specification { name = "Some Name" }; var timings = new Timings(); timings.Start(spec); using (timings.Subject("Fixture.Setup", "Math")) { using (timings.Subject("Grammar", "Adding")) { using (timings.Subject("Fixture.Teardown", "Math")) { Thread.Sleep(100); } } } var records = timings.Finish(); records.Select(x => x.Subject).ShouldHaveTheSameElementsAs("Some Name", "Math", "Adding", "Math"); records.Each(x => x.Duration.ShouldBeGreaterThan(0)); }
public void run_with_non_zero_threshold_that_is_not_exceeded() { using (var timings = new Timings()) { timings.Start(new Specification()); var record = timings.Subject("something", "else", 100); timings.End(record); timings.Finish(); record.PerfViolation.ShouldBeFalse(); } }
public SpecResults FinalizeResults(int attempts) { var performance = _timings.Finish().ToArray(); return(new SpecResults { Counts = Counts, Results = Results.ToArray(), Performance = performance, Duration = _timings.Duration, Reporting = Reporting.As <Reporting>().GenerateReports(), Attempts = attempts, HadCriticalException = HadCriticalException }); }
public void run_with_zero_threshold() { using (var timings = new Timings()) { timings.Start(new Specification()); var record = timings.Subject("something", "else", 0); Thread.Sleep(100); timings.End(record); timings.Finish(); record.PerfViolation.ShouldBeFalse(); } }