Beispiel #1
0
        public void MutateConversionValueRules()
        {
            moq::Mock <ConversionValueRuleService.ConversionValueRuleServiceClient> mockGrpcClient = new moq::Mock <ConversionValueRuleService.ConversionValueRuleServiceClient>(moq::MockBehavior.Strict);
            MutateConversionValueRulesRequest request = new MutateConversionValueRulesRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new ConversionValueRuleOperation(),
                },
            };
            MutateConversionValueRulesResponse expectedResponse = new MutateConversionValueRulesResponse
            {
                Results =
                {
                    new MutateConversionValueRuleResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateConversionValueRules(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ConversionValueRuleServiceClient   client   = new ConversionValueRuleServiceClientImpl(mockGrpcClient.Object, null);
            MutateConversionValueRulesResponse response = client.MutateConversionValueRules(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #2
0
        public async stt::Task MutateConversionValueRulesRequestObjectAsync()
        {
            moq::Mock <ConversionValueRuleService.ConversionValueRuleServiceClient> mockGrpcClient = new moq::Mock <ConversionValueRuleService.ConversionValueRuleServiceClient>(moq::MockBehavior.Strict);
            MutateConversionValueRulesRequest request = new MutateConversionValueRulesRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new ConversionValueRuleOperation(),
                },
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
                PartialFailure      = false,
            };
            MutateConversionValueRulesResponse expectedResponse = new MutateConversionValueRulesResponse
            {
                Results =
                {
                    new MutateConversionValueRuleResult(),
                },
                PartialFailureError = new gr::Status(),
            };

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

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

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