コード例 #1
0
        public async stt::Task GenerateReachForecastAsync()
        {
            moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict);
            GenerateReachForecastRequest request = new GenerateReachForecastRequest
            {
                CustomerId       = "customer_id3b3724cb",
                CampaignDuration = new CampaignDuration(),
                PlannedProducts  =
                {
                    new PlannedProduct(),
                },
            };
            GenerateReachForecastResponse expectedResponse = new GenerateReachForecastResponse
            {
                OnTargetAudienceMetrics = new OnTargetAudienceMetrics(),
                ReachCurve = new ReachCurve(),
            };

            mockGrpcClient.Setup(x => x.GenerateReachForecastAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GenerateReachForecastResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ReachPlanServiceClient        client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            GenerateReachForecastResponse responseCallSettings = await client.GenerateReachForecastAsync(request.CustomerId, request.CampaignDuration, request.PlannedProducts, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            GenerateReachForecastResponse responseCancellationToken = await client.GenerateReachForecastAsync(request.CustomerId, request.CampaignDuration, request.PlannedProducts, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public async stt::Task GenerateReachForecastRequestObjectAsync()
        {
            moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict);
            GenerateReachForecastRequest request = new GenerateReachForecastRequest
            {
                CustomerId       = "customer_id3b3724cb",
                CampaignDuration = new CampaignDuration(),
                Targeting        = new Targeting(),
                PlannedProducts  =
                {
                    new PlannedProduct(),
                },
                CookieFrequencyCapSetting = new FrequencyCap(),
                CurrencyCode            = "currency_code7f81e352",
                CookieFrequencyCap      = 1624044206,
                MinEffectiveFrequency   = -519821093,
                EffectiveFrequencyLimit = new EffectiveFrequencyLimit(),
            };
            GenerateReachForecastResponse expectedResponse = new GenerateReachForecastResponse
            {
                OnTargetAudienceMetrics = new OnTargetAudienceMetrics(),
                ReachCurve = new ReachCurve(),
            };

            mockGrpcClient.Setup(x => x.GenerateReachForecastAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GenerateReachForecastResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ReachPlanServiceClient        client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            GenerateReachForecastResponse responseCallSettings = await client.GenerateReachForecastAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            GenerateReachForecastResponse responseCancellationToken = await client.GenerateReachForecastAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #3
0
        public void GenerateReachForecast()
        {
            moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict);
            GenerateReachForecastRequest request = new GenerateReachForecastRequest
            {
                CustomerId       = "customer_id3b3724cb",
                CampaignDuration = new CampaignDuration(),
                PlannedProducts  =
                {
                    new PlannedProduct(),
                },
            };
            GenerateReachForecastResponse expectedResponse = new GenerateReachForecastResponse
            {
                OnTargetAudienceMetrics = new OnTargetAudienceMetrics(),
                ReachCurve = new ReachCurve(),
            };

            mockGrpcClient.Setup(x => x.GenerateReachForecast(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ReachPlanServiceClient        client   = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            GenerateReachForecastResponse response = client.GenerateReachForecast(request.CustomerId, request.CampaignDuration, request.PlannedProducts);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #4
0
        public void GenerateReachForecastRequestObject()
        {
            moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict);
            GenerateReachForecastRequest request = new GenerateReachForecastRequest
            {
                CustomerId       = "customer_id3b3724cb",
                CampaignDuration = new CampaignDuration(),
                Targeting        = new Targeting(),
                PlannedProducts  =
                {
                    new PlannedProduct(),
                },
                CookieFrequencyCapSetting = new FrequencyCap(),
                CurrencyCode            = "currency_code7f81e352",
                CookieFrequencyCap      = 1624044206,
                MinEffectiveFrequency   = -519821093,
                EffectiveFrequencyLimit = new EffectiveFrequencyLimit(),
            };
            GenerateReachForecastResponse expectedResponse = new GenerateReachForecastResponse
            {
                OnTargetAudienceMetrics = new OnTargetAudienceMetrics(),
                ReachCurve = new ReachCurve(),
            };

            mockGrpcClient.Setup(x => x.GenerateReachForecast(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ReachPlanServiceClient        client   = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            GenerateReachForecastResponse response = client.GenerateReachForecast(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        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();
        }
コード例 #7
0
        public async stt::Task ListPlannableProductsAsync()
        {
            moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict);
            ListPlannableProductsRequest request = new ListPlannableProductsRequest
            {
                PlannableLocationId = "plannable_location_idbae428fa",
            };
            ListPlannableProductsResponse expectedResponse = new ListPlannableProductsResponse
            {
                ProductMetadata =
                {
                    new ProductMetadata(),
                },
            };

            mockGrpcClient.Setup(x => x.ListPlannableProductsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ListPlannableProductsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ReachPlanServiceClient        client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            ListPlannableProductsResponse responseCallSettings = await client.ListPlannableProductsAsync(request.PlannableLocationId, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            ListPlannableProductsResponse responseCancellationToken = await client.ListPlannableProductsAsync(request.PlannableLocationId, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #8
0
        public async Task ListPlannableLocationsAsync()
        {
            Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new Mock <ReachPlanService.ReachPlanServiceClient>(MockBehavior.Strict);
            ListPlannableLocationsRequest  request          = new ListPlannableLocationsRequest();
            ListPlannableLocationsResponse expectedResponse = new ListPlannableLocationsResponse();

            mockGrpcClient.Setup(x => x.ListPlannableLocationsAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <ListPlannableLocationsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            ReachPlanServiceClient         client   = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            ListPlannableLocationsResponse response = await client.ListPlannableLocationsAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #9
0
        public void ListPlannableLocations()
        {
            Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new Mock <ReachPlanService.ReachPlanServiceClient>(MockBehavior.Strict);
            ListPlannableLocationsRequest  request          = new ListPlannableLocationsRequest();
            ListPlannableLocationsResponse expectedResponse = new ListPlannableLocationsResponse();

            mockGrpcClient.Setup(x => x.ListPlannableLocations(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ReachPlanServiceClient         client   = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            ListPlannableLocationsResponse response = client.ListPlannableLocations(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #10
0
        public void ListPlannableLocationsRequestObject()
        {
            moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict);
            ListPlannableLocationsRequest request           = new ListPlannableLocationsRequest {
            };
            ListPlannableLocationsResponse expectedResponse = new ListPlannableLocationsResponse
            {
                PlannableLocations =
                {
                    new PlannableLocation(),
                },
            };

            mockGrpcClient.Setup(x => x.ListPlannableLocations(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ReachPlanServiceClient         client   = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            ListPlannableLocationsResponse response = client.ListPlannableLocations(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #11
0
        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();
        }
コード例 #12
0
        public void ListPlannableProducts()
        {
            moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict);
            ListPlannableProductsRequest request = new ListPlannableProductsRequest
            {
                PlannableLocationId = "plannable_location_idbae428fa",
            };
            ListPlannableProductsResponse expectedResponse = new ListPlannableProductsResponse
            {
                ProductMetadata =
                {
                    new ProductMetadata(),
                },
            };

            mockGrpcClient.Setup(x => x.ListPlannableProducts(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ReachPlanServiceClient        client   = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            ListPlannableProductsResponse response = client.ListPlannableProducts(request.PlannableLocationId);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #13
0
        public async stt::Task ListPlannableLocationsRequestObjectAsync()
        {
            moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict);
            ListPlannableLocationsRequest request           = new ListPlannableLocationsRequest {
            };
            ListPlannableLocationsResponse expectedResponse = new ListPlannableLocationsResponse
            {
                PlannableLocations =
                {
                    new PlannableLocation(),
                },
            };

            mockGrpcClient.Setup(x => x.ListPlannableLocationsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ListPlannableLocationsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ReachPlanServiceClient         client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            ListPlannableLocationsResponse responseCallSettings = await client.ListPlannableLocationsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            ListPlannableLocationsResponse responseCancellationToken = await client.ListPlannableLocationsAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #14
0
        public async Task GenerateReachForecastAsync()
        {
            Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new Mock <ReachPlanService.ReachPlanServiceClient>(MockBehavior.Strict);
            GenerateReachForecastRequest request = new GenerateReachForecastRequest
            {
                CustomerId            = "customerId-1772061412",
                CurrencyCode          = null,
                CampaignDuration      = new CampaignDuration(),
                CookieFrequencyCap    = null,
                MinEffectiveFrequency = null,
                Targeting             = new Targeting(),
                PlannedProducts       = { },
            };
            GenerateReachForecastResponse expectedResponse = new GenerateReachForecastResponse();

            mockGrpcClient.Setup(x => x.GenerateReachForecastAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <GenerateReachForecastResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            ReachPlanServiceClient        client   = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            GenerateReachForecastResponse response = await client.GenerateReachForecastAsync(request);

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