public async Task CanLaunchScriptWithNoBreakpointsAsync() { string filePath = NewTestFile("'works' > \"$PSScriptRoot/testFile.txt\""); LaunchResponse launchResponse = await PsesDebugAdapterClient.RequestLaunch(new PsesLaunchRequestArguments { NoDebug = false, Script = filePath, Cwd = "", CreateTemporaryIntegratedConsole = false, }).ConfigureAwait(false); Assert.NotNull(launchResponse); // This will check to see if we received the Initialized event from the server. await Task.Run( async() => await _dapTestsFixture.Started.Task.ConfigureAwait(false), new CancellationTokenSource(2000).Token).ConfigureAwait(false); ConfigurationDoneResponse configDoneResponse = await PsesDebugAdapterClient.RequestConfigurationDone(new ConfigurationDoneArguments()).ConfigureAwait(false); Assert.NotNull(configDoneResponse); // At this point the script should be running so lets give it time await Task.Delay(2000).ConfigureAwait(false); string testFile = Path.Join(Path.GetDirectoryName(filePath), "testFile.txt"); string contents = await File.ReadAllTextAsync(testFile).ConfigureAwait(false); Assert.Equal($"works{Environment.NewLine}", contents); }
public static async Task LaunchScript(this DebugAdapterClient debugAdapterClient, string filePath, TaskCompletionSource <object> started) { LaunchResponse launchResponse = await debugAdapterClient.RequestLaunch(new PsesLaunchRequestArguments { NoDebug = false, Script = filePath, Cwd = "", CreateTemporaryIntegratedConsole = false, }).ConfigureAwait(false); if (launchResponse == null) { throw new Exception("Launch response was null."); } // This will check to see if we received the Initialized event from the server. await Task.Run( async() => await started.Task.ConfigureAwait(false), new CancellationTokenSource(2000).Token).ConfigureAwait(false); }