public void SetUp() { _clock = new ManualClock(); _clock.Time = 1234567.0; _report = new ReportMock(); _statisticsReporter = new StatisticsReporter(_clock); }
public void TimeAndReport_correctly_measures_time() { var reportMock = new ReportMock(); using (reportMock.TimeAndReport("moo")) { Thread.Sleep(100); } Assert.That(reportMock.ReportedName, Is.EqualTo("moo")); Assert.That(reportMock.ReportedValue, Is.AtLeast(0.09).And.AtMost(1.0)); }
public void Report_Stopwatch_reports_correct_time() { var reportMock = new ReportMock(); var stopwatch = new Stopwatch(); stopwatch.Start(); Thread.Sleep(100); stopwatch.Stop(); reportMock.Report("moo", stopwatch); Assert.That(reportMock.ReportedName, Is.EqualTo("moo")); Assert.That(reportMock.ReportedValue, Is.AtLeast(0.09).And.AtMost(1.0)); }