Ejemplo n.º 1
0
        public void GetConversionValueRule()
        {
            moq::Mock <ConversionValueRuleService.ConversionValueRuleServiceClient> mockGrpcClient = new moq::Mock <ConversionValueRuleService.ConversionValueRuleServiceClient>(moq::MockBehavior.Strict);
            GetConversionValueRuleRequest request = new GetConversionValueRuleRequest
            {
                ResourceNameAsConversionValueRuleName = gagvr::ConversionValueRuleName.FromCustomerConversionValueRule("[CUSTOMER_ID]", "[CONVERSION_VALUE_RULE_ID]"),
            };
            gagvr::ConversionValueRule expectedResponse = new gagvr::ConversionValueRule
            {
                ResourceNameAsConversionValueRuleName = gagvr::ConversionValueRuleName.FromCustomerConversionValueRule("[CUSTOMER_ID]", "[CONVERSION_VALUE_RULE_ID]"),
                Id     = -6774108720365892680L,
                Action = new gagvr::ConversionValueRule.Types.ValueRuleAction(),
                GeoLocationCondition        = new gagvr::ConversionValueRule.Types.ValueRuleGeoLocationCondition(),
                DeviceCondition             = new gagvr::ConversionValueRule.Types.ValueRuleDeviceCondition(),
                AudienceCondition           = new gagvr::ConversionValueRule.Types.ValueRuleAudienceCondition(),
                OwnerCustomerAsCustomerName = gagvr::CustomerName.FromCustomer("[CUSTOMER_ID]"),
                Status = gagve::ConversionValueRuleStatusEnum.Types.ConversionValueRuleStatus.Paused,
            };

            mockGrpcClient.Setup(x => x.GetConversionValueRule(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ConversionValueRuleServiceClient client   = new ConversionValueRuleServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::ConversionValueRule       response = client.GetConversionValueRule(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 2
0
        public async stt::Task GetConversionValueRuleRequestObjectAsync()
        {
            moq::Mock <ConversionValueRuleService.ConversionValueRuleServiceClient> mockGrpcClient = new moq::Mock <ConversionValueRuleService.ConversionValueRuleServiceClient>(moq::MockBehavior.Strict);
            GetConversionValueRuleRequest request = new GetConversionValueRuleRequest
            {
                ResourceNameAsConversionValueRuleName = gagvr::ConversionValueRuleName.FromCustomerConversionValueRule("[CUSTOMER_ID]", "[CONVERSION_VALUE_RULE_ID]"),
            };
            gagvr::ConversionValueRule expectedResponse = new gagvr::ConversionValueRule
            {
                ResourceNameAsConversionValueRuleName = gagvr::ConversionValueRuleName.FromCustomerConversionValueRule("[CUSTOMER_ID]", "[CONVERSION_VALUE_RULE_ID]"),
                Id     = -6774108720365892680L,
                Action = new gagvr::ConversionValueRule.Types.ValueRuleAction(),
                GeoLocationCondition        = new gagvr::ConversionValueRule.Types.ValueRuleGeoLocationCondition(),
                DeviceCondition             = new gagvr::ConversionValueRule.Types.ValueRuleDeviceCondition(),
                AudienceCondition           = new gagvr::ConversionValueRule.Types.ValueRuleAudienceCondition(),
                OwnerCustomerAsCustomerName = gagvr::CustomerName.FromCustomer("[CUSTOMER_ID]"),
                Status = gagve::ConversionValueRuleStatusEnum.Types.ConversionValueRuleStatus.Paused,
            };

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

            Assert.AreEqual(expectedResponse, responseCallSettings);
            gagvr::ConversionValueRule responseCancellationToken = await client.GetConversionValueRuleAsync(request, st::CancellationToken.None);

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