Esempio n. 1
0
 /// <summary>Snippet for MutateCustomer</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateCustomer()
 {
     // Create client
     CustomerServiceClient customerServiceClient = CustomerServiceClient.Create();
     // Initialize request argument(s)
     string            customerId = "";
     CustomerOperation operation  = new CustomerOperation();
     // Make the request
     MutateCustomerResponse response = customerServiceClient.MutateCustomer(customerId, operation);
 }
        /// <summary>Snippet for MutateCustomerAsync</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 MutateCustomerAsync()
        {
            // Create client
            CustomerServiceClient customerServiceClient = await CustomerServiceClient.CreateAsync();

            // Initialize request argument(s)
            string            customerId = "";
            CustomerOperation operation  = new CustomerOperation();
            // Make the request
            MutateCustomerResponse response = await customerServiceClient.MutateCustomerAsync(customerId, operation);
        }
        /// <summary>Snippet for MutateCustomerAsync</summary>
        public async Task MutateCustomerAsync()
        {
            // Snippet: MutateCustomerAsync(string, CustomerOperation, CallSettings)
            // Additional: MutateCustomerAsync(string, CustomerOperation, CancellationToken)
            // Create client
            CustomerServiceClient customerServiceClient = await CustomerServiceClient.CreateAsync();

            // Initialize request argument(s)
            string            customerId = "";
            CustomerOperation operation  = new CustomerOperation();
            // Make the request
            MutateCustomerResponse response = await customerServiceClient.MutateCustomerAsync(customerId, operation);

            // End snippet
        }
        public async Task MutateCustomerAsync2()
        {
            Mock <CustomerService.CustomerServiceClient> mockGrpcClient = new Mock <CustomerService.CustomerServiceClient>(MockBehavior.Strict);
            MutateCustomerRequest expectedRequest = new MutateCustomerRequest
            {
                CustomerId = "customerId-1772061412",
                Operation  = new CustomerOperation(),
            };
            MutateCustomerResponse expectedResponse = new MutateCustomerResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateCustomerResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomerServiceClient client      = new CustomerServiceClientImpl(mockGrpcClient.Object, null);
            string                 customerId = "customerId-1772061412";
            CustomerOperation      operation  = new CustomerOperation();
            MutateCustomerResponse response   = await client.MutateCustomerAsync(customerId, operation);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCustomer2()
        {
            Mock <CustomerService.CustomerServiceClient> mockGrpcClient = new Mock <CustomerService.CustomerServiceClient>(MockBehavior.Strict);
            MutateCustomerRequest expectedRequest = new MutateCustomerRequest
            {
                CustomerId = "customerId-1772061412",
                Operation  = new CustomerOperation(),
            };
            MutateCustomerResponse expectedResponse = new MutateCustomerResponse();

            mockGrpcClient.Setup(x => x.MutateCustomer(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomerServiceClient client      = new CustomerServiceClientImpl(mockGrpcClient.Object, null);
            string                 customerId = "customerId-1772061412";
            CustomerOperation      operation  = new CustomerOperation();
            MutateCustomerResponse response   = client.MutateCustomer(customerId, operation);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>
 /// Updates a customer. Operation statuses are returned.
 /// </summary>
 /// <param name="customerId">
 /// Required. The ID of the customer being modified.
 /// </param>
 /// <param name="operation">
 /// Required. The operation to perform on the customer
 /// </param>
 /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <MutateCustomerResponse> MutateCustomerAsync(string customerId, CustomerOperation operation, st::CancellationToken cancellationToken) =>
 MutateCustomerAsync(customerId, operation, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
 /// <summary>
 /// Updates a customer. Operation statuses are returned.
 /// </summary>
 /// <param name="customerId">
 /// Required. The ID of the customer being modified.
 /// </param>
 /// <param name="operation">
 /// Required. The operation to perform on the customer
 /// </param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <MutateCustomerResponse> MutateCustomerAsync(string customerId, CustomerOperation operation, gaxgrpc::CallSettings callSettings = null) =>
 MutateCustomerAsync(new MutateCustomerRequest
 {
     CustomerId = gax::GaxPreconditions.CheckNotNullOrEmpty(customerId, nameof(customerId)),
     Operation  = gax::GaxPreconditions.CheckNotNull(operation, nameof(operation)),
 }, callSettings);