public async stt::Task MutateKeywordPlanCampaignsRequestObjectAsync() { moq::Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient>(moq::MockBehavior.Strict); MutateKeywordPlanCampaignsRequest request = new MutateKeywordPlanCampaignsRequest { CustomerId = "customer_id3b3724cb", Operations = { new KeywordPlanCampaignOperation(), }, PartialFailure = false, ValidateOnly = true, }; MutateKeywordPlanCampaignsResponse expectedResponse = new MutateKeywordPlanCampaignsResponse { Results = { new MutateKeywordPlanCampaignResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateKeywordPlanCampaignsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateKeywordPlanCampaignsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanCampaignServiceClient client = new KeywordPlanCampaignServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanCampaignsResponse responseCallSettings = await client.MutateKeywordPlanCampaignsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); MutateKeywordPlanCampaignsResponse responseCancellationToken = await client.MutateKeywordPlanCampaignsAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void MutateKeywordPlanCampaigns() { moq::Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient>(moq::MockBehavior.Strict); MutateKeywordPlanCampaignsRequest request = new MutateKeywordPlanCampaignsRequest { CustomerId = "customer_id3b3724cb", Operations = { new KeywordPlanCampaignOperation(), }, }; MutateKeywordPlanCampaignsResponse expectedResponse = new MutateKeywordPlanCampaignsResponse { Results = { new MutateKeywordPlanCampaignResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateKeywordPlanCampaigns(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordPlanCampaignServiceClient client = new KeywordPlanCampaignServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanCampaignsResponse response = client.MutateKeywordPlanCampaigns(request.CustomerId, request.Operations); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetKeywordPlanCampaignRequestObjectAsync() { moq::Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient>(moq::MockBehavior.Strict); GetKeywordPlanCampaignRequest request = new GetKeywordPlanCampaignRequest { ResourceNameAsKeywordPlanCampaignName = gagvr::KeywordPlanCampaignName.FromCustomerKeywordPlanCampaign("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"), }; gagvr::KeywordPlanCampaign expectedResponse = new gagvr::KeywordPlanCampaign { ResourceNameAsKeywordPlanCampaignName = gagvr::KeywordPlanCampaignName.FromCustomerKeywordPlanCampaign("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"), KeywordPlanAsKeywordPlanName = gagvr::KeywordPlanName.FromCustomerKeywordPlan("[CUSTOMER]", "[KEYWORD_PLAN]"), Id = -6774108720365892680L, KeywordPlanCampaignName = gagvr::KeywordPlanCampaignName.FromCustomerKeywordPlanCampaign("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"), LanguageConstantsAsLanguageConstantNames = { gagvr::LanguageConstantName.FromLanguageConstant("[LANGUAGE_CONSTANT]"), }, KeywordPlanNetwork = gagve::KeywordPlanNetworkEnum.Types.KeywordPlanNetwork.Unspecified, CpcBidMicros = 7321761304249472746L, GeoTargets = { new gagvr::KeywordPlanGeoTarget(), }, }; mockGrpcClient.Setup(x => x.GetKeywordPlanCampaignAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::KeywordPlanCampaign>(stt::Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanCampaignServiceClient client = new KeywordPlanCampaignServiceClientImpl(mockGrpcClient.Object, null); gagvr::KeywordPlanCampaign responseCallSettings = await client.GetKeywordPlanCampaignAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::KeywordPlanCampaign responseCancellationToken = await client.GetKeywordPlanCampaignAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetKeywordPlanCampaignResourceNames() { moq::Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient>(moq::MockBehavior.Strict); GetKeywordPlanCampaignRequest request = new GetKeywordPlanCampaignRequest { ResourceNameAsKeywordPlanCampaignName = gagvr::KeywordPlanCampaignName.FromCustomerKeywordPlanCampaign("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"), }; gagvr::KeywordPlanCampaign expectedResponse = new gagvr::KeywordPlanCampaign { ResourceNameAsKeywordPlanCampaignName = gagvr::KeywordPlanCampaignName.FromCustomerKeywordPlanCampaign("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"), KeywordPlanAsKeywordPlanName = gagvr::KeywordPlanName.FromCustomerKeywordPlan("[CUSTOMER]", "[KEYWORD_PLAN]"), Id = -6774108720365892680L, KeywordPlanCampaignName = gagvr::KeywordPlanCampaignName.FromCustomerKeywordPlanCampaign("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"), LanguageConstantsAsLanguageConstantNames = { gagvr::LanguageConstantName.FromLanguageConstant("[LANGUAGE_CONSTANT]"), }, KeywordPlanNetwork = gagve::KeywordPlanNetworkEnum.Types.KeywordPlanNetwork.Unspecified, CpcBidMicros = 7321761304249472746L, GeoTargets = { new gagvr::KeywordPlanGeoTarget(), }, }; mockGrpcClient.Setup(x => x.GetKeywordPlanCampaign(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordPlanCampaignServiceClient client = new KeywordPlanCampaignServiceClientImpl(mockGrpcClient.Object, null); gagvr::KeywordPlanCampaign response = client.GetKeywordPlanCampaign(request.ResourceNameAsKeywordPlanCampaignName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task MutateKeywordPlanCampaignsAsync3() { Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient> mockGrpcClient = new Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient>(MockBehavior.Strict); MutateKeywordPlanCampaignsRequest request = new MutateKeywordPlanCampaignsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateKeywordPlanCampaignsResponse expectedResponse = new MutateKeywordPlanCampaignsResponse(); mockGrpcClient.Setup(x => x.MutateKeywordPlanCampaignsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateKeywordPlanCampaignsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanCampaignServiceClient client = new KeywordPlanCampaignServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanCampaignsResponse response = await client.MutateKeywordPlanCampaignsAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateKeywordPlanCampaigns3() { Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient> mockGrpcClient = new Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient>(MockBehavior.Strict); MutateKeywordPlanCampaignsRequest request = new MutateKeywordPlanCampaignsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateKeywordPlanCampaignsResponse expectedResponse = new MutateKeywordPlanCampaignsResponse(); mockGrpcClient.Setup(x => x.MutateKeywordPlanCampaigns(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); KeywordPlanCampaignServiceClient client = new KeywordPlanCampaignServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanCampaignsResponse response = client.MutateKeywordPlanCampaigns(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetKeywordPlanCampaign2() { Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient> mockGrpcClient = new Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient>(MockBehavior.Strict); GetKeywordPlanCampaignRequest request = new GetKeywordPlanCampaignRequest { ResourceName = new KeywordPlanCampaignName("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]").ToString(), }; KeywordPlanCampaign expectedResponse = new KeywordPlanCampaign { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetKeywordPlanCampaign(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); KeywordPlanCampaignServiceClient client = new KeywordPlanCampaignServiceClientImpl(mockGrpcClient.Object, null); KeywordPlanCampaign response = client.GetKeywordPlanCampaign(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetKeywordPlanCampaignAsync() { Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient> mockGrpcClient = new Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient>(MockBehavior.Strict); GetKeywordPlanCampaignRequest expectedRequest = new GetKeywordPlanCampaignRequest { ResourceName = new KeywordPlanCampaignName("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]").ToString(), }; KeywordPlanCampaign expectedResponse = new KeywordPlanCampaign { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetKeywordPlanCampaignAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <KeywordPlanCampaign>(Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanCampaignServiceClient client = new KeywordPlanCampaignServiceClientImpl(mockGrpcClient.Object, null); string formattedResourceName = new KeywordPlanCampaignName("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]").ToString(); KeywordPlanCampaign response = await client.GetKeywordPlanCampaignAsync(formattedResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task MutateKeywordPlanCampaignsAsync() { Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient> mockGrpcClient = new Mock <KeywordPlanCampaignService.KeywordPlanCampaignServiceClient>(MockBehavior.Strict); MutateKeywordPlanCampaignsRequest expectedRequest = new MutateKeywordPlanCampaignsRequest { CustomerId = "customerId-1772061412", Operations = { }, PartialFailure = true, ValidateOnly = false, }; MutateKeywordPlanCampaignsResponse expectedResponse = new MutateKeywordPlanCampaignsResponse(); mockGrpcClient.Setup(x => x.MutateKeywordPlanCampaignsAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateKeywordPlanCampaignsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanCampaignServiceClient client = new KeywordPlanCampaignServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <KeywordPlanCampaignOperation> operations = new List <KeywordPlanCampaignOperation>(); bool partialFailure = true; bool validateOnly = false; MutateKeywordPlanCampaignsResponse response = await client.MutateKeywordPlanCampaignsAsync(customerId, operations, partialFailure, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }