Beispiel #1
0
        public void GenerateForecastCurveResourceNames()
        {
            moq::Mock <KeywordPlanService.KeywordPlanServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanService.KeywordPlanServiceClient>(moq::MockBehavior.Strict);
            GenerateForecastCurveRequest request = new GenerateForecastCurveRequest
            {
                KeywordPlanAsKeywordPlanName = gagvr::KeywordPlanName.FromCustomerKeywordPlan("[CUSTOMER]", "[KEYWORD_PLAN]"),
            };
            GenerateForecastCurveResponse expectedResponse = new GenerateForecastCurveResponse
            {
                CampaignForecastCurves =
                {
                    new KeywordPlanCampaignForecastCurve(),
                },
            };

            mockGrpcClient.Setup(x => x.GenerateForecastCurve(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            KeywordPlanServiceClient      client   = new KeywordPlanServiceClientImpl(mockGrpcClient.Object, null);
            GenerateForecastCurveResponse response = client.GenerateForecastCurve(request.KeywordPlanAsKeywordPlanName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #2
0
        public void GenerateForecastCurve()
        {
            moq::Mock <KeywordPlanService.KeywordPlanServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanService.KeywordPlanServiceClient>(moq::MockBehavior.Strict);
            GenerateForecastCurveRequest request = new GenerateForecastCurveRequest
            {
                KeywordPlan = "keyword_plan348c505a",
            };
            GenerateForecastCurveResponse expectedResponse = new GenerateForecastCurveResponse
            {
                CampaignForecastCurves =
                {
                    new KeywordPlanCampaignForecastCurve(),
                },
            };

            mockGrpcClient.Setup(x => x.GenerateForecastCurve(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            KeywordPlanServiceClient      client   = new KeywordPlanServiceClientImpl(mockGrpcClient.Object, null);
            GenerateForecastCurveResponse response = client.GenerateForecastCurve(request.KeywordPlan);

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