// Copyright © WireMock.Net using System.Diagnostics; using System.Runtime.CompilerServices; // ReSharper disable once CheckNamespace namespace Aspire.Hosting.WireMock; internal static class WireMockInspector { /// /// Opens the WireMockInspector tool to inspect the WireMock server. /// /// /// /// /// /// Copy of /// without requestFilters and no call to WaitForExit() method in the process so it doesn't block the caller. /// public static void Inspect(string wireMockUrl, [CallerMemberName] string title = "") { try { var arguments = $"attach --adminUrl {wireMockUrl} --autoLoad --instanceName \"{title}\""; Process.Start(new ProcessStartInfo { FileName = "wiremockinspector", Arguments = arguments, UseShellExecute = false }); } catch (Exception e) { throw new InvalidOperationException ( message: """ Cannot find installation of WireMockInspector. Execute the following command to install WireMockInspector dotnet tool: > dotnet tool install WireMockInspector --global --no-cache --ignore-failed-sources To get more info please visit https://github.com/WireMock-Net/WireMockInspector """, innerException: e ); } } }