예제 #1
0
        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);
        }
예제 #2
0
 /// <summary>
 /// Get epic report data
 /// </summary>
 /// <param name="epicName"></param>
 /// <param name="afterDate"></param>
 public EpicsReport GetEpicReport(string epicName, DateTime afterDate)
 {
     return benchmarker.GetEpicReport(epicName, afterDate);
 }