private void WithSetup(IDropClient dropClient, Action <global::Tool.DropDaemon.DropDaemon, DropEtwListener> action, Client apiClient = null) { var etwListener = ConfigureEtwLogging(); string moniker = ServicePipDaemon.IpcProvider.RenderConnectionString(ServicePipDaemon.IpcProvider.CreateNewMoniker()); var daemonConfig = new DaemonConfig(VoidLogger.Instance, moniker: moniker, enableCloudBuildIntegration: false); var dropConfig = new DropConfig(string.Empty, null); var daemon = new global::Tool.DropDaemon.DropDaemon(UnixParser.Instance, daemonConfig, dropConfig, Task.FromResult(dropClient), client: apiClient); action(daemon, etwListener); }
/// <remarks> /// If an apiClient is not passed (i.e., null by default), we create a new Client that returns success for any bool command called. /// </remarks> private void WithSetup(IDropClient dropClient, Action <global::Tool.DropDaemon.DropDaemon, DropEtwListener, DropConfig> action, Client apiClient = null) { var etwListener = ConfigureEtwLogging(); string moniker = ServicePipDaemon.IpcProvider.RenderConnectionString(ServicePipDaemon.IpcProvider.CreateNewMoniker()); var daemonConfig = new DaemonConfig(VoidLogger.Instance, moniker: moniker, enableCloudBuildIntegration: false); var dropConfig = new DropConfig("test", new Uri("file://xyz")); var dropServiceConfig = new DropServiceConfig(); if (apiClient == null) { apiClient = new Client(new MockClient(ipcOperation => IpcResult.Success("true"))); } var daemon = new global::Tool.DropDaemon.DropDaemon(UnixParser.Instance, daemonConfig, dropServiceConfig, client: apiClient); daemon.RegisterDropClientForTesting(dropConfig, dropClient); action(daemon, etwListener, dropConfig); }