/// <summary>Snippet for GetCustomerClient</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetCustomerClientResourceNames() { // Create client CustomerClientServiceClient customerClientServiceClient = CustomerClientServiceClient.Create(); // Initialize request argument(s) CustomerClientName resourceName = CustomerClientName.FromCustomerClientCustomer("[CUSTOMER_ID]", "[CLIENT_CUSTOMER_ID]"); // Make the request CustomerClient response = customerClientServiceClient.GetCustomerClient(resourceName); }
/// <summary>Snippet for GetCustomerClientAsync</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 GetCustomerClientResourceNamesAsync() { // Create client CustomerClientServiceClient customerClientServiceClient = await CustomerClientServiceClient.CreateAsync(); // Initialize request argument(s) CustomerClientName resourceName = CustomerClientName.FromCustomerClientCustomer("[CUSTOMER_ID]", "[CLIENT_CUSTOMER_ID]"); // Make the request CustomerClient response = await customerClientServiceClient.GetCustomerClientAsync(resourceName); }
/// <summary>Snippet for GetCustomerClient</summary> public void GetCustomerClientResourceNames() { // Snippet: GetCustomerClient(CustomerClientName, CallSettings) // Create client CustomerClientServiceClient customerClientServiceClient = CustomerClientServiceClient.Create(); // Initialize request argument(s) CustomerClientName resourceName = CustomerClientName.FromCustomerCustomerClient("[CUSTOMER]", "[CUSTOMER_CLIENT]"); // Make the request CustomerClient response = customerClientServiceClient.GetCustomerClient(resourceName); // End snippet }
/// <summary>Snippet for GetCustomerClient</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetCustomerClientRequestObject() { // Create client CustomerClientServiceClient customerClientServiceClient = CustomerClientServiceClient.Create(); // Initialize request argument(s) GetCustomerClientRequest request = new GetCustomerClientRequest { ResourceNameAsCustomerClientName = CustomerClientName.FromCustomerCustomerClient("[CUSTOMER]", "[CUSTOMER_CLIENT]"), }; // Make the request CustomerClient response = customerClientServiceClient.GetCustomerClient(request); }
/// <summary>Snippet for GetCustomerClient</summary> public void GetCustomerClientRequestObject() { // Snippet: GetCustomerClient(GetCustomerClientRequest, CallSettings) // Create client CustomerClientServiceClient customerClientServiceClient = CustomerClientServiceClient.Create(); // Initialize request argument(s) GetCustomerClientRequest request = new GetCustomerClientRequest { ResourceNameAsCustomerClientName = CustomerClientName.FromCustomerClientCustomer("[CUSTOMER_ID]", "[CLIENT_CUSTOMER_ID]"), }; // Make the request CustomerClient response = customerClientServiceClient.GetCustomerClient(request); // End snippet }
/// <summary>Snippet for GetCustomerClientAsync</summary> public async Task GetCustomerClientResourceNamesAsync() { // Snippet: GetCustomerClientAsync(CustomerClientName, CallSettings) // Additional: GetCustomerClientAsync(CustomerClientName, CancellationToken) // Create client CustomerClientServiceClient customerClientServiceClient = await CustomerClientServiceClient.CreateAsync(); // Initialize request argument(s) CustomerClientName resourceName = CustomerClientName.FromCustomerClientCustomer("[CUSTOMER_ID]", "[CLIENT_CUSTOMER_ID]"); // Make the request CustomerClient response = await customerClientServiceClient.GetCustomerClientAsync(resourceName); // End snippet }
/// <summary>Snippet for GetCustomerClientAsync</summary> public async Task GetCustomerClientRequestObjectAsync() { // Snippet: GetCustomerClientAsync(GetCustomerClientRequest, CallSettings) // Additional: GetCustomerClientAsync(GetCustomerClientRequest, CancellationToken) // Create client CustomerClientServiceClient customerClientServiceClient = await CustomerClientServiceClient.CreateAsync(); // Initialize request argument(s) GetCustomerClientRequest request = new GetCustomerClientRequest { ResourceNameAsCustomerClientName = CustomerClientName.FromCustomerCustomerClient("[CUSTOMER]", "[CUSTOMER_CLIENT]"), }; // Make the request CustomerClient response = await customerClientServiceClient.GetCustomerClientAsync(request); // End snippet }
public async Task GetCustomerClientAsync() { Mock <CustomerClientService.CustomerClientServiceClient> mockGrpcClient = new Mock <CustomerClientService.CustomerClientServiceClient>(MockBehavior.Strict); GetCustomerClientRequest expectedRequest = new GetCustomerClientRequest { ResourceName = new CustomerClientName("[CUSTOMER]", "[CUSTOMER_CLIENT]").ToString(), }; CustomerClient expectedResponse = new CustomerClient { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetCustomerClientAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <CustomerClient>(Task.FromResult(expectedResponse), null, null, null, null)); CustomerClientServiceClient client = new CustomerClientServiceClientImpl(mockGrpcClient.Object, null); string formattedResourceName = new CustomerClientName("[CUSTOMER]", "[CUSTOMER_CLIENT]").ToString(); CustomerClient response = await client.GetCustomerClientAsync(formattedResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }