Example #1
0
        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 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();
        }