public void GetKeywordPlan2() { Mock <KeywordPlanService.KeywordPlanServiceClient> mockGrpcClient = new Mock <KeywordPlanService.KeywordPlanServiceClient>(MockBehavior.Strict); GetKeywordPlanRequest request = new GetKeywordPlanRequest { ResourceName = new KeywordPlanName("[CUSTOMER]", "[KEYWORD_PLAN]").ToString(), }; KeywordPlan expectedResponse = new KeywordPlan { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetKeywordPlan(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); KeywordPlanServiceClient client = new KeywordPlanServiceClientImpl(mockGrpcClient.Object, null); KeywordPlan response = client.GetKeywordPlan(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetKeywordPlan() { moq::Mock <KeywordPlanService.KeywordPlanServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanService.KeywordPlanServiceClient>(moq::MockBehavior.Strict); GetKeywordPlanRequest request = new GetKeywordPlanRequest { ResourceNameAsKeywordPlanName = gagvr::KeywordPlanName.FromCustomerKeywordPlan("[CUSTOMER]", "[KEYWORD_PLAN]"), }; gagvr::KeywordPlan expectedResponse = new gagvr::KeywordPlan { ResourceNameAsKeywordPlanName = gagvr::KeywordPlanName.FromCustomerKeywordPlan("[CUSTOMER]", "[KEYWORD_PLAN]"), Id = -6774108720365892680L, KeywordPlanName = gagvr::KeywordPlanName.FromCustomerKeywordPlan("[CUSTOMER]", "[KEYWORD_PLAN]"), ForecastPeriod = new gagvr::KeywordPlanForecastPeriod(), }; mockGrpcClient.Setup(x => x.GetKeywordPlan(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordPlanServiceClient client = new KeywordPlanServiceClientImpl(mockGrpcClient.Object, null); gagvr::KeywordPlan response = client.GetKeywordPlan(request.ResourceName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }