示例#1
0
        public void MutateCampaignLabelsRequestObject()
        {
            moq::Mock <CampaignLabelService.CampaignLabelServiceClient> mockGrpcClient = new moq::Mock <CampaignLabelService.CampaignLabelServiceClient>(moq::MockBehavior.Strict);
            MutateCampaignLabelsRequest request = new MutateCampaignLabelsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CampaignLabelOperation(),
                },
                PartialFailure = false,
                ValidateOnly   = true,
            };
            MutateCampaignLabelsResponse expectedResponse = new MutateCampaignLabelsResponse
            {
                Results =
                {
                    new MutateCampaignLabelResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCampaignLabels(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignLabelServiceClient   client   = new CampaignLabelServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignLabelsResponse response = client.MutateCampaignLabels(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task MutateCampaignLabelsAsync()
        {
            moq::Mock <CampaignLabelService.CampaignLabelServiceClient> mockGrpcClient = new moq::Mock <CampaignLabelService.CampaignLabelServiceClient>(moq::MockBehavior.Strict);
            MutateCampaignLabelsRequest request = new MutateCampaignLabelsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CampaignLabelOperation(),
                },
            };
            MutateCampaignLabelsResponse expectedResponse = new MutateCampaignLabelsResponse
            {
                Results =
                {
                    new MutateCampaignLabelResult(),
                },
                PartialFailureError = new gr::Status(),
            };

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

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async Task MutateCampaignLabelsAsync3()
        {
            Mock <CampaignLabelService.CampaignLabelServiceClient> mockGrpcClient = new Mock <CampaignLabelService.CampaignLabelServiceClient>(MockBehavior.Strict);
            MutateCampaignLabelsRequest request = new MutateCampaignLabelsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCampaignLabelsResponse expectedResponse = new MutateCampaignLabelsResponse();

            mockGrpcClient.Setup(x => x.MutateCampaignLabelsAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateCampaignLabelsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            CampaignLabelServiceClient   client   = new CampaignLabelServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignLabelsResponse response = await client.MutateCampaignLabelsAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCampaignLabels3()
        {
            Mock <CampaignLabelService.CampaignLabelServiceClient> mockGrpcClient = new Mock <CampaignLabelService.CampaignLabelServiceClient>(MockBehavior.Strict);
            MutateCampaignLabelsRequest request = new MutateCampaignLabelsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCampaignLabelsResponse expectedResponse = new MutateCampaignLabelsResponse();

            mockGrpcClient.Setup(x => x.MutateCampaignLabels(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CampaignLabelServiceClient   client   = new CampaignLabelServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignLabelsResponse response = client.MutateCampaignLabels(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetCampaignLabel2()
        {
            Mock <CampaignLabelService.CampaignLabelServiceClient> mockGrpcClient = new Mock <CampaignLabelService.CampaignLabelServiceClient>(MockBehavior.Strict);
            GetCampaignLabelRequest request = new GetCampaignLabelRequest
            {
                ResourceName = new CampaignLabelName("[CUSTOMER]", "[CAMPAIGN_LABEL]").ToString(),
            };
            CampaignLabel expectedResponse = new CampaignLabel
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaignLabel(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CampaignLabelServiceClient client = new CampaignLabelServiceClientImpl(mockGrpcClient.Object, null);
            CampaignLabel response            = client.GetCampaignLabel(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetCampaignLabelAsync2()
        {
            Mock <CampaignLabelService.CampaignLabelServiceClient> mockGrpcClient = new Mock <CampaignLabelService.CampaignLabelServiceClient>(MockBehavior.Strict);
            GetCampaignLabelRequest request = new GetCampaignLabelRequest
            {
                ResourceName = new CampaignLabelName("[CUSTOMER]", "[CAMPAIGN_LABEL]").ToString(),
            };
            CampaignLabel expectedResponse = new CampaignLabel
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaignLabelAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CampaignLabel>(Task.FromResult(expectedResponse), null, null, null, null));
            CampaignLabelServiceClient client = new CampaignLabelServiceClientImpl(mockGrpcClient.Object, null);
            CampaignLabel response            = await client.GetCampaignLabelAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#7
0
        public void GetCampaignLabel()
        {
            moq::Mock <CampaignLabelService.CampaignLabelServiceClient> mockGrpcClient = new moq::Mock <CampaignLabelService.CampaignLabelServiceClient>(moq::MockBehavior.Strict);
            GetCampaignLabelRequest request = new GetCampaignLabelRequest
            {
                ResourceNameAsCampaignLabelName = gagvr::CampaignLabelName.FromCustomerCampaignLabel("[CUSTOMER]", "[CAMPAIGN_LABEL]"),
            };
            gagvr::CampaignLabel expectedResponse = new gagvr::CampaignLabel
            {
                ResourceNameAsCampaignLabelName = gagvr::CampaignLabelName.FromCustomerCampaignLabel("[CUSTOMER]", "[CAMPAIGN_LABEL]"),
                CampaignAsCampaignName          = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
                LabelAsLabelName = gagvr::LabelName.FromCustomerLabel("[CUSTOMER]", "[LABEL]"),
            };

            mockGrpcClient.Setup(x => x.GetCampaignLabel(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignLabelServiceClient client   = new CampaignLabelServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CampaignLabel       response = client.GetCampaignLabel(request.ResourceName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#8
0
        public async stt::Task GetCampaignLabelRequestObjectAsync()
        {
            moq::Mock <CampaignLabelService.CampaignLabelServiceClient> mockGrpcClient = new moq::Mock <CampaignLabelService.CampaignLabelServiceClient>(moq::MockBehavior.Strict);
            GetCampaignLabelRequest request = new GetCampaignLabelRequest
            {
                ResourceNameAsCampaignLabelName = gagvr::CampaignLabelName.FromCustomerCampaignLabel("[CUSTOMER]", "[CAMPAIGN_LABEL]"),
            };
            gagvr::CampaignLabel expectedResponse = new gagvr::CampaignLabel
            {
                ResourceNameAsCampaignLabelName = gagvr::CampaignLabelName.FromCustomerCampaignLabel("[CUSTOMER]", "[CAMPAIGN_LABEL]"),
                CampaignAsCampaignName          = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
                LabelAsLabelName = gagvr::LabelName.FromCustomerLabel("[CUSTOMER]", "[LABEL]"),
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            gagvr::CampaignLabel responseCancellationToken = await client.GetCampaignLabelAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async Task MutateCampaignLabelsAsync()
        {
            Mock <CampaignLabelService.CampaignLabelServiceClient> mockGrpcClient = new Mock <CampaignLabelService.CampaignLabelServiceClient>(MockBehavior.Strict);
            MutateCampaignLabelsRequest expectedRequest = new MutateCampaignLabelsRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateCampaignLabelsResponse expectedResponse = new MutateCampaignLabelsResponse();

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

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