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 async Task CanLaunchScriptWithNoBreakpointsAsync() { string filePath = NewTestFile(GenerateScriptFromLoggingStatements("works")); await PsesDebugAdapterClient.LaunchScript(filePath, Started).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[] log = GetLog(); Assert.Equal("works", log[0]); }