コード例 #1
0
 /// <summary>Snippet for MutateAdGroupLabels</summary>
 public void MutateAdGroupLabelsRequestObject()
 {
     // Snippet: MutateAdGroupLabels(MutateAdGroupLabelsRequest, CallSettings)
     // Create client
     AdGroupLabelServiceClient adGroupLabelServiceClient = AdGroupLabelServiceClient.Create();
     // Initialize request argument(s)
     MutateAdGroupLabelsRequest request = new MutateAdGroupLabelsRequest
     {
         CustomerId = "",
         Operations =
         {
             new AdGroupLabelOperation(),
         },
         PartialFailure = false,
         ValidateOnly   = false,
     };
     // Make the request
     MutateAdGroupLabelsResponse response = adGroupLabelServiceClient.MutateAdGroupLabels(request);
     // End snippet
 }
コード例 #2
0
        /// <summary>Snippet for MutateAdGroupLabelsAsync</summary>
        public async Task MutateAdGroupLabelsRequestObjectAsync()
        {
            // Snippet: MutateAdGroupLabelsAsync(MutateAdGroupLabelsRequest, CallSettings)
            // Additional: MutateAdGroupLabelsAsync(MutateAdGroupLabelsRequest, CancellationToken)
            // Create client
            AdGroupLabelServiceClient adGroupLabelServiceClient = await AdGroupLabelServiceClient.CreateAsync();

            // Initialize request argument(s)
            MutateAdGroupLabelsRequest request = new MutateAdGroupLabelsRequest
            {
                CustomerId = "",
                Operations =
                {
                    new AdGroupLabelOperation(),
                },
                PartialFailure = false,
                ValidateOnly   = false,
            };
            // Make the request
            MutateAdGroupLabelsResponse response = await adGroupLabelServiceClient.MutateAdGroupLabelsAsync(request);

            // End snippet
        }
コード例 #3
0
        public async Task MutateAdGroupLabelsAsync()
        {
            Mock <AdGroupLabelService.AdGroupLabelServiceClient> mockGrpcClient = new Mock <AdGroupLabelService.AdGroupLabelServiceClient>(MockBehavior.Strict);
            MutateAdGroupLabelsRequest expectedRequest = new MutateAdGroupLabelsRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateAdGroupLabelsResponse expectedResponse = new MutateAdGroupLabelsResponse();

            mockGrpcClient.Setup(x => x.MutateAdGroupLabelsAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateAdGroupLabelsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            AdGroupLabelServiceClient client = new AdGroupLabelServiceClientImpl(mockGrpcClient.Object, null);
            string customerId = "customerId-1772061412";
            IEnumerable <AdGroupLabelOperation> operations = new List <AdGroupLabelOperation>();
            bool partialFailure = true;
            bool validateOnly   = false;
            MutateAdGroupLabelsResponse response = await client.MutateAdGroupLabelsAsync(customerId, operations, partialFailure, validateOnly);

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