public async stt::Task ListActiveBreakpointsRequestObjectAsync() { moq::Mock <Controller2.Controller2Client> mockGrpcClient = new moq::Mock <Controller2.Controller2Client>(moq::MockBehavior.Strict); ListActiveBreakpointsRequest request = new ListActiveBreakpointsRequest { DebuggeeId = "debuggee_id454a924a", WaitToken = "wait_tokencb600154", SuccessOnTimeout = false, }; ListActiveBreakpointsResponse expectedResponse = new ListActiveBreakpointsResponse { Breakpoints = { new Breakpoint(), }, NextWaitToken = "next_wait_token2855eb7e", WaitExpired = false, }; mockGrpcClient.Setup(x => x.ListActiveBreakpointsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ListActiveBreakpointsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); Controller2Client client = new Controller2ClientImpl(mockGrpcClient.Object, null); ListActiveBreakpointsResponse responseCallSettings = await client.ListActiveBreakpointsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ListActiveBreakpointsResponse responseCancellationToken = await client.ListActiveBreakpointsAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task ListActiveBreakpointsAsync2() { Mock <Controller2.Controller2Client> mockGrpcClient = new Mock <Controller2.Controller2Client>(MockBehavior.Strict); ListActiveBreakpointsRequest request = new ListActiveBreakpointsRequest { DebuggeeId = "debuggeeId-997255898", }; ListActiveBreakpointsResponse expectedResponse = new ListActiveBreakpointsResponse { NextWaitToken = "nextWaitToken1006864251", WaitExpired = false, }; mockGrpcClient.Setup(x => x.ListActiveBreakpointsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ListActiveBreakpointsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); Controller2Client client = new Controller2ClientImpl(mockGrpcClient.Object, null); ListActiveBreakpointsResponse response = await client.ListActiveBreakpointsAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }