示例#1
0
        public async Task BreakpointsSet_ConditionMultiple()
        {
            // In this tests, 2 of the breakpoints have their conditions satisfied
            // while 1 does not.
            int i = 10;

            using (var app = StartTestApp(debugEnabled: true, methodEvaluation: true))
            {
                var debuggee    = Polling.GetDebuggee(app.Module, app.Version);
                var breakpoint1 = SetBreakpointAndSleep(debuggee.Id, TestApplication.MainClass,
                                                        TestApplication.EchoBottomLine, $"testList[1] == \"List{i}1\"");
                var breakpoint2 = SetBreakpointAndSleep(debuggee.Id, TestApplication.MainClass,
                                                        TestApplication.EchoBottomLine, $"testList[1] == \"List{i}2\"");
                var breakpoint3 = SetBreakpointAndSleep(debuggee.Id, TestApplication.MainClass,
                                                        TestApplication.EchoBottomLine, $"testDictionary[Key{i}2] == 2");

                using (HttpClient client = new HttpClient())
                {
                    await client.GetAsync(TestApplication.GetEchoUrl(app, i));

                    Assert.Throws <TimeoutException>(() =>
                                                     Polling.GetBreakpoint(debuggee.Id, breakpoint2.Id));

                    var newBp1 = Polling.GetBreakpoint(debuggee.Id, breakpoint1.Id);
                    Assert.True(newBp1.IsFinalState);

                    var newBp3 = Polling.GetBreakpoint(debuggee.Id, breakpoint3.Id);
                    Assert.True(newBp3.IsFinalState);
                }
            }
        }
示例#2
0
        public async Task BreakpointHit_IndexerAccessCondition()
        {
            int    i         = 10;
            string condition = $"testList[1] == \"List{i}1\"";

            using (var app = StartTestApp(debugEnabled: true))
            {
                Debuggee           debuggee   = Polling.GetDebuggee(app.Module, app.Version);
                DebuggerBreakpoint breakpoint = SetBreakpointAndSleep(
                    debuggee.Id, TestApplication.MainClass,
                    TestApplication.EchoBottomLine, condition);

                // Checks that the breakpoint has a condition.
                Assert.Equal(breakpoint.Condition, condition);

                using (HttpClient client = new HttpClient())
                {
                    await client.GetAsync(TestApplication.GetEchoUrl(app, i));
                }

                DebuggerBreakpoint newBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id);

                // Check that the breakpoint has been hit.
                Assert.True(newBp.IsFinalState);
            }
        }
示例#3
0
        public async Task BreakpointHit_MultipleExpressions()
        {
            string[] expressions = { "testList[3]", "testDictionary[\"Key103\"]" };
            using (var app = StartTestApp(debugEnabled: true, methodEvaluation: true))
            {
                Debuggee           debuggee   = Polling.GetDebuggee(app.Module, app.Version);
                DebuggerBreakpoint breakpoint = SetBreakpointAndSleep(
                    debuggee.Id, TestApplication.MainClass,
                    TestApplication.EchoBottomLine, null, expressions);

                // Checks that the breakpoint has evaluated expression.

                using (HttpClient client = new HttpClient())
                {
                    await client.GetAsync(TestApplication.GetEchoUrl(app, 10));
                }

                DebuggerBreakpoint newBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id);

                // Checks that the breakpoint has been hit.
                Assert.True(newBp.IsFinalState);

                // Checks that the expressions have correct values.
                Assert.Equal(2, newBp.EvaluatedExpressions.Count);
                Assert.Equal(expressions[1], newBp.EvaluatedExpressions[0].Name);
                Assert.Equal("3", newBp.EvaluatedExpressions[0].Value);

                Assert.Equal(expressions[0], newBp.EvaluatedExpressions[1].Name);
                Assert.Equal("List103", newBp.EvaluatedExpressions[1].Value);
            }
        }
示例#4
0
        public async Task BreakpointHit_IndexerAccessConditionFailed()
        {
            int    i         = 10;
            string condition = $"testList[1] == \"List{i}2\"";

            using (var app = StartTestApp(debugEnabled: true, methodEvaluation: true))
            {
                Debuggee           debuggee   = Polling.GetDebuggee(app.Module, app.Version);
                DebuggerBreakpoint breakpoint = SetBreakpointAndSleep(
                    debuggee.Id, TestApplication.MainClass,
                    TestApplication.EchoBottomLine, condition);

                // Checks that the breakpoint has a condition.
                Assert.Equal(breakpoint.Condition, condition);

                using (HttpClient client = new HttpClient())
                {
                    await client.GetAsync(TestApplication.GetEchoUrl(app, i));
                }

                Assert.Throws <TimeoutException>(() =>
                                                 Polling.GetBreakpoint(debuggee.Id, breakpoint.Id));
            }
        }