/// <summary>Snippet for GetCustomerLabel</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetCustomerLabelRequestObject() { // Create client CustomerLabelServiceClient customerLabelServiceClient = CustomerLabelServiceClient.Create(); // Initialize request argument(s) GetCustomerLabelRequest request = new GetCustomerLabelRequest { ResourceNameAsCustomerLabelName = CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"), }; // Make the request CustomerLabel response = customerLabelServiceClient.GetCustomerLabel(request); }
/// <summary>Snippet for GetCustomerLabelAsync</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 GetCustomerLabelRequestObjectAsync() { // Create client CustomerLabelServiceClient customerLabelServiceClient = await CustomerLabelServiceClient.CreateAsync(); // Initialize request argument(s) GetCustomerLabelRequest request = new GetCustomerLabelRequest { ResourceNameAsCustomerLabelName = CustomerLabelName.FromCustomerLabel("[CUSTOMER_ID]", "[LABEL_ID]"), }; // Make the request CustomerLabel response = await customerLabelServiceClient.GetCustomerLabelAsync(request); }
/// <summary>Snippet for GetCustomerLabel</summary> public void GetCustomerLabelRequestObject() { // Snippet: GetCustomerLabel(GetCustomerLabelRequest, CallSettings) // Create client CustomerLabelServiceClient customerLabelServiceClient = CustomerLabelServiceClient.Create(); // Initialize request argument(s) GetCustomerLabelRequest request = new GetCustomerLabelRequest { ResourceNameAsCustomerLabelName = CustomerLabelName.FromCustomerLabel("[CUSTOMER_ID]", "[LABEL_ID]"), }; // Make the request CustomerLabel response = customerLabelServiceClient.GetCustomerLabel(request); // End snippet }
/// <summary>Snippet for GetCustomerLabelAsync</summary> public async Task GetCustomerLabelRequestObjectAsync() { // Snippet: GetCustomerLabelAsync(GetCustomerLabelRequest, CallSettings) // Additional: GetCustomerLabelAsync(GetCustomerLabelRequest, CancellationToken) // Create client CustomerLabelServiceClient customerLabelServiceClient = await CustomerLabelServiceClient.CreateAsync(); // Initialize request argument(s) GetCustomerLabelRequest request = new GetCustomerLabelRequest { ResourceNameAsCustomerLabelName = CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"), }; // Make the request CustomerLabel response = await customerLabelServiceClient.GetCustomerLabelAsync(request); // End snippet }
public void GetCustomerLabel2() { Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new Mock <CustomerLabelService.CustomerLabelServiceClient>(MockBehavior.Strict); GetCustomerLabelRequest request = new GetCustomerLabelRequest { ResourceName = new CustomerLabelName("[CUSTOMER]", "[CUSTOMER_LABEL]").ToString(), }; CustomerLabel expectedResponse = new CustomerLabel { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetCustomerLabel(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); CustomerLabelServiceClient client = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null); CustomerLabel response = client.GetCustomerLabel(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetCustomerLabelAsync2() { Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new Mock <CustomerLabelService.CustomerLabelServiceClient>(MockBehavior.Strict); GetCustomerLabelRequest request = new GetCustomerLabelRequest { ResourceName = new CustomerLabelName("[CUSTOMER]", "[CUSTOMER_LABEL]").ToString(), }; CustomerLabel expectedResponse = new CustomerLabel { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetCustomerLabelAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <CustomerLabel>(Task.FromResult(expectedResponse), null, null, null, null)); CustomerLabelServiceClient client = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null); CustomerLabel response = await client.GetCustomerLabelAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetCustomerLabel() { moq::Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new moq::Mock <CustomerLabelService.CustomerLabelServiceClient>(moq::MockBehavior.Strict); GetCustomerLabelRequest request = new GetCustomerLabelRequest { ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"), }; gagvr::CustomerLabel expectedResponse = new gagvr::CustomerLabel { ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"), Customer = "customer931fec91", Label = "label20ba04d3", }; mockGrpcClient.Setup(x => x.GetCustomerLabel(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CustomerLabelServiceClient client = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null); gagvr::CustomerLabel response = client.GetCustomerLabel(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetCustomerLabelRequestObject() { moq::Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new moq::Mock <CustomerLabelService.CustomerLabelServiceClient>(moq::MockBehavior.Strict); GetCustomerLabelRequest request = new GetCustomerLabelRequest { ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"), }; gagvr::CustomerLabel expectedResponse = new gagvr::CustomerLabel { ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"), CustomerAsCustomerName = gagvr::CustomerName.FromCustomer("[CUSTOMER]"), LabelAsLabelName = gagvr::LabelName.FromCustomerLabel("[CUSTOMER]", "[LABEL]"), }; mockGrpcClient.Setup(x => x.GetCustomerLabel(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CustomerLabelServiceClient client = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null); gagvr::CustomerLabel response = client.GetCustomerLabel(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetCustomerLabelRequestObjectAsync() { moq::Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new moq::Mock <CustomerLabelService.CustomerLabelServiceClient>(moq::MockBehavior.Strict); GetCustomerLabelRequest request = new GetCustomerLabelRequest { ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"), }; gagvr::CustomerLabel expectedResponse = new gagvr::CustomerLabel { ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"), Customer = "customer931fec91", Label = "label20ba04d3", }; mockGrpcClient.Setup(x => x.GetCustomerLabelAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::CustomerLabel>(stt::Task.FromResult(expectedResponse), null, null, null, null)); CustomerLabelServiceClient client = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null); gagvr::CustomerLabel responseCallSettings = await client.GetCustomerLabelAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::CustomerLabel responseCancellationToken = await client.GetCustomerLabelAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }