public async stt::Task GenerateProductMixIdeasAsync() { moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict); GenerateProductMixIdeasRequest request = new GenerateProductMixIdeasRequest { CustomerId = "customer_id3b3724cb", PlannableLocationId = "plannable_location_idbae428fa", CurrencyCode = "currency_code7f81e352", BudgetMicros = 6302061979031921068L, }; GenerateProductMixIdeasResponse expectedResponse = new GenerateProductMixIdeasResponse { ProductAllocation = { new ProductAllocation(), }, }; mockGrpcClient.Setup(x => x.GenerateProductMixIdeasAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GenerateProductMixIdeasResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ReachPlanServiceClient client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null); GenerateProductMixIdeasResponse responseCallSettings = await client.GenerateProductMixIdeasAsync(request.CustomerId, request.PlannableLocationId, request.CurrencyCode, request.BudgetMicros, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); GenerateProductMixIdeasResponse responseCancellationToken = await client.GenerateProductMixIdeasAsync(request.CustomerId, request.PlannableLocationId, request.CurrencyCode, request.BudgetMicros, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GenerateProductMixIdeas() { moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict); GenerateProductMixIdeasRequest request = new GenerateProductMixIdeasRequest { CustomerId = "customer_id3b3724cb", PlannableLocationId = "plannable_location_idbae428fa", CurrencyCode = "currency_code7f81e352", BudgetMicros = 6302061979031921068L, }; GenerateProductMixIdeasResponse expectedResponse = new GenerateProductMixIdeasResponse { ProductAllocation = { new ProductAllocation(), }, }; mockGrpcClient.Setup(x => x.GenerateProductMixIdeas(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ReachPlanServiceClient client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null); GenerateProductMixIdeasResponse response = client.GenerateProductMixIdeas(request.CustomerId, request.PlannableLocationId, request.CurrencyCode, request.BudgetMicros); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GenerateProductMixIdeas</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GenerateProductMixIdeas() { // Create client ReachPlanServiceClient reachPlanServiceClient = ReachPlanServiceClient.Create(); // Initialize request argument(s) string customerId = ""; string plannableLocationId = ""; string currencyCode = ""; long budgetMicros = 0L; // Make the request GenerateProductMixIdeasResponse response = reachPlanServiceClient.GenerateProductMixIdeas(customerId, plannableLocationId, currencyCode, budgetMicros); }
/// <summary>Snippet for GenerateProductMixIdeas</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GenerateProductMixIdeasRequestObject() { // Create client ReachPlanServiceClient reachPlanServiceClient = ReachPlanServiceClient.Create(); // Initialize request argument(s) GenerateProductMixIdeasRequest request = new GenerateProductMixIdeasRequest { CustomerId = "", Preferences = new Preferences(), PlannableLocationId = "", CurrencyCode = "", BudgetMicros = 0L, }; // Make the request GenerateProductMixIdeasResponse response = reachPlanServiceClient.GenerateProductMixIdeas(request); }
/// <summary>Snippet for GenerateProductMixIdeasAsync</summary> public async Task GenerateProductMixIdeasAsync() { // Snippet: GenerateProductMixIdeasAsync(string, string, string, long, CallSettings) // Additional: GenerateProductMixIdeasAsync(string, string, string, long, CancellationToken) // Create client ReachPlanServiceClient reachPlanServiceClient = await ReachPlanServiceClient.CreateAsync(); // Initialize request argument(s) string customerId = ""; string plannableLocationId = ""; string currencyCode = ""; long budgetMicros = 0L; // Make the request GenerateProductMixIdeasResponse response = await reachPlanServiceClient.GenerateProductMixIdeasAsync(customerId, plannableLocationId, currencyCode, budgetMicros); // End snippet }
/// <summary> /// Pulls a forecast for a product mix suggested based on preferences for whether the ad /// would have a guaranteed price, play with sound, would be skippable, would include top /// content, and a desired ad length. /// </summary> /// <param name="reachPlanService">Instance of Reach Plan Service client.</param> /// <param name="customerId">The customer ID for the reach forecast.</param> /// <param name="locationId">Location ID to plan for. To find a valid locaction ID, either /// see https://developers.google.com/adwords/api/docs/appendix/geotargeting or call /// <see cref="ReachPlanServiceClient.ListPlannableLocations"/>.</param> /// <param name="currencyCode">Three-character ISO 4217 currency code.</param> /// <param name="budgetMicros">Budget in currency micro-units to plan for.</param> public void ForecastSuggestedMix( ReachPlanServiceClient reachPlanService, string customerId, string locationId, string currencyCode, long budgetMicros) { // Note: If preferences are too restrictive, then the response will be empty. Preferences preferences = new Preferences() { HasGuaranteedPrice = true, StartsWithSound = true, IsSkippable = false, TopContentOnly = true, AdLength = ReachPlanAdLength.FifteenOrTwentySeconds }; GenerateProductMixIdeasRequest mixRequest = new GenerateProductMixIdeasRequest() { BudgetMicros = Convert.ToInt64((double)budgetMicros), CurrencyCode = currencyCode, CustomerId = customerId, PlannableLocationId = locationId, Preferences = preferences }; GenerateProductMixIdeasResponse mixResponse = reachPlanService.GenerateProductMixIdeas(mixRequest); List <PlannedProduct> productMix = new List <PlannedProduct>(); foreach (ProductAllocation product in mixResponse.ProductAllocation) { productMix.Add( new PlannedProduct() { PlannableProductCode = product.PlannableProductCode, BudgetMicros = product.BudgetMicros }); } GenerateReachForecastRequest curveRequest = BuildReachRequest(customerId, productMix, locationId, currencyCode); PullReachCurve(reachPlanService, curveRequest); }
/// <summary>Snippet for GenerateProductMixIdeasAsync</summary> public async Task GenerateProductMixIdeasRequestObjectAsync() { // Snippet: GenerateProductMixIdeasAsync(GenerateProductMixIdeasRequest, CallSettings) // Additional: GenerateProductMixIdeasAsync(GenerateProductMixIdeasRequest, CancellationToken) // Create client ReachPlanServiceClient reachPlanServiceClient = await ReachPlanServiceClient.CreateAsync(); // Initialize request argument(s) GenerateProductMixIdeasRequest request = new GenerateProductMixIdeasRequest { CustomerId = "", Preferences = new Preferences(), PlannableLocationId = "", CurrencyCode = "", BudgetMicros = 0L, }; // Make the request GenerateProductMixIdeasResponse response = await reachPlanServiceClient.GenerateProductMixIdeasAsync(request); // End snippet }
public async Task GenerateProductMixIdeasAsync() { Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new Mock <ReachPlanService.ReachPlanServiceClient>(MockBehavior.Strict); GenerateProductMixIdeasRequest request = new GenerateProductMixIdeasRequest { CustomerId = "customerId-1772061412", PlannableLocationId = null, CurrencyCode = null, BudgetMicros = null, Preferences = new Preferences(), }; GenerateProductMixIdeasResponse expectedResponse = new GenerateProductMixIdeasResponse(); mockGrpcClient.Setup(x => x.GenerateProductMixIdeasAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <GenerateProductMixIdeasResponse>(Task.FromResult(expectedResponse), null, null, null, null)); ReachPlanServiceClient client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null); GenerateProductMixIdeasResponse response = await client.GenerateProductMixIdeasAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }