示例#1
0
        public void MutateCustomerFeeds()
        {
            moq::Mock <CustomerFeedService.CustomerFeedServiceClient> mockGrpcClient = new moq::Mock <CustomerFeedService.CustomerFeedServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerFeedsRequest request = new MutateCustomerFeedsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerFeedOperation(),
                },
            };
            MutateCustomerFeedsResponse expectedResponse = new MutateCustomerFeedsResponse
            {
                Results =
                {
                    new MutateCustomerFeedResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCustomerFeeds(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerFeedServiceClient   client   = new CustomerFeedServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerFeedsResponse response = client.MutateCustomerFeeds(request.CustomerId, request.Operations);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#2
0
        public async stt::Task MutateCustomerFeedsAsync()
        {
            moq::Mock <CustomerFeedService.CustomerFeedServiceClient> mockGrpcClient = new moq::Mock <CustomerFeedService.CustomerFeedServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerFeedsRequest request = new MutateCustomerFeedsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerFeedOperation(),
                },
            };
            MutateCustomerFeedsResponse expectedResponse = new MutateCustomerFeedsResponse
            {
                Results =
                {
                    new MutateCustomerFeedResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCustomerFeedsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateCustomerFeedsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CustomerFeedServiceClient   client = new CustomerFeedServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerFeedsResponse responseCallSettings = await client.MutateCustomerFeedsAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            MutateCustomerFeedsResponse responseCancellationToken = await client.MutateCustomerFeedsAsync(request.CustomerId, request.Operations, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCustomerFeedsRequestObject()
        {
            moq::Mock <CustomerFeedService.CustomerFeedServiceClient> mockGrpcClient = new moq::Mock <CustomerFeedService.CustomerFeedServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerFeedsRequest request = new MutateCustomerFeedsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerFeedOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateCustomerFeedsResponse expectedResponse = new MutateCustomerFeedsResponse
            {
                Results =
                {
                    new MutateCustomerFeedResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCustomerFeeds(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerFeedServiceClient   client   = new CustomerFeedServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerFeedsResponse response = client.MutateCustomerFeeds(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for MutateCustomerFeeds</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateCustomerFeeds()
 {
     // Create client
     CustomerFeedServiceClient customerFeedServiceClient = CustomerFeedServiceClient.Create();
     // Initialize request argument(s)
     string customerId = "";
     IEnumerable <CustomerFeedOperation> operations = new CustomerFeedOperation[]
     {
         new CustomerFeedOperation(),
     };
     // Make the request
     MutateCustomerFeedsResponse response = customerFeedServiceClient.MutateCustomerFeeds(customerId, operations);
 }
示例#5
0
        /// <summary>
        /// Creates the customer feed.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="customerId">The customer identifier.</param>
        /// <param name="gmbFeedResourceName">Name of the GMB feed resource.</param>
        private static void CreateCustomerFeed(GoogleAdsClient client, long customerId,
                                               string gmbFeedResourceName)
        {
            // Get the CustomerFeedService.
            CustomerFeedServiceClient customerFeedService = client.GetService(
                Services.V3.CustomerFeedService);

            // Adds a CustomerFeed that associates the feed with this customer for
            // the LOCATION placeholder type.
            CustomerFeed customerFeed = new CustomerFeed()
            {
                Feed             = gmbFeedResourceName,
                PlaceholderTypes = { PlaceholderType.Location },
                MatchingFunction = new MatchingFunction()
                {
                    LeftOperands =
                    {
                        new Operand()
                        {
                            ConstantOperand = new ConstantOperand()
                            {
                                BooleanValue = true
                            }
                        }
                    },
                    // Specify the function string as IDENTITY(true) to mark this feed as enabled.
                    FunctionString = "IDENTITY(true)",
                    Operator       = MatchingFunctionOperator.Identity
                },
            };

            CustomerFeedOperation operation = new CustomerFeedOperation()
            {
                Create = customerFeed
            };

            MutateCustomerFeedsResponse customerFeedsResponse =
                customerFeedService.MutateCustomerFeeds(
                    customerId.ToString(), new[] { operation });

            // Displays the result.
            string addedCustomerFeed = customerFeedsResponse.Results[0].ResourceName;

            Console.WriteLine($"Customer feed created with resource name: {addedCustomerFeed}.");
            return;
        }
示例#6
0
        public async Task MutateCustomerFeedsAsync3()
        {
            Mock <CustomerFeedService.CustomerFeedServiceClient> mockGrpcClient = new Mock <CustomerFeedService.CustomerFeedServiceClient>(MockBehavior.Strict);
            MutateCustomerFeedsRequest request = new MutateCustomerFeedsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCustomerFeedsResponse expectedResponse = new MutateCustomerFeedsResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerFeedsAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateCustomerFeedsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomerFeedServiceClient   client   = new CustomerFeedServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerFeedsResponse response = await client.MutateCustomerFeedsAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#7
0
        public void MutateCustomerFeeds3()
        {
            Mock <CustomerFeedService.CustomerFeedServiceClient> mockGrpcClient = new Mock <CustomerFeedService.CustomerFeedServiceClient>(MockBehavior.Strict);
            MutateCustomerFeedsRequest request = new MutateCustomerFeedsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCustomerFeedsResponse expectedResponse = new MutateCustomerFeedsResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerFeeds(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomerFeedServiceClient   client   = new CustomerFeedServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerFeedsResponse response = client.MutateCustomerFeeds(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for MutateCustomerFeedsAsync</summary>
        public async Task MutateCustomerFeedsAsync()
        {
            // Snippet: MutateCustomerFeedsAsync(string, IEnumerable<CustomerFeedOperation>, CallSettings)
            // Additional: MutateCustomerFeedsAsync(string, IEnumerable<CustomerFeedOperation>, CancellationToken)
            // Create client
            CustomerFeedServiceClient customerFeedServiceClient = await CustomerFeedServiceClient.CreateAsync();

            // Initialize request argument(s)
            string customerId = "";
            IEnumerable <CustomerFeedOperation> operations = new CustomerFeedOperation[]
            {
                new CustomerFeedOperation(),
            };
            // Make the request
            MutateCustomerFeedsResponse response = await customerFeedServiceClient.MutateCustomerFeedsAsync(customerId, operations);

            // End snippet
        }
示例#9
0
 /// <summary>Snippet for MutateCustomerFeeds</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateCustomerFeedsRequestObject()
 {
     // Create client
     CustomerFeedServiceClient customerFeedServiceClient = CustomerFeedServiceClient.Create();
     // Initialize request argument(s)
     MutateCustomerFeedsRequest request = new MutateCustomerFeedsRequest
     {
         CustomerId = "",
         Operations =
         {
             new CustomerFeedOperation(),
         },
         PartialFailure = false,
         ValidateOnly   = false,
     };
     // Make the request
     MutateCustomerFeedsResponse response = customerFeedServiceClient.MutateCustomerFeeds(request);
 }
示例#10
0
        /// <summary>Snippet for MutateCustomerFeedsAsync</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 MutateCustomerFeedsRequestObjectAsync()
        {
            // Create client
            CustomerFeedServiceClient customerFeedServiceClient = await CustomerFeedServiceClient.CreateAsync();

            // Initialize request argument(s)
            MutateCustomerFeedsRequest request = new MutateCustomerFeedsRequest
            {
                CustomerId = "",
                Operations =
                {
                    new CustomerFeedOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = false,
                ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified,
            };
            // Make the request
            MutateCustomerFeedsResponse response = await customerFeedServiceClient.MutateCustomerFeedsAsync(request);
        }
 /// <summary>Snippet for MutateCustomerFeeds</summary>
 public void MutateCustomerFeedsRequestObject()
 {
     // Snippet: MutateCustomerFeeds(MutateCustomerFeedsRequest, CallSettings)
     // Create client
     CustomerFeedServiceClient customerFeedServiceClient = CustomerFeedServiceClient.Create();
     // Initialize request argument(s)
     MutateCustomerFeedsRequest request = new MutateCustomerFeedsRequest
     {
         CustomerId = "",
         Operations =
         {
             new CustomerFeedOperation(),
         },
         PartialFailure      = false,
         ValidateOnly        = false,
         ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified,
     };
     // Make the request
     MutateCustomerFeedsResponse response = customerFeedServiceClient.MutateCustomerFeeds(request);
     // End snippet
 }
示例#12
0
        /// <summary>Snippet for MutateCustomerFeedsAsync</summary>
        public async Task MutateCustomerFeedsRequestObjectAsync()
        {
            // Snippet: MutateCustomerFeedsAsync(MutateCustomerFeedsRequest, CallSettings)
            // Additional: MutateCustomerFeedsAsync(MutateCustomerFeedsRequest, CancellationToken)
            // Create client
            CustomerFeedServiceClient customerFeedServiceClient = await CustomerFeedServiceClient.CreateAsync();

            // Initialize request argument(s)
            MutateCustomerFeedsRequest request = new MutateCustomerFeedsRequest
            {
                CustomerId = "",
                Operations =
                {
                    new CustomerFeedOperation(),
                },
                PartialFailure = false,
                ValidateOnly   = false,
            };
            // Make the request
            MutateCustomerFeedsResponse response = await customerFeedServiceClient.MutateCustomerFeedsAsync(request);

            // End snippet
        }
示例#13
0
        public async Task MutateCustomerFeedsAsync()
        {
            Mock <CustomerFeedService.CustomerFeedServiceClient> mockGrpcClient = new Mock <CustomerFeedService.CustomerFeedServiceClient>(MockBehavior.Strict);
            MutateCustomerFeedsRequest expectedRequest = new MutateCustomerFeedsRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateCustomerFeedsResponse expectedResponse = new MutateCustomerFeedsResponse();

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

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