Пример #1
0
        public void MutateAdGroupCustomizers()
        {
            moq::Mock <AdGroupCustomizerService.AdGroupCustomizerServiceClient> mockGrpcClient = new moq::Mock <AdGroupCustomizerService.AdGroupCustomizerServiceClient>(moq::MockBehavior.Strict);
            MutateAdGroupCustomizersRequest request = new MutateAdGroupCustomizersRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new AdGroupCustomizerOperation(),
                },
            };
            MutateAdGroupCustomizersResponse expectedResponse = new MutateAdGroupCustomizersResponse
            {
                Results =
                {
                    new MutateAdGroupCustomizerResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateAdGroupCustomizers(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AdGroupCustomizerServiceClient   client   = new AdGroupCustomizerServiceClientImpl(mockGrpcClient.Object, null);
            MutateAdGroupCustomizersResponse response = client.MutateAdGroupCustomizers(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #2
0
        public async stt::Task MutateAdGroupCustomizersRequestObjectAsync()
        {
            moq::Mock <AdGroupCustomizerService.AdGroupCustomizerServiceClient> mockGrpcClient = new moq::Mock <AdGroupCustomizerService.AdGroupCustomizerServiceClient>(moq::MockBehavior.Strict);
            MutateAdGroupCustomizersRequest request = new MutateAdGroupCustomizersRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new AdGroupCustomizerOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateAdGroupCustomizersResponse expectedResponse = new MutateAdGroupCustomizersResponse
            {
                Results =
                {
                    new MutateAdGroupCustomizerResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateAdGroupCustomizersAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateAdGroupCustomizersResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            AdGroupCustomizerServiceClient   client = new AdGroupCustomizerServiceClientImpl(mockGrpcClient.Object, null);
            MutateAdGroupCustomizersResponse responseCallSettings = await client.MutateAdGroupCustomizersAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            MutateAdGroupCustomizersResponse responseCancellationToken = await client.MutateAdGroupCustomizersAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }