static void Main() { Console.WriteLine("Performing benchmarks..."); //Process.Start(BenchmarkEngine.ExecuteAndRenderWithDefaults(null, new BenchmarkOptions { Repetitions = 10 })); var engine = new BenchmarkEngine(new BenchmarkOptions { Repetitions = 10 }, new Assembly[] { typeof(Program).Assembly }); var renderer = new ExcelOutputRenderer(); string outputPath = Path.Combine(Path.GetTempPath(), DateTime.Now.Ticks.ToString() + ".xlsx"); renderer.RenderTo(outputPath, engine.Execute()); Process.Start(outputPath); }
public void OutputIsValidXlsx() { // Just one repetition, we do not really care about results var engine = CreateEngine <KnownBenchmark>(new BenchmarkOptions() { Repetitions = 1 }); var renderer = new ExcelOutputRenderer(); var content = renderer.Render(engine.Execute()); using (var stream = new MemoryStream(content)) using (var document = SpreadsheetDocument.Open(stream, false)) { // Unless we find any bug in content then we just check // this is a valid XLSX document with one worksheet (it has to contain // one worksheet per benchmark). Assert.IsNotNull(document.WorkbookPart); Assert.AreEqual(document.WorkbookPart.WorksheetParts.Count(), 1); } }