示例#1
0
        public async stt::Task MutateCampaignBidModifiersAsync()
        {
            moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient> mockGrpcClient = new moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient>(moq::MockBehavior.Strict);
            MutateCampaignBidModifiersRequest request = new MutateCampaignBidModifiersRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CampaignBidModifierOperation(),
                },
            };
            MutateCampaignBidModifiersResponse expectedResponse = new MutateCampaignBidModifiersResponse
            {
                Results =
                {
                    new MutateCampaignBidModifierResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCampaignBidModifiersAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateCampaignBidModifiersResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CampaignBidModifierServiceClient   client = new CampaignBidModifierServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignBidModifiersResponse responseCallSettings = await client.MutateCampaignBidModifiersAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            MutateCampaignBidModifiersResponse responseCancellationToken = await client.MutateCampaignBidModifiersAsync(request.CustomerId, request.Operations, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
示例#2
0
        public async stt::Task GetCampaignBidModifierRequestObjectAsync()
        {
            moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient> mockGrpcClient = new moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient>(moq::MockBehavior.Strict);
            GetCampaignBidModifierRequest request = new GetCampaignBidModifierRequest
            {
                ResourceNameAsCampaignBidModifierName = gagvr::CampaignBidModifierName.FromCustomerCampaignCriterion("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[CRITERION_ID]"),
            };
            gagvr::CampaignBidModifier expectedResponse = new gagvr::CampaignBidModifier
            {
                ResourceNameAsCampaignBidModifierName = gagvr::CampaignBidModifierName.FromCustomerCampaignCriterion("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[CRITERION_ID]"),
                InteractionType        = new gagvc::InteractionTypeInfo(),
                CampaignAsCampaignName = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
                CriterionId            = 8584655242409302840L,
                BidModifier            = 1.6595195068951933E+17,
            };

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

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCampaignBidModifiersRequestObject()
        {
            moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient> mockGrpcClient = new moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient>(moq::MockBehavior.Strict);
            MutateCampaignBidModifiersRequest request = new MutateCampaignBidModifiersRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CampaignBidModifierOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateCampaignBidModifiersResponse expectedResponse = new MutateCampaignBidModifiersResponse
            {
                Results =
                {
                    new MutateCampaignBidModifierResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCampaignBidModifiers(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignBidModifierServiceClient   client   = new CampaignBidModifierServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignBidModifiersResponse response = client.MutateCampaignBidModifiers(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#4
0
        public void MutateCampaignBidModifiers()
        {
            moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient> mockGrpcClient = new moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient>(moq::MockBehavior.Strict);
            MutateCampaignBidModifiersRequest request = new MutateCampaignBidModifiersRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CampaignBidModifierOperation(),
                },
            };
            MutateCampaignBidModifiersResponse expectedResponse = new MutateCampaignBidModifiersResponse
            {
                Results =
                {
                    new MutateCampaignBidModifierResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCampaignBidModifiers(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignBidModifierServiceClient   client   = new CampaignBidModifierServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignBidModifiersResponse response = client.MutateCampaignBidModifiers(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task MutateCampaignBidModifiersAsync3()
        {
            Mock <CampaignBidModifierService.CampaignBidModifierServiceClient> mockGrpcClient = new Mock <CampaignBidModifierService.CampaignBidModifierServiceClient>(MockBehavior.Strict);
            MutateCampaignBidModifiersRequest request = new MutateCampaignBidModifiersRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCampaignBidModifiersResponse expectedResponse = new MutateCampaignBidModifiersResponse();

            mockGrpcClient.Setup(x => x.MutateCampaignBidModifiersAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateCampaignBidModifiersResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            CampaignBidModifierServiceClient   client   = new CampaignBidModifierServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignBidModifiersResponse response = await client.MutateCampaignBidModifiersAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCampaignBidModifiers3()
        {
            Mock <CampaignBidModifierService.CampaignBidModifierServiceClient> mockGrpcClient = new Mock <CampaignBidModifierService.CampaignBidModifierServiceClient>(MockBehavior.Strict);
            MutateCampaignBidModifiersRequest request = new MutateCampaignBidModifiersRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCampaignBidModifiersResponse expectedResponse = new MutateCampaignBidModifiersResponse();

            mockGrpcClient.Setup(x => x.MutateCampaignBidModifiers(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CampaignBidModifierServiceClient   client   = new CampaignBidModifierServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignBidModifiersResponse response = client.MutateCampaignBidModifiers(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetCampaignBidModifier2()
        {
            Mock <CampaignBidModifierService.CampaignBidModifierServiceClient> mockGrpcClient = new Mock <CampaignBidModifierService.CampaignBidModifierServiceClient>(MockBehavior.Strict);
            GetCampaignBidModifierRequest request = new GetCampaignBidModifierRequest
            {
                ResourceName = new CampaignBidModifierName("[CUSTOMER]", "[CAMPAIGN_BID_MODIFIER]").ToString(),
            };
            CampaignBidModifier expectedResponse = new CampaignBidModifier
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaignBidModifier(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CampaignBidModifierServiceClient client = new CampaignBidModifierServiceClientImpl(mockGrpcClient.Object, null);
            CampaignBidModifier response            = client.GetCampaignBidModifier(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetCampaignBidModifierAsync()
        {
            Mock <CampaignBidModifierService.CampaignBidModifierServiceClient> mockGrpcClient = new Mock <CampaignBidModifierService.CampaignBidModifierServiceClient>(MockBehavior.Strict);
            GetCampaignBidModifierRequest expectedRequest = new GetCampaignBidModifierRequest
            {
                ResourceName = new CampaignBidModifierName("[CUSTOMER]", "[CAMPAIGN_BID_MODIFIER]").ToString(),
            };
            CampaignBidModifier expectedResponse = new CampaignBidModifier
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaignBidModifierAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CampaignBidModifier>(Task.FromResult(expectedResponse), null, null, null, null));
            CampaignBidModifierServiceClient client = new CampaignBidModifierServiceClientImpl(mockGrpcClient.Object, null);
            string formattedResourceName            = new CampaignBidModifierName("[CUSTOMER]", "[CAMPAIGN_BID_MODIFIER]").ToString();
            CampaignBidModifier response            = await client.GetCampaignBidModifierAsync(formattedResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#9
0
        public void GetCampaignBidModifier()
        {
            moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient> mockGrpcClient = new moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient>(moq::MockBehavior.Strict);
            GetCampaignBidModifierRequest request = new GetCampaignBidModifierRequest
            {
                ResourceNameAsCampaignBidModifierName = gagvr::CampaignBidModifierName.FromCustomerCampaignCriterion("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[CRITERION_ID]"),
            };
            gagvr::CampaignBidModifier expectedResponse = new gagvr::CampaignBidModifier
            {
                ResourceNameAsCampaignBidModifierName = gagvr::CampaignBidModifierName.FromCustomerCampaignCriterion("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[CRITERION_ID]"),
                InteractionType        = new gagvc::InteractionTypeInfo(),
                CampaignAsCampaignName = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
                CriterionId            = 8584655242409302840L,
                BidModifier            = 1.6595195068951933E+17,
            };

            mockGrpcClient.Setup(x => x.GetCampaignBidModifier(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignBidModifierServiceClient client   = new CampaignBidModifierServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CampaignBidModifier       response = client.GetCampaignBidModifier(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task MutateCampaignBidModifiersAsync()
        {
            Mock <CampaignBidModifierService.CampaignBidModifierServiceClient> mockGrpcClient = new Mock <CampaignBidModifierService.CampaignBidModifierServiceClient>(MockBehavior.Strict);
            MutateCampaignBidModifiersRequest expectedRequest = new MutateCampaignBidModifiersRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateCampaignBidModifiersResponse expectedResponse = new MutateCampaignBidModifiersResponse();

            mockGrpcClient.Setup(x => x.MutateCampaignBidModifiersAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateCampaignBidModifiersResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            CampaignBidModifierServiceClient client = new CampaignBidModifierServiceClientImpl(mockGrpcClient.Object, null);
            string customerId = "customerId-1772061412";
            IEnumerable <CampaignBidModifierOperation> operations = new List <CampaignBidModifierOperation>();
            bool partialFailure = true;
            bool validateOnly   = false;
            MutateCampaignBidModifiersResponse response = await client.MutateCampaignBidModifiersAsync(customerId, operations, partialFailure, validateOnly);

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