public async stt::Task GetKeywordPlanAdGroupRequestObjectAsync() { moq::Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient>(moq::MockBehavior.Strict); GetKeywordPlanAdGroupRequest request = new GetKeywordPlanAdGroupRequest { ResourceNameAsKeywordPlanAdGroupName = gagvr::KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER_ID]", "[KEYWORD_PLAN_AD_GROUP_ID]"), }; gagvr::KeywordPlanAdGroup expectedResponse = new gagvr::KeywordPlanAdGroup { ResourceNameAsKeywordPlanAdGroupName = gagvr::KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER_ID]", "[KEYWORD_PLAN_AD_GROUP_ID]"), KeywordPlanCampaignAsKeywordPlanCampaignName = gagvr::KeywordPlanCampaignName.FromCustomerKeywordPlanCampaign("[CUSTOMER_ID]", "[KEYWORD_PLAN_CAMPAIGN_ID]"), Id = -6774108720365892680L, KeywordPlanAdGroupName = gagvr::KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER_ID]", "[KEYWORD_PLAN_AD_GROUP_ID]"), CpcBidMicros = 7321761304249472746L, }; mockGrpcClient.Setup(x => x.GetKeywordPlanAdGroupAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::KeywordPlanAdGroup>(stt::Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanAdGroupServiceClient client = new KeywordPlanAdGroupServiceClientImpl(mockGrpcClient.Object, null); gagvr::KeywordPlanAdGroup responseCallSettings = await client.GetKeywordPlanAdGroupAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); gagvr::KeywordPlanAdGroup responseCancellationToken = await client.GetKeywordPlanAdGroupAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void MutateKeywordPlanAdGroups() { moq::Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient>(moq::MockBehavior.Strict); MutateKeywordPlanAdGroupsRequest request = new MutateKeywordPlanAdGroupsRequest { CustomerId = "customer_id3b3724cb", Operations = { new KeywordPlanAdGroupOperation(), }, }; MutateKeywordPlanAdGroupsResponse expectedResponse = new MutateKeywordPlanAdGroupsResponse { Results = { new MutateKeywordPlanAdGroupResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateKeywordPlanAdGroups(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordPlanAdGroupServiceClient client = new KeywordPlanAdGroupServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanAdGroupsResponse response = client.MutateKeywordPlanAdGroups(request.CustomerId, request.Operations); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task MutateKeywordPlanAdGroupsAsync() { moq::Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient>(moq::MockBehavior.Strict); MutateKeywordPlanAdGroupsRequest request = new MutateKeywordPlanAdGroupsRequest { CustomerId = "customer_id3b3724cb", Operations = { new KeywordPlanAdGroupOperation(), }, }; MutateKeywordPlanAdGroupsResponse expectedResponse = new MutateKeywordPlanAdGroupsResponse { Results = { new MutateKeywordPlanAdGroupResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateKeywordPlanAdGroupsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateKeywordPlanAdGroupsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanAdGroupServiceClient client = new KeywordPlanAdGroupServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanAdGroupsResponse responseCallSettings = await client.MutateKeywordPlanAdGroupsAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); MutateKeywordPlanAdGroupsResponse responseCancellationToken = await client.MutateKeywordPlanAdGroupsAsync(request.CustomerId, request.Operations, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task MutateKeywordPlanAdGroupsAsync3() { Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient> mockGrpcClient = new Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient>(MockBehavior.Strict); MutateKeywordPlanAdGroupsRequest request = new MutateKeywordPlanAdGroupsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateKeywordPlanAdGroupsResponse expectedResponse = new MutateKeywordPlanAdGroupsResponse(); mockGrpcClient.Setup(x => x.MutateKeywordPlanAdGroupsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateKeywordPlanAdGroupsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanAdGroupServiceClient client = new KeywordPlanAdGroupServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanAdGroupsResponse response = await client.MutateKeywordPlanAdGroupsAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateKeywordPlanAdGroups3() { Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient> mockGrpcClient = new Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient>(MockBehavior.Strict); MutateKeywordPlanAdGroupsRequest request = new MutateKeywordPlanAdGroupsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateKeywordPlanAdGroupsResponse expectedResponse = new MutateKeywordPlanAdGroupsResponse(); mockGrpcClient.Setup(x => x.MutateKeywordPlanAdGroups(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); KeywordPlanAdGroupServiceClient client = new KeywordPlanAdGroupServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanAdGroupsResponse response = client.MutateKeywordPlanAdGroups(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetKeywordPlanAdGroup2() { Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient> mockGrpcClient = new Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient>(MockBehavior.Strict); GetKeywordPlanAdGroupRequest request = new GetKeywordPlanAdGroupRequest { ResourceName = new KeywordPlanAdGroupName("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]").ToString(), }; KeywordPlanAdGroup expectedResponse = new KeywordPlanAdGroup { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetKeywordPlanAdGroup(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); KeywordPlanAdGroupServiceClient client = new KeywordPlanAdGroupServiceClientImpl(mockGrpcClient.Object, null); KeywordPlanAdGroup response = client.GetKeywordPlanAdGroup(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetKeywordPlanAdGroupAsync() { Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient> mockGrpcClient = new Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient>(MockBehavior.Strict); GetKeywordPlanAdGroupRequest expectedRequest = new GetKeywordPlanAdGroupRequest { ResourceName = new KeywordPlanAdGroupName("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]").ToString(), }; KeywordPlanAdGroup expectedResponse = new KeywordPlanAdGroup { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetKeywordPlanAdGroupAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <KeywordPlanAdGroup>(Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanAdGroupServiceClient client = new KeywordPlanAdGroupServiceClientImpl(mockGrpcClient.Object, null); string formattedResourceName = new KeywordPlanAdGroupName("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]").ToString(); KeywordPlanAdGroup response = await client.GetKeywordPlanAdGroupAsync(formattedResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetKeywordPlanAdGroup() { moq::Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient>(moq::MockBehavior.Strict); GetKeywordPlanAdGroupRequest request = new GetKeywordPlanAdGroupRequest { ResourceNameAsKeywordPlanAdGroupName = gagvr::KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER_ID]", "[KEYWORD_PLAN_AD_GROUP_ID]"), }; gagvr::KeywordPlanAdGroup expectedResponse = new gagvr::KeywordPlanAdGroup { ResourceNameAsKeywordPlanAdGroupName = gagvr::KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER_ID]", "[KEYWORD_PLAN_AD_GROUP_ID]"), KeywordPlanCampaignAsKeywordPlanCampaignName = gagvr::KeywordPlanCampaignName.FromCustomerKeywordPlanCampaign("[CUSTOMER_ID]", "[KEYWORD_PLAN_CAMPAIGN_ID]"), Id = -6774108720365892680L, KeywordPlanAdGroupName = gagvr::KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER_ID]", "[KEYWORD_PLAN_AD_GROUP_ID]"), CpcBidMicros = 7321761304249472746L, }; mockGrpcClient.Setup(x => x.GetKeywordPlanAdGroup(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordPlanAdGroupServiceClient client = new KeywordPlanAdGroupServiceClientImpl(mockGrpcClient.Object, null); gagvr::KeywordPlanAdGroup response = client.GetKeywordPlanAdGroup(request.ResourceName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task MutateKeywordPlanAdGroupsAsync() { Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient> mockGrpcClient = new Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient>(MockBehavior.Strict); MutateKeywordPlanAdGroupsRequest expectedRequest = new MutateKeywordPlanAdGroupsRequest { CustomerId = "customerId-1772061412", Operations = { }, PartialFailure = true, ValidateOnly = false, }; MutateKeywordPlanAdGroupsResponse expectedResponse = new MutateKeywordPlanAdGroupsResponse(); mockGrpcClient.Setup(x => x.MutateKeywordPlanAdGroupsAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateKeywordPlanAdGroupsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanAdGroupServiceClient client = new KeywordPlanAdGroupServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <KeywordPlanAdGroupOperation> operations = new List <KeywordPlanAdGroupOperation>(); bool partialFailure = true; bool validateOnly = false; MutateKeywordPlanAdGroupsResponse response = await client.MutateKeywordPlanAdGroupsAsync(customerId, operations, partialFailure, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }