/// <summary>Snippet for GetWebpageView</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetWebpageViewRequestObject()
 {
     // Create client
     WebpageViewServiceClient webpageViewServiceClient = WebpageViewServiceClient.Create();
     // Initialize request argument(s)
     GetWebpageViewRequest request = new GetWebpageViewRequest
     {
         ResourceNameAsWebpageViewName = WebpageViewName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]"),
     };
     // Make the request
     WebpageView response = webpageViewServiceClient.GetWebpageView(request);
 }
コード例 #2
0
        /// <summary>Snippet for GetWebpageViewAsync</summary>
        public async Task GetWebpageViewRequestObjectAsync()
        {
            // Snippet: GetWebpageViewAsync(GetWebpageViewRequest, CallSettings)
            // Additional: GetWebpageViewAsync(GetWebpageViewRequest, CancellationToken)
            // Create client
            WebpageViewServiceClient webpageViewServiceClient = await WebpageViewServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetWebpageViewRequest request = new GetWebpageViewRequest
            {
                ResourceNameAsWebpageViewName = WebpageViewName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]"),
            };
            // Make the request
            WebpageView response = await webpageViewServiceClient.GetWebpageViewAsync(request);

            // End snippet
        }
コード例 #3
0
        public void GetWebpageView()
        {
            moq::Mock <WebpageViewService.WebpageViewServiceClient> mockGrpcClient = new moq::Mock <WebpageViewService.WebpageViewServiceClient>(moq::MockBehavior.Strict);
            GetWebpageViewRequest request = new GetWebpageViewRequest
            {
                ResourceNameAsWebpageViewName = gagvr::WebpageViewName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]"),
            };
            gagvr::WebpageView expectedResponse = new gagvr::WebpageView
            {
                ResourceNameAsWebpageViewName = gagvr::WebpageViewName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]"),
            };

            mockGrpcClient.Setup(x => x.GetWebpageView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            WebpageViewServiceClient client   = new WebpageViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::WebpageView       response = client.GetWebpageView(request.ResourceName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #4
0
        public async stt::Task GetWebpageViewAsync()
        {
            moq::Mock <WebpageViewService.WebpageViewServiceClient> mockGrpcClient = new moq::Mock <WebpageViewService.WebpageViewServiceClient>(moq::MockBehavior.Strict);
            GetWebpageViewRequest request = new GetWebpageViewRequest
            {
                ResourceNameAsWebpageViewName = gagvr::WebpageViewName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]"),
            };
            gagvr::WebpageView expectedResponse = new gagvr::WebpageView
            {
                ResourceNameAsWebpageViewName = gagvr::WebpageViewName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]"),
            };

            mockGrpcClient.Setup(x => x.GetWebpageViewAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::WebpageView>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            WebpageViewServiceClient client = new WebpageViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::WebpageView       responseCallSettings = await client.GetWebpageViewAsync(request.ResourceName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            gagvr::WebpageView responseCancellationToken = await client.GetWebpageViewAsync(request.ResourceName, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }