コード例 #1
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 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();
        }
        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 MutateCampaignBidModifiers()
        {
            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.MutateCampaignBidModifiers(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            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 = client.MutateCampaignBidModifiers(customerId, operations, partialFailure, validateOnly);

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