public void SetUp() { var taskContext = new JoinableTaskContext(); mockBreakpointManager = Substitute.For <IBreakpointManager>(); mockBreakpointRequest = Substitute.For <IDebugBreakpointRequest2>(); mockProgram = Substitute.For <IDebugProgram2>(); mockResolution = Substitute.For <IDebugBreakpointResolution2>(); mockResolutionFactory = Substitute.For <DebugWatchpointResolution.Factory>(); mockResolutionFactory.Create(TEST_ADDRESS_STR, mockProgram).Returns(mockResolution); mockTarget = Substitute.For <RemoteTarget>(); SbError error; mockError = Substitute.For <SbError>(); mockTarget.WatchAddress(TEST_ADDRESS, WATCH_SIZE, false, true, out error).Returns(x => { x[4] = mockError; return(mockLldbWatchpoint); }); mockMarshal = Substitute.For <Marshal>(); mockMarshal.GetStringFromIntPtr(Arg.Any <IntPtr>()).Returns(TEST_ADDRESS_STR); mockLldbWatchpoint = Substitute.For <SbWatchpoint>(); requestInfo = new BP_REQUEST_INFO(); requestInfo.bpLocation.unionmember4 = (IntPtr)4; mockBreakpointRequest.GetRequestInfo(Arg.Any <enum_BPREQI_FIELDS>(), Arg.Any <BP_REQUEST_INFO[]>()).Returns(x => { enum_BPREQI_FIELDS fields = (enum_BPREQI_FIELDS)x[0]; BP_REQUEST_INFO[] breakpointRequestInfo = (BP_REQUEST_INFO[])x[1]; if (breakpointRequestInfo == null || breakpointRequestInfo.Length == 0) { return(1); } return(BuildBreakpointRequestInfo(fields, out breakpointRequestInfo[0])); }); mockLldbWatchpoint.GetId().Returns(EXPECTED_ID); SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_DATA_STRING); watchpointFactory = new DebugWatchpoint.Factory(taskContext, mockResolutionFactory, new BreakpointErrorEnumFactory(), new BoundBreakpointEnumFactory()); watchpoint = watchpointFactory.Create(mockBreakpointManager, mockBreakpointRequest, mockTarget, mockProgram, mockMarshal); }
public void SetUp() { taskContext = new JoinableTaskContext(); mockBreakpointRequest = Substitute.For <IDebugBreakpointRequest2>(); mockTarget = Substitute.For <RemoteTarget>(); mockProgram = Substitute.For <IGgpDebugProgram>(); mockPendingBreakpoint = Substitute.For <IPendingBreakpoint>(); mockPendingBreakpoint.GetId().Returns(ID); mockWatchpoint = Substitute.For <IWatchpoint>(); mockWatchpoint.GetId().Returns(ID); mockPendingBreakpointFactory = Substitute.For <DebugPendingBreakpoint.Factory>(); mockWatchpointFactory = Substitute.For <DebugWatchpoint.Factory>(); var mockDebugEngineHandler = Substitute.For <IDebugEngineHandler>(); breakpointManager = new LldbBreakpointManager.Factory(taskContext, mockPendingBreakpointFactory, mockWatchpointFactory).Create(mockDebugEngineHandler, mockProgram); mockPendingBreakpointFactory.Create(breakpointManager, mockProgram, mockBreakpointRequest, mockTarget).ReturnsForAnyArgs(mockPendingBreakpoint); mockWatchpointFactory.Create(breakpointManager, mockBreakpointRequest, mockTarget, mockProgram).ReturnsForAnyArgs(mockWatchpoint); }