예제 #1
0
 /// <summary>Snippet for GetBreakpoint</summary>
 public void GetBreakpoint_RequestObject()
 {
     // Snippet: GetBreakpoint(GetBreakpointRequest,CallSettings)
     // Create client
     Debugger2Client debugger2Client = Debugger2Client.Create();
     // Initialize request argument(s)
     GetBreakpointRequest request = new GetBreakpointRequest
     {
         DebuggeeId    = "",
         BreakpointId  = "",
         ClientVersion = "",
     };
     // Make the request
     GetBreakpointResponse response = debugger2Client.GetBreakpoint(request);
     // End snippet
 }
        /// <summary>
        /// Gets a <see cref="Debugger.V2.Breakpoint"/>.
        /// </summary>
        /// <param name="debuggeeId">The debuggee id for the breakpoint.</param>
        /// <param name="breakpointId">The id of the breakpoint.</param>
        /// <param name="isFinal">Optional, defaults to true.  If true the method will only return the
        ///     breakpoint when it's final.</param>
        public Debugger.V2.Breakpoint GetBreakpoint(string debuggeeId, string breakpointId, bool isFinal = true)
        {
            Predicate <Debugger.V2.Breakpoint> predicate = (breakpoint)
                                                           => isFinal ? breakpoint?.IsFinalState ?? false : breakpoint != null;

            Func <Debugger.V2.Breakpoint> func = () => {
                GetBreakpointRequest request = new GetBreakpointRequest
                {
                    DebuggeeId   = debuggeeId,
                    BreakpointId = breakpointId,
                };

                return(Client.GrpcClient.GetBreakpoint(request).Breakpoint);
            };

            return(Poll(func, predicate));
        }
        public override Task <GetBreakpointResponse> GetBreakpoint(
            GetBreakpointRequest request, ServerCallContext context)
        {
            var location   = GetBreakpointLocation(request.BreakpointLocation);
            var response   = new GetBreakpointResponse();
            var breakpoint = location.GetBreakpoint();

            if (breakpoint != null)
            {
                response.Result = new GrpcSbBreakpoint
                {
                    Target = request.BreakpointLocation.Breakpoint.Target,
                    Id     = breakpoint.GetId(),
                };
            }
            return(Task.FromResult(response));
        }
예제 #4
0
        /// <summary>Snippet for GetBreakpointAsync</summary>
        public async Task GetBreakpointAsync_RequestObject()
        {
            // Snippet: GetBreakpointAsync(GetBreakpointRequest,CallSettings)
            // Additional: GetBreakpointAsync(GetBreakpointRequest,CancellationToken)
            // Create client
            Debugger2Client debugger2Client = await Debugger2Client.CreateAsync();

            // Initialize request argument(s)
            GetBreakpointRequest request = new GetBreakpointRequest
            {
                DebuggeeId    = "",
                BreakpointId  = "",
                ClientVersion = "",
            };
            // Make the request
            GetBreakpointResponse response = await debugger2Client.GetBreakpointAsync(request);

            // End snippet
        }
        public async Task GetBreakpointAsync2()
        {
            Mock <Debugger2.Debugger2Client> mockGrpcClient = new Mock <Debugger2.Debugger2Client>(MockBehavior.Strict);
            GetBreakpointRequest             request        = new GetBreakpointRequest
            {
                DebuggeeId    = "debuggeeId-997255898",
                BreakpointId  = "breakpointId498424873",
                ClientVersion = "clientVersion-1506231196",
            };
            GetBreakpointResponse expectedResponse = new GetBreakpointResponse();

            mockGrpcClient.Setup(x => x.GetBreakpointAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <GetBreakpointResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            Debugger2Client       client   = new Debugger2ClientImpl(mockGrpcClient.Object, null);
            GetBreakpointResponse response = await client.GetBreakpointAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetBreakpoint2()
        {
            Mock <Debugger2.Debugger2Client> mockGrpcClient = new Mock <Debugger2.Debugger2Client>(MockBehavior.Strict);
            GetBreakpointRequest             request        = new GetBreakpointRequest
            {
                DebuggeeId    = "debuggeeId-997255898",
                BreakpointId  = "breakpointId498424873",
                ClientVersion = "clientVersion-1506231196",
            };
            GetBreakpointResponse expectedResponse = new GetBreakpointResponse();

            mockGrpcClient.Setup(x => x.GetBreakpoint(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            Debugger2Client       client   = new Debugger2ClientImpl(mockGrpcClient.Object, null);
            GetBreakpointResponse response = client.GetBreakpoint(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #7
0
        public void GetBreakpoint()
        {
            moq::Mock <Debugger2.Debugger2Client> mockGrpcClient = new moq::Mock <Debugger2.Debugger2Client>(moq::MockBehavior.Strict);
            GetBreakpointRequest request = new GetBreakpointRequest
            {
                DebuggeeId    = "debuggee_id454a924a",
                BreakpointId  = "breakpoint_id5b0a5ee2",
                ClientVersion = "client_version92be8ead",
            };
            GetBreakpointResponse expectedResponse = new GetBreakpointResponse
            {
                Breakpoint = new Breakpoint(),
            };

            mockGrpcClient.Setup(x => x.GetBreakpoint(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            Debugger2Client       client   = new Debugger2ClientImpl(mockGrpcClient.Object, null);
            GetBreakpointResponse response = client.GetBreakpoint(request.DebuggeeId, request.BreakpointId, request.ClientVersion);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #8
0
        public async stt::Task GetBreakpointAsync()
        {
            moq::Mock <Debugger2.Debugger2Client> mockGrpcClient = new moq::Mock <Debugger2.Debugger2Client>(moq::MockBehavior.Strict);
            GetBreakpointRequest request = new GetBreakpointRequest
            {
                DebuggeeId    = "debuggee_id454a924a",
                BreakpointId  = "breakpoint_id5b0a5ee2",
                ClientVersion = "client_version92be8ead",
            };
            GetBreakpointResponse expectedResponse = new GetBreakpointResponse
            {
                Breakpoint = new Breakpoint(),
            };

            mockGrpcClient.Setup(x => x.GetBreakpointAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GetBreakpointResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            Debugger2Client       client = new Debugger2ClientImpl(mockGrpcClient.Object, null);
            GetBreakpointResponse responseCallSettings = await client.GetBreakpointAsync(request.DebuggeeId, request.BreakpointId, request.ClientVersion, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            GetBreakpointResponse responseCancellationToken = await client.GetBreakpointAsync(request.DebuggeeId, request.BreakpointId, request.ClientVersion, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }