Пример #1
0
        public void EvaluateInvalidExpression(ITestSettings settings)
        {
            this.TestPurpose("To test invalid expression evaluation return apropriate errors.");
            this.WriteSettings(settings);

            IDebuggee debuggee = SinkHelper.Open(this, settings.CompilerSettings, DebuggeeMonikers.KitchenSink.Expression);

            using (IDebuggerRunner runner = CreateDebugAdapterRunner(settings))
            {
                this.Comment("Configure launch.");
                runner.Launch(settings.DebuggerSettings, debuggee, "-fExpression");

                this.Comment("Set a breakpoint so that we can stop at a line.");
                runner.SetBreakpoints(debuggee.Breakpoints(SinkHelper.Expression, 31));

                this.Comment("To start debugging and hit breakpoint.");
                runner.Expects.HitBreakpointEvent().AfterConfigurationDone();

                using (IThreadInspector threadInspector = runner.GetThreadInspector())
                {
                    IFrameInspector currentFrame = threadInspector.Stack.First();

                    this.Comment("To evaluate some invalid expression on curren stack frame.");
                    currentFrame.AssertEvaluateAsError("notExistVar", EvaluateContext.Watch);
                }

                this.Comment("Continue to run to exist.");
                runner.Expects.TerminatedEvent().AfterContinue();

                runner.DisconnectAndVerify();
            }
        }