public void Benchmarking_PersistsInDatabase_GeneratesReport() { Guid epicPass1 = Guid.NewGuid(); string epicName = "My epic"; string processName = "MyProc"; _benchmarker.StartEpic(epicPass1, epicName); _benchmarker.Bench("Start", epicPass1, processName); Thread.Sleep(100); _benchmarker.Bench("Processing", epicPass1, processName); Thread.Sleep(100); _benchmarker.Bench("End", epicPass1, processName); _benchmarker.FlushEpic(epicPass1); var report = _benchmarker.GetEpicReport(epicName, DateTime.UtcNow.AddMinutes(-1)); Assert.Single(report.EpicReports); Assert.Contains(report.EpicReports, x => x.EpicId == epicPass1); Assert.Equal(3, report.EpicReports.SingleOrDefault(x => x.EpicId == epicPass1)?.BenchmarkEntries.Count); Assert.Equal("Start", report.EpicReports.SingleOrDefault(x => x.EpicId == epicPass1).BenchmarkEntries[0].Checkpoint); Assert.Equal("Processing", report.EpicReports.SingleOrDefault(x => x.EpicId == epicPass1).BenchmarkEntries[1].Checkpoint); Assert.Equal("End", report.EpicReports.SingleOrDefault(x => x.EpicId == epicPass1).BenchmarkEntries[2].Checkpoint); }
/// <summary> /// Mark epic as started /// </summary> /// <param name="epicName"></param> public void StartEpic(string epicName) { benchmarker.StartEpic(process.EpicId, epicName); }