public void HandleEventInvalidBoundBreakpoint()
        {
            // Return null and false for all bound breakpoints on the pending breakpoint.
            _mockPendingBreakpoint1.GetBoundBreakpointById(Arg.Any <int>(), out IBoundBreakpoint _)
            .ReturnsForAnyArgs(x => {
                x[1] = null;
                return(false);
            });

            // We want to inspect the BreakpointEvent further, so capture it when OnSendEvent is
            // called.
            BreakpointEvent resultEvent = null;

            _mockDebugEngineHandler.SendEvent(
                Arg.Do(delegate(DebugEvent x) { resultEvent = (BreakpointEvent)x; }), _mockProgram,
                _mockRemoteThread);

            _mockDebugEngineHandler.SendEvent(Arg.Is <DebugEvent>(x => x is BreakpointEvent),
                                              _mockProgram, _mockRemoteThread);

            RaiseSingleStateChanged();

            AssertBreakpointEvent(resultEvent,
                                  new List <IDebugBoundBreakpoint2> {
                _mockBoundBreakpoint1
            });
        }
        public void GetBoundBreakpointById()
        {
            IBoundBreakpoint boundBreakpoint;
            bool             result = pendingBreakpoint.GetBoundBreakpointById(
                BOUND_BREAKPOINT_ID, out boundBreakpoint);

            Assert.IsFalse(result);
            MockBreakpoint(1);
            MockDocumentPosition(TEST_FILE_NAME, LINE_NUMBER, COLUMN_NUMBER);
            pendingBreakpoint.Bind();
            result = pendingBreakpoint.GetBoundBreakpointById(
                BOUND_BREAKPOINT_ID, out boundBreakpoint);
            Assert.IsTrue(result);
            Assert.AreEqual(BOUND_BREAKPOINT_ID, boundBreakpoint.GetId());
        }
        void MockBreakpointManager()
        {
            // NSubstitute will try to match the value of the out parameter if you just use
            // 'Returns'.  Since we have no way of resetting the value of pendingBreakpoint between
            // calls in the same test (since this happens in real code), we have to return for all
            // args, and do the argument matching ourselves.
            _mockBreakpointManager.GetPendingBreakpointById(Arg.Any <int>(), out var _)
            .ReturnsForAnyArgs(x => {
                int id = (int)x[0];
                switch (id)
                {
                case 1:
                    x[1] = _mockPendingBreakpoint1;
                    return(true);

                case 2:
                    x[1] = _mockPendingBreakpoint2;
                    return(true);

                default:
                    x[1] = null;
                    return(false);
                }
            });

            _mockPendingBreakpoint1.GetBoundBreakpointById(Arg.Any <int>(), out var _)
            .ReturnsForAnyArgs(x => {
                int id = (int)x[0];
                switch (id)
                {
                case 2:
                    x[1] = _mockBoundBreakpoint2;
                    return(true);

                case 3:
                    x[1] = _mockBoundBreakpoint3;
                    return(true);

                default:
                    x[1] = null;
                    return(false);
                }
            });
            _mockPendingBreakpoint2.GetBoundBreakpointById(Arg.Any <int>(), out var _)
            .ReturnsForAnyArgs(x => {
                int id = (int)x[0];
                switch (id)
                {
                case 1:
                    x[1] = _mockBoundBreakpoint1;
                    return(true);

                default:
                    x[1] = null;
                    return(false);
                }
            });
        }