Exemplo n.º 1
0
 /// <summary>Snippet for GetAdGroupAd</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetAdGroupAdResourceNames()
 {
     // Create client
     AdGroupAdServiceClient adGroupAdServiceClient = AdGroupAdServiceClient.Create();
     // Initialize request argument(s)
     AdGroupAdName resourceName = AdGroupAdName.FromCustomerAdGroupAd("[CUSTOMER]", "[AD_GROUP_AD]");
     // Make the request
     AdGroupAd response = adGroupAdServiceClient.GetAdGroupAd(resourceName);
 }
Exemplo n.º 2
0
        /// <summary>Snippet for GetAdGroupAdAsync</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 GetAdGroupAdResourceNamesAsync()
        {
            // Create client
            AdGroupAdServiceClient adGroupAdServiceClient = await AdGroupAdServiceClient.CreateAsync();

            // Initialize request argument(s)
            AdGroupAdName resourceName = AdGroupAdName.FromCustomerAdGroupAd("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[AD_ID]");
            // Make the request
            AdGroupAd response = await adGroupAdServiceClient.GetAdGroupAdAsync(resourceName);
        }
 /// <summary>Snippet for GetAdGroupAd</summary>
 public void GetAdGroupAdResourceNames()
 {
     // Snippet: GetAdGroupAd(AdGroupAdName, CallSettings)
     // Create client
     AdGroupAdServiceClient adGroupAdServiceClient = AdGroupAdServiceClient.Create();
     // Initialize request argument(s)
     AdGroupAdName resourceName = AdGroupAdName.FromCustomerAdGroupAd("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[AD_ID]");
     // Make the request
     AdGroupAd response = adGroupAdServiceClient.GetAdGroupAd(resourceName);
     // End snippet
 }
 /// <summary>Snippet for GetAdGroupAd</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetAdGroupAdRequestObject()
 {
     // Create client
     AdGroupAdServiceClient adGroupAdServiceClient = AdGroupAdServiceClient.Create();
     // Initialize request argument(s)
     GetAdGroupAdRequest request = new GetAdGroupAdRequest
     {
         ResourceNameAsAdGroupAdName = AdGroupAdName.FromCustomerAdGroupAd("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[AD_ID]"),
     };
     // Make the request
     AdGroupAd response = adGroupAdServiceClient.GetAdGroupAd(request);
 }
        /// <summary>Snippet for GetAdGroupAdAsync</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 GetAdGroupAdRequestObjectAsync()
        {
            // Create client
            AdGroupAdServiceClient adGroupAdServiceClient = await AdGroupAdServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetAdGroupAdRequest request = new GetAdGroupAdRequest
            {
                ResourceNameAsAdGroupAdName = AdGroupAdName.FromCustomerAdGroupAd("[CUSTOMER]", "[AD_GROUP_AD]"),
            };
            // Make the request
            AdGroupAd response = await adGroupAdServiceClient.GetAdGroupAdAsync(request);
        }
        /// <summary>Snippet for GetAdGroupAdAsync</summary>
        public async Task GetAdGroupAdResourceNamesAsync()
        {
            // Snippet: GetAdGroupAdAsync(AdGroupAdName, CallSettings)
            // Additional: GetAdGroupAdAsync(AdGroupAdName, CancellationToken)
            // Create client
            AdGroupAdServiceClient adGroupAdServiceClient = await AdGroupAdServiceClient.CreateAsync();

            // Initialize request argument(s)
            AdGroupAdName resourceName = AdGroupAdName.FromCustomerAdGroupAd("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[AD_ID]");
            // Make the request
            AdGroupAd response = await adGroupAdServiceClient.GetAdGroupAdAsync(resourceName);

            // End snippet
        }
        public async Task GetAdGroupAdAsync()
        {
            Mock <AdGroupAdService.AdGroupAdServiceClient> mockGrpcClient = new Mock <AdGroupAdService.AdGroupAdServiceClient>(MockBehavior.Strict);
            GetAdGroupAdRequest expectedRequest = new GetAdGroupAdRequest
            {
                ResourceName = new AdGroupAdName("[CUSTOMER]", "[AD_GROUP_AD]").ToString(),
            };
            AdGroupAd expectedResponse = new AdGroupAd
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetAdGroupAdAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <AdGroupAd>(Task.FromResult(expectedResponse), null, null, null, null));
            AdGroupAdServiceClient client   = new AdGroupAdServiceClientImpl(mockGrpcClient.Object, null);
            string    formattedResourceName = new AdGroupAdName("[CUSTOMER]", "[AD_GROUP_AD]").ToString();
            AdGroupAd response = await client.GetAdGroupAdAsync(formattedResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetAdGroupAd()
        {
            Mock <AdGroupAdService.AdGroupAdServiceClient> mockGrpcClient = new Mock <AdGroupAdService.AdGroupAdServiceClient>(MockBehavior.Strict);
            GetAdGroupAdRequest expectedRequest = new GetAdGroupAdRequest
            {
                ResourceName = new AdGroupAdName("[CUSTOMER]", "[AD_GROUP_AD]").ToString(),
            };
            AdGroupAd expectedResponse = new AdGroupAd
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetAdGroupAd(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AdGroupAdServiceClient client   = new AdGroupAdServiceClientImpl(mockGrpcClient.Object, null);
            string    formattedResourceName = new AdGroupAdName("[CUSTOMER]", "[AD_GROUP_AD]").ToString();
            AdGroupAd response = client.GetAdGroupAd(formattedResourceName);

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