Esempio n. 1
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();
        }
        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();
        }