public async stt::Task GetKeywordPlanNegativeKeywordRequestObjectAsync() { moq::Mock <KeywordPlanNegativeKeywordService.KeywordPlanNegativeKeywordServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanNegativeKeywordService.KeywordPlanNegativeKeywordServiceClient>(moq::MockBehavior.Strict); GetKeywordPlanNegativeKeywordRequest request = new GetKeywordPlanNegativeKeywordRequest { ResourceNameAsKeywordPlanNegativeKeywordName = gagvr::KeywordPlanNegativeKeywordName.FromCustomerKeywordPlanNegativeKeyword("[CUSTOMER]", "[KEYWORD_PLAN_NEGATIVE_KEYWORD]"), }; gagvr::KeywordPlanNegativeKeyword expectedResponse = new gagvr::KeywordPlanNegativeKeyword { ResourceNameAsKeywordPlanNegativeKeywordName = gagvr::KeywordPlanNegativeKeywordName.FromCustomerKeywordPlanNegativeKeyword("[CUSTOMER]", "[KEYWORD_PLAN_NEGATIVE_KEYWORD]"), KeywordPlanCampaignAsKeywordPlanCampaignName = gagvr::KeywordPlanCampaignName.FromCustomerKeywordPlanCampaign("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"), Id = -6774108720365892680L, Text = "textec51b21c", MatchType = gagve::KeywordMatchTypeEnum.Types.KeywordMatchType.Unspecified, }; mockGrpcClient.Setup(x => x.GetKeywordPlanNegativeKeywordAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::KeywordPlanNegativeKeyword>(stt::Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanNegativeKeywordServiceClient client = new KeywordPlanNegativeKeywordServiceClientImpl(mockGrpcClient.Object, null); gagvr::KeywordPlanNegativeKeyword responseCallSettings = await client.GetKeywordPlanNegativeKeywordAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::KeywordPlanNegativeKeyword responseCancellationToken = await client.GetKeywordPlanNegativeKeywordAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetKeywordPlanNegativeKeyword() { moq::Mock <KeywordPlanNegativeKeywordService.KeywordPlanNegativeKeywordServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanNegativeKeywordService.KeywordPlanNegativeKeywordServiceClient>(moq::MockBehavior.Strict); GetKeywordPlanNegativeKeywordRequest request = new GetKeywordPlanNegativeKeywordRequest { ResourceNameAsKeywordPlanNegativeKeywordName = gagvr::KeywordPlanNegativeKeywordName.FromCustomerKeywordPlanNegativeKeyword("[CUSTOMER]", "[KEYWORD_PLAN_NEGATIVE_KEYWORD]"), }; gagvr::KeywordPlanNegativeKeyword expectedResponse = new gagvr::KeywordPlanNegativeKeyword { ResourceNameAsKeywordPlanNegativeKeywordName = gagvr::KeywordPlanNegativeKeywordName.FromCustomerKeywordPlanNegativeKeyword("[CUSTOMER]", "[KEYWORD_PLAN_NEGATIVE_KEYWORD]"), KeywordPlanCampaignAsKeywordPlanCampaignName = gagvr::KeywordPlanCampaignName.FromCustomerKeywordPlanCampaign("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"), Id = -6774108720365892680L, Text = "textec51b21c", MatchType = gagve::KeywordMatchTypeEnum.Types.KeywordMatchType.Unspecified, }; mockGrpcClient.Setup(x => x.GetKeywordPlanNegativeKeyword(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordPlanNegativeKeywordServiceClient client = new KeywordPlanNegativeKeywordServiceClientImpl(mockGrpcClient.Object, null); gagvr::KeywordPlanNegativeKeyword response = client.GetKeywordPlanNegativeKeyword(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }