Exemplo n.º 1
0
        public async stt::Task SetBreakpointRequestObjectAsync()
        {
            moq::Mock <Debugger2.Debugger2Client> mockGrpcClient = new moq::Mock <Debugger2.Debugger2Client>(moq::MockBehavior.Strict);
            SetBreakpointRequest request = new SetBreakpointRequest
            {
                DebuggeeId    = "debuggee_id454a924a",
                Breakpoint    = new Breakpoint(),
                ClientVersion = "client_version92be8ead",
            };
            SetBreakpointResponse expectedResponse = new SetBreakpointResponse
            {
                Breakpoint = new Breakpoint(),
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            SetBreakpointResponse responseCancellationToken = await client.SetBreakpointAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async Task SetBreakpointAsync2()
        {
            Mock <Debugger2.Debugger2Client> mockGrpcClient = new Mock <Debugger2.Debugger2Client>(MockBehavior.Strict);
            SetBreakpointRequest             request        = new SetBreakpointRequest
            {
                DebuggeeId    = "debuggeeId-997255898",
                Breakpoint    = new Breakpoint(),
                ClientVersion = "clientVersion-1506231196",
            };
            SetBreakpointResponse expectedResponse = new SetBreakpointResponse();

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

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }