private void TestEnvironmentVariable(ITestSettings settings, string variableName, string variableValue, bool newTerminal) { this.WriteSettings(settings); IDebuggee debuggee = SinkHelper.Open(this, settings.CompilerSettings, DebuggeeMonikers.KitchenSink.Environment); using (IDebuggerRunner runner = CreateDebugAdapterRunner(settings)) { this.Comment("Configure launch"); LaunchCommand launch = new LaunchCommand(settings.DebuggerSettings, debuggee.OutputPath, false, "-fEnvironment") { StopAtEntry = false }; if (variableValue != null) { launch.Args.environment = new EnvironmentEntry[] { new EnvironmentEntry { Name = variableName, Value = variableValue } }; } launch.Args.externalConsole = newTerminal; runner.RunCommand(launch); this.Comment("Set breakpoint"); runner.SetBreakpoints(debuggee.Breakpoints(SinkHelper.Environment, 14)); runner.Expects.StoppedEvent(StoppedReason.Breakpoint).AfterConfigurationDone(); using (IThreadInspector threadInspector = runner.GetThreadInspector()) { IFrameInspector currentFrame = threadInspector.Stack.First(); this.Comment("Verify locals variables on current frame."); currentFrame.AssertEvaluateAsString("varValue1", EvaluateContext.Watch, variableValue); } this.Comment("Continue until end"); runner.Expects.ExitedEvent() .TerminatedEvent() .AfterContinue(); runner.DisconnectAndVerify(); } }