示例#1
0
        /// <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 GetCustomerClientRequestObjectAsync()
        {
            // Create client
            CustomerClientServiceClient customerClientServiceClient = await CustomerClientServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetCustomerClientRequest request = new GetCustomerClientRequest
            {
                ResourceNameAsCustomerClientName = CustomerClientName.FromCustomerClientCustomer("[CUSTOMER_ID]", "[CLIENT_CUSTOMER_ID]"),
            };
            // Make the request
            CustomerClient response = await customerClientServiceClient.GetCustomerClientAsync(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 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.FromCustomerClientCustomer("[CUSTOMER_ID]", "[CLIENT_CUSTOMER_ID]"),
            };
            // Make the request
            CustomerClient response = await customerClientServiceClient.GetCustomerClientAsync(request);

            // End snippet
        }
示例#4
0
        public void GetCustomerClient2()
        {
            Mock <CustomerClientService.CustomerClientServiceClient> mockGrpcClient = new Mock <CustomerClientService.CustomerClientServiceClient>(MockBehavior.Strict);
            GetCustomerClientRequest request = new GetCustomerClientRequest
            {
                ResourceName = new CustomerClientName("[CUSTOMER]", "[CUSTOMER_CLIENT]").ToString(),
            };
            CustomerClient expectedResponse = new CustomerClient
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCustomerClient(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomerClientServiceClient client = new CustomerClientServiceClientImpl(mockGrpcClient.Object, null);
            CustomerClient response            = client.GetCustomerClient(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#5
0
        public async Task GetCustomerClientAsync2()
        {
            Mock <CustomerClientService.CustomerClientServiceClient> mockGrpcClient = new Mock <CustomerClientService.CustomerClientServiceClient>(MockBehavior.Strict);
            GetCustomerClientRequest request = new GetCustomerClientRequest
            {
                ResourceName = new CustomerClientName("[CUSTOMER]", "[CUSTOMER_CLIENT]").ToString(),
            };
            CustomerClient expectedResponse = new CustomerClient
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCustomerClientAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CustomerClient>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomerClientServiceClient client = new CustomerClientServiceClientImpl(mockGrpcClient.Object, null);
            CustomerClient response            = await client.GetCustomerClientAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }