public void BindWatchpoint()
        {
            SbError error;

            Assert.AreEqual(VSConstants.S_OK, watchpoint.Bind());
            mockLldbWatchpoint.Received(1).SetEnabled(true);
            mockTarget.Received(1).WatchAddress(TEST_ADDRESS, WATCH_SIZE, false, true, out error);
            mockBreakpointManager.Received(1).RegisterWatchpoint(watchpoint);
            IEnumDebugBoundBreakpoints2 enumBoundBreakpoints;

            watchpoint.EnumBoundBreakpoints(out enumBoundBreakpoints);
            uint countBoundBreakpoint;

            enumBoundBreakpoints.GetCount(out countBoundBreakpoint);
            Assert.AreEqual(1, countBoundBreakpoint);
            IDebugBoundBreakpoint2[] boundBreakpoint = new IDebugBoundBreakpoint2[1];
            uint actualCount = 0;

            enumBoundBreakpoints.Next(1, boundBreakpoint, ref actualCount);
            Assert.AreEqual(watchpoint, boundBreakpoint[0]);
        }
        public void BindUnsupportedType()
        {
            // Set a unsupported breakpoint type and create a new pending watchpoint.
            SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_NONE);
            watchpoint = watchpointFactory.Create(mockBreakpointManager, mockBreakpointRequest,
                                                  mockTarget, mockProgram, mockMarshal);

            var result = watchpoint.Bind();
            IDebugErrorBreakpoint2 breakpointError = GetWatchpointError();

            mockBreakpointManager.Received().ReportBreakpointError(
                Arg.Any <DebugBreakpointError>());
            Assert.AreNotEqual(null, breakpointError);
            Assert.AreEqual(VSConstants.S_FALSE, result);
        }
        public void BindPassCountEqualOrGreater()
        {
            const uint PASS_COUNT = 3u;

            SetPassCount(enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_EQUAL_OR_GREATER, PASS_COUNT);
            watchpoint = watchpointFactory.Create(mockBreakpointManager, mockBreakpointRequest,
                                                  mockTarget, mockProgram, mockMarshal);
            var result = watchpoint.Bind();
            IDebugErrorBreakpoint2 watchpointError = GetWatchpointError();

            mockBreakpointManager.Received().RegisterWatchpoint(watchpoint);
            Assert.AreEqual(null, watchpointError);
            Assert.AreEqual(VSConstants.S_OK, result);
            mockLldbWatchpoint.Received(1).SetIgnoreCount(PASS_COUNT - 1);
        }
        public void BindCondition()
        {
            const string testCondition = "true";

            SetCondition(enum_BP_COND_STYLE.BP_COND_WHEN_TRUE, testCondition);
            watchpoint = watchpointFactory.Create(mockBreakpointManager, mockBreakpointRequest,
                                                  mockTarget, mockProgram, mockMarshal);
            var result = watchpoint.Bind();
            IDebugErrorBreakpoint2 watchpointError = GetWatchpointError();

            mockBreakpointManager.Received().RegisterWatchpoint(watchpoint);
            Assert.AreEqual(null, watchpointError);
            Assert.AreEqual(VSConstants.S_OK, result);
            mockLldbWatchpoint.Received(1).SetCondition(testCondition);
        }
        public void BindPassCountMod()
        {
            const uint PASS_COUNT = 5u;
            const uint HIT_COUNT  = 6u;

            SetPassCount(enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_MOD, PASS_COUNT);
            watchpoint = watchpointFactory.Create(mockBreakpointManager, mockBreakpointRequest,
                                                  mockTarget, mockProgram, mockMarshal);
            mockLldbWatchpoint.GetHitCount().Returns(HIT_COUNT);

            var result = watchpoint.Bind();
            IDebugErrorBreakpoint2 watchpointError = GetWatchpointError();

            mockBreakpointManager.Received().RegisterWatchpoint(watchpoint);
            Assert.AreEqual(null, watchpointError);
            Assert.AreEqual(VSConstants.S_OK, result);
            mockLldbWatchpoint.Received().SetIgnoreCount(9u);
        }