public async stt::Task MutateBatchJobRequestObjectAsync() { moq::Mock <BatchJobService.BatchJobServiceClient> mockGrpcClient = new moq::Mock <BatchJobService.BatchJobServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); MutateBatchJobRequest request = new MutateBatchJobRequest { CustomerId = "customer_id3b3724cb", Operation = new BatchJobOperation(), }; MutateBatchJobResponse expectedResponse = new MutateBatchJobResponse { Result = new MutateBatchJobResult(), }; mockGrpcClient.Setup(x => x.MutateBatchJobAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateBatchJobResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); BatchJobServiceClient client = new BatchJobServiceClientImpl(mockGrpcClient.Object, null); MutateBatchJobResponse responseCallSettings = await client.MutateBatchJobAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); MutateBatchJobResponse responseCancellationToken = await client.MutateBatchJobAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for MutateBatchJob</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateBatchJobRequestObject() { // Create client BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.Create(); // Initialize request argument(s) MutateBatchJobRequest request = new MutateBatchJobRequest { CustomerId = "", Operation = new BatchJobOperation(), }; // Make the request MutateBatchJobResponse response = batchJobServiceClient.MutateBatchJob(request); }
/// <summary>Snippet for MutateBatchJobAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task MutateBatchJobRequestObjectAsync() { // Create client BatchJobServiceClient batchJobServiceClient = await BatchJobServiceClient.CreateAsync(); // Initialize request argument(s) MutateBatchJobRequest request = new MutateBatchJobRequest { CustomerId = "", Operation = new BatchJobOperation(), }; // Make the request MutateBatchJobResponse response = await batchJobServiceClient.MutateBatchJobAsync(request); }
/// <summary>Snippet for MutateBatchJobAsync</summary> public async Task MutateBatchJobRequestObjectAsync() { // Snippet: MutateBatchJobAsync(MutateBatchJobRequest, CallSettings) // Additional: MutateBatchJobAsync(MutateBatchJobRequest, CancellationToken) // Create client BatchJobServiceClient batchJobServiceClient = await BatchJobServiceClient.CreateAsync(); // Initialize request argument(s) MutateBatchJobRequest request = new MutateBatchJobRequest { CustomerId = "", Operation = new BatchJobOperation(), }; // Make the request MutateBatchJobResponse response = await batchJobServiceClient.MutateBatchJobAsync(request); // End snippet }
public void MutateBatchJob() { moq::Mock <BatchJobService.BatchJobServiceClient> mockGrpcClient = new moq::Mock <BatchJobService.BatchJobServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); MutateBatchJobRequest request = new MutateBatchJobRequest { CustomerId = "customer_id3b3724cb", Operation = new BatchJobOperation(), }; MutateBatchJobResponse expectedResponse = new MutateBatchJobResponse { Result = new MutateBatchJobResult(), }; mockGrpcClient.Setup(x => x.MutateBatchJob(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); BatchJobServiceClient client = new BatchJobServiceClientImpl(mockGrpcClient.Object, null); MutateBatchJobResponse response = client.MutateBatchJob(request.CustomerId, request.Operation); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }