public async stt::Task GetKeywordPlanKeywordRequestObjectAsync() { moq::Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient>(moq::MockBehavior.Strict); GetKeywordPlanKeywordRequest request = new GetKeywordPlanKeywordRequest { ResourceNameAsKeywordPlanKeywordName = gagvr::KeywordPlanKeywordName.FromCustomerKeywordPlanKeyword("[CUSTOMER]", "[KEYWORD_PLAN_KEYWORD]"), }; gagvr::KeywordPlanKeyword expectedResponse = new gagvr::KeywordPlanKeyword { ResourceNameAsKeywordPlanKeywordName = gagvr::KeywordPlanKeywordName.FromCustomerKeywordPlanKeyword("[CUSTOMER]", "[KEYWORD_PLAN_KEYWORD]"), KeywordPlanAdGroupAsKeywordPlanAdGroupName = gagvr::KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]"), Id = -6774108720365892680L, Text = "textec51b21c", MatchType = gagve::KeywordMatchTypeEnum.Types.KeywordMatchType.Unspecified, CpcBidMicros = 7321761304249472746L, }; mockGrpcClient.Setup(x => x.GetKeywordPlanKeywordAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::KeywordPlanKeyword>(stt::Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanKeywordServiceClient client = new KeywordPlanKeywordServiceClientImpl(mockGrpcClient.Object, null); gagvr::KeywordPlanKeyword responseCallSettings = await client.GetKeywordPlanKeywordAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::KeywordPlanKeyword responseCancellationToken = await client.GetKeywordPlanKeywordAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void MutateKeywordPlanKeywords() { moq::Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient>(moq::MockBehavior.Strict); MutateKeywordPlanKeywordsRequest request = new MutateKeywordPlanKeywordsRequest { CustomerId = "customer_id3b3724cb", Operations = { new KeywordPlanKeywordOperation(), }, }; MutateKeywordPlanKeywordsResponse expectedResponse = new MutateKeywordPlanKeywordsResponse { Results = { new MutateKeywordPlanKeywordResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateKeywordPlanKeywords(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordPlanKeywordServiceClient client = new KeywordPlanKeywordServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanKeywordsResponse response = client.MutateKeywordPlanKeywords(request.CustomerId, request.Operations); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task MutateKeywordPlanKeywordsAsync() { moq::Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient>(moq::MockBehavior.Strict); MutateKeywordPlanKeywordsRequest request = new MutateKeywordPlanKeywordsRequest { CustomerId = "customer_id3b3724cb", Operations = { new KeywordPlanKeywordOperation(), }, }; MutateKeywordPlanKeywordsResponse expectedResponse = new MutateKeywordPlanKeywordsResponse { Results = { new MutateKeywordPlanKeywordResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateKeywordPlanKeywordsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateKeywordPlanKeywordsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanKeywordServiceClient client = new KeywordPlanKeywordServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanKeywordsResponse responseCallSettings = await client.MutateKeywordPlanKeywordsAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); MutateKeywordPlanKeywordsResponse responseCancellationToken = await client.MutateKeywordPlanKeywordsAsync(request.CustomerId, request.Operations, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task MutateKeywordPlanKeywordsAsync3() { Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient> mockGrpcClient = new Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient>(MockBehavior.Strict); MutateKeywordPlanKeywordsRequest request = new MutateKeywordPlanKeywordsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateKeywordPlanKeywordsResponse expectedResponse = new MutateKeywordPlanKeywordsResponse(); mockGrpcClient.Setup(x => x.MutateKeywordPlanKeywordsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateKeywordPlanKeywordsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanKeywordServiceClient client = new KeywordPlanKeywordServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanKeywordsResponse response = await client.MutateKeywordPlanKeywordsAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateKeywordPlanKeywords3() { Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient> mockGrpcClient = new Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient>(MockBehavior.Strict); MutateKeywordPlanKeywordsRequest request = new MutateKeywordPlanKeywordsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateKeywordPlanKeywordsResponse expectedResponse = new MutateKeywordPlanKeywordsResponse(); mockGrpcClient.Setup(x => x.MutateKeywordPlanKeywords(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); KeywordPlanKeywordServiceClient client = new KeywordPlanKeywordServiceClientImpl(mockGrpcClient.Object, null); MutateKeywordPlanKeywordsResponse response = client.MutateKeywordPlanKeywords(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetKeywordPlanKeyword2() { Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient> mockGrpcClient = new Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient>(MockBehavior.Strict); GetKeywordPlanKeywordRequest request = new GetKeywordPlanKeywordRequest { ResourceName = new KeywordPlanKeywordName("[CUSTOMER]", "[KEYWORD_PLAN_KEYWORD]").ToString(), }; KeywordPlanKeyword expectedResponse = new KeywordPlanKeyword { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetKeywordPlanKeyword(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); KeywordPlanKeywordServiceClient client = new KeywordPlanKeywordServiceClientImpl(mockGrpcClient.Object, null); KeywordPlanKeyword response = client.GetKeywordPlanKeyword(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetKeywordPlanKeywordAsync2() { Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient> mockGrpcClient = new Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient>(MockBehavior.Strict); GetKeywordPlanKeywordRequest request = new GetKeywordPlanKeywordRequest { ResourceName = new KeywordPlanKeywordName("[CUSTOMER]", "[KEYWORD_PLAN_KEYWORD]").ToString(), }; KeywordPlanKeyword expectedResponse = new KeywordPlanKeyword { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetKeywordPlanKeywordAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <KeywordPlanKeyword>(Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanKeywordServiceClient client = new KeywordPlanKeywordServiceClientImpl(mockGrpcClient.Object, null); KeywordPlanKeyword response = await client.GetKeywordPlanKeywordAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetKeywordPlanKeyword() { moq::Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient>(moq::MockBehavior.Strict); GetKeywordPlanKeywordRequest request = new GetKeywordPlanKeywordRequest { ResourceNameAsKeywordPlanKeywordName = gagvr::KeywordPlanKeywordName.FromCustomerKeywordPlanKeyword("[CUSTOMER]", "[KEYWORD_PLAN_KEYWORD]"), }; gagvr::KeywordPlanKeyword expectedResponse = new gagvr::KeywordPlanKeyword { ResourceNameAsKeywordPlanKeywordName = gagvr::KeywordPlanKeywordName.FromCustomerKeywordPlanKeyword("[CUSTOMER]", "[KEYWORD_PLAN_KEYWORD]"), KeywordPlanAdGroupAsKeywordPlanAdGroupName = gagvr::KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]"), Id = -6774108720365892680L, Text = "textec51b21c", MatchType = gagve::KeywordMatchTypeEnum.Types.KeywordMatchType.Unspecified, CpcBidMicros = 7321761304249472746L, }; mockGrpcClient.Setup(x => x.GetKeywordPlanKeyword(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordPlanKeywordServiceClient client = new KeywordPlanKeywordServiceClientImpl(mockGrpcClient.Object, null); gagvr::KeywordPlanKeyword response = client.GetKeywordPlanKeyword(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task MutateKeywordPlanKeywordsAsync() { Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient> mockGrpcClient = new Mock <KeywordPlanKeywordService.KeywordPlanKeywordServiceClient>(MockBehavior.Strict); MutateKeywordPlanKeywordsRequest expectedRequest = new MutateKeywordPlanKeywordsRequest { CustomerId = "customerId-1772061412", Operations = { }, PartialFailure = true, ValidateOnly = false, }; MutateKeywordPlanKeywordsResponse expectedResponse = new MutateKeywordPlanKeywordsResponse(); mockGrpcClient.Setup(x => x.MutateKeywordPlanKeywordsAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateKeywordPlanKeywordsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); KeywordPlanKeywordServiceClient client = new KeywordPlanKeywordServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <KeywordPlanKeywordOperation> operations = new List <KeywordPlanKeywordOperation>(); bool partialFailure = true; bool validateOnly = false; MutateKeywordPlanKeywordsResponse response = await client.MutateKeywordPlanKeywordsAsync(customerId, operations, partialFailure, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }