public void SetUp() { var taskContext = new JoinableTaskContext(); mockBreakpointManager = Substitute.For <IBreakpointManager>(); mockBreakpointRequest = Substitute.For <IDebugBreakpointRequest2>(); mockTarget = Substitute.For <RemoteTarget>(); mockProgram = Substitute.For <IDebugProgram2>(); mockMarshal = Substitute.For <Marshal>(); mockLldbBreakpoint = Substitute.For <RemoteBreakpoint>(); requestInfo = new BP_REQUEST_INFO(); 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])); }); mockLldbBreakpoint.GetId().Returns(EXPECTED_ID); SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE); mockBoundBreakpointFactory = Substitute.For <DebugBoundBreakpoint.Factory>(); debugPendingBreakpointFactory = new DebugPendingBreakpoint.Factory(taskContext, mockBoundBreakpointFactory, new BreakpointErrorEnumFactory(), new BoundBreakpointEnumFactory()); pendingBreakpoint = debugPendingBreakpointFactory.Create( mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget, mockMarshal); }
public void SetUp() { string name = ""; mockBreakpoint = Substitute.For <RemoteBreakpoint>(); lineEntry = new LineEntryInfo(); mockPendingBreakpoint = Substitute.For <IDebugPendingBreakpoint2>(); mockBreakpointLocation = Substitute.For <SbBreakpointLocation>(); mockAddress = Substitute.For <SbAddress>(); mockAddress.GetLineEntry().Returns(lineEntry); mockBreakpointLocation.GetHitCount().Returns(HIT_COUNT); mockBreakpointLocation.GetLoadAddress().Returns(ADDRESS); mockBreakpointLocation.GetBreakpoint().Returns(mockBreakpoint); mockBreakpointLocation.GetId().Returns(ID); mockBreakpointLocation.GetAddress().Returns(mockAddress); mockprogram = Substitute.For <IDebugProgram2>(); mockDocumentContext = Substitute.For <IDebugDocumentContext2>(); mockDocumentContext.GetName(enum_GETNAME_TYPE.GN_NAME, out name).Returns( x => { x[1] = NAME; return(VSConstants.S_OK); }); mockBreakpointResolution = Substitute.For <IDebugBreakpointResolution2>(); mockDocumentContextFactory = Substitute.For <DebugDocumentContext.Factory>(); mockDocumentContextFactory.Create(lineEntry).Returns(mockDocumentContext); mockCodeContext = Substitute.For <IDebugCodeContext2>(); mockCodeContextFactory = Substitute.For <DebugCodeContext.Factory>(); mockCodeContextFactory.Create(ADDRESS, NAME, mockDocumentContext, Guid.Empty).Returns(mockCodeContext); mockBreakpointResolutionFactory = Substitute.For <DebugBreakpointResolution.Factory>(); mockBreakpointResolutionFactory.Create(mockCodeContext, mockprogram).Returns( mockBreakpointResolution); boundBreakpointFactory = new DebugBoundBreakpoint.Factory(mockDocumentContextFactory, mockCodeContextFactory, mockBreakpointResolutionFactory); boundBreakpoint = boundBreakpointFactory.Create( mockPendingBreakpoint, mockBreakpointLocation, mockprogram, Guid.Empty); }