Beispiel #1
0
        public async stt::Task PatchTracesAsync()
        {
            moq::Mock <TraceService.TraceServiceClient> mockGrpcClient = new moq::Mock <TraceService.TraceServiceClient>(moq::MockBehavior.Strict);
            PatchTracesRequest request = new PatchTracesRequest
            {
                ProjectId = "project_id43ad98b0",
                Traces    = new Traces(),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.PatchTracesAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            TraceServiceClient client = new TraceServiceClientImpl(mockGrpcClient.Object, null);
            await client.PatchTracesAsync(request.ProjectId, request.Traces, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.PatchTracesAsync(request.ProjectId, request.Traces, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }
        public async Task PatchTracesAsync2()
        {
            Mock <TraceService.TraceServiceClient> mockGrpcClient = new Mock <TraceService.TraceServiceClient>(MockBehavior.Strict);
            PatchTracesRequest request = new PatchTracesRequest
            {
                ProjectId = "projectId-1969970175",
                Traces    = new Traces(),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.PatchTracesAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            TraceServiceClient client = new TraceServiceClientImpl(mockGrpcClient.Object, null);
            await client.PatchTracesAsync(request);

            mockGrpcClient.VerifyAll();
        }