From 19c7893b787bf28d57ec42ffc0e2a67b1cd729db Mon Sep 17 00:00:00 2001 From: "Matthew Parker [SSW]" <61717342+MattParkerDev@users.noreply.github.com> Date: Sat, 11 Jan 2025 13:54:18 +1000 Subject: [PATCH] add test --- .../ParseSolutionBenchmarks.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/Roslyn.Benchmarks/ParseSolutionBenchmarks.cs b/tests/Roslyn.Benchmarks/ParseSolutionBenchmarks.cs index f3de867..48c490a 100644 --- a/tests/Roslyn.Benchmarks/ParseSolutionBenchmarks.cs +++ b/tests/Roslyn.Benchmarks/ParseSolutionBenchmarks.cs @@ -7,15 +7,25 @@ namespace Roslyn.Benchmarks; public class ParseSolutionBenchmarks { private const string _solutionFilePath = "C:/Users/Matthew/Documents/Git/StatusApp/StatusApp.sln"; + private MSBuildWorkspace _workspace = null!; + [IterationSetup] + public void IterationSetup() + { + _workspace = MSBuildWorkspace.Create(); + } - //[IterationSetup] - + // | ParseSolutionFileFromPath | 1.488 s | 0.0063 s | 0.0059 s | [Benchmark] public async Task ParseSolutionFileFromPath() { - var workspace = MSBuildWorkspace.Create(); - var solution = await workspace.OpenSolutionAsync(_solutionFilePath); + var solution = await _workspace.OpenSolutionAsync(_solutionFilePath); return solution; } + + [IterationCleanup] + public void IterationCleanup() + { + _workspace?.CloseSolution(); + } }