public void GenerateHistoricalMetricsRequestObject() { moq::Mock <KeywordPlanService.KeywordPlanServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanService.KeywordPlanServiceClient>(moq::MockBehavior.Strict); GenerateHistoricalMetricsRequest request = new GenerateHistoricalMetricsRequest { KeywordPlanAsKeywordPlanName = gagvr::KeywordPlanName.FromCustomerKeywordPlan("[CUSTOMER_ID]", "[KEYWORD_PLAN_ID]"), AggregateMetrics = new gagvc::KeywordPlanAggregateMetrics(), HistoricalMetricsOptions = new gagvc::HistoricalMetricsOptions(), }; GenerateHistoricalMetricsResponse expectedResponse = new GenerateHistoricalMetricsResponse { Metrics = { new KeywordPlanKeywordHistoricalMetrics(), }, AggregateMetricResults = new gagvc::KeywordPlanAggregateMetricResults(), }; mockGrpcClient.Setup(x => x.GenerateHistoricalMetrics(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordPlanServiceClient client = new KeywordPlanServiceClientImpl(mockGrpcClient.Object, null); GenerateHistoricalMetricsResponse response = client.GenerateHistoricalMetrics(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GenerateHistoricalMetrics2() { Mock <KeywordPlanService.KeywordPlanServiceClient> mockGrpcClient = new Mock <KeywordPlanService.KeywordPlanServiceClient>(MockBehavior.Strict); GenerateHistoricalMetricsRequest request = new GenerateHistoricalMetricsRequest { KeywordPlan = new KeywordPlanName("[CUSTOMER]", "[KEYWORD_PLAN]").ToString(), }; GenerateHistoricalMetricsResponse expectedResponse = new GenerateHistoricalMetricsResponse(); mockGrpcClient.Setup(x => x.GenerateHistoricalMetrics(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); KeywordPlanServiceClient client = new KeywordPlanServiceClientImpl(mockGrpcClient.Object, null); GenerateHistoricalMetricsResponse response = client.GenerateHistoricalMetrics(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GenerateHistoricalMetricsResourceNames() { moq::Mock <KeywordPlanService.KeywordPlanServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanService.KeywordPlanServiceClient>(moq::MockBehavior.Strict); GenerateHistoricalMetricsRequest request = new GenerateHistoricalMetricsRequest { KeywordPlanAsKeywordPlanName = gagvr::KeywordPlanName.FromCustomerKeywordPlan("[CUSTOMER]", "[KEYWORD_PLAN]"), }; GenerateHistoricalMetricsResponse expectedResponse = new GenerateHistoricalMetricsResponse { Metrics = { new KeywordPlanKeywordHistoricalMetrics(), }, }; mockGrpcClient.Setup(x => x.GenerateHistoricalMetrics(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordPlanServiceClient client = new KeywordPlanServiceClientImpl(mockGrpcClient.Object, null); GenerateHistoricalMetricsResponse response = client.GenerateHistoricalMetrics(request.KeywordPlanAsKeywordPlanName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GenerateHistoricalMetrics() { moq::Mock <KeywordPlanService.KeywordPlanServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanService.KeywordPlanServiceClient>(moq::MockBehavior.Strict); GenerateHistoricalMetricsRequest request = new GenerateHistoricalMetricsRequest { KeywordPlan = "keyword_plan348c505a", }; GenerateHistoricalMetricsResponse expectedResponse = new GenerateHistoricalMetricsResponse { Metrics = { new KeywordPlanKeywordHistoricalMetrics(), }, }; mockGrpcClient.Setup(x => x.GenerateHistoricalMetrics(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordPlanServiceClient client = new KeywordPlanServiceClientImpl(mockGrpcClient.Object, null); GenerateHistoricalMetricsResponse response = client.GenerateHistoricalMetrics(request.KeywordPlan); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }