コード例 #1
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();
        }
コード例 #2
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();
        }
コード例 #3
0
        public void GenerateReachForecast()
        {
            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.GenerateReachForecast(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ReachPlanServiceClient        client   = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null);
            GenerateReachForecastResponse response = client.GenerateReachForecast(request);

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