コード例 #1
0
        public async stt::Task GetCampaignSharedSetRequestObjectAsync()
        {
            moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(moq::MockBehavior.Strict);
            GetCampaignSharedSetRequest request = new GetCampaignSharedSetRequest
            {
                ResourceNameAsCampaignSharedSetName = gagvr::CampaignSharedSetName.FromCustomerCampaignSharedSet("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]"),
            };
            gagvr::CampaignSharedSet expectedResponse = new gagvr::CampaignSharedSet
            {
                ResourceNameAsCampaignSharedSetName = gagvr::CampaignSharedSetName.FromCustomerCampaignSharedSet("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]"),
                Status = gagve::CampaignSharedSetStatusEnum.Types.CampaignSharedSetStatus.Enabled,
                CampaignAsCampaignName   = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
                SharedSetAsSharedSetName = gagvr::SharedSetName.FromCustomerSharedSet("[CUSTOMER]", "[SHARED_SET]"),
            };

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

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public async stt::Task MutateCampaignSharedSetsAsync()
        {
            moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(moq::MockBehavior.Strict);
            MutateCampaignSharedSetsRequest request = new MutateCampaignSharedSetsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CampaignSharedSetOperation(),
                },
            };
            MutateCampaignSharedSetsResponse expectedResponse = new MutateCampaignSharedSetsResponse
            {
                Results =
                {
                    new MutateCampaignSharedSetResult(),
                },
                PartialFailureError = new gr::Status(),
            };

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

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #3
0
        public void MutateCampaignSharedSets()
        {
            moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(moq::MockBehavior.Strict);
            MutateCampaignSharedSetsRequest request = new MutateCampaignSharedSetsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CampaignSharedSetOperation(),
                },
            };
            MutateCampaignSharedSetsResponse expectedResponse = new MutateCampaignSharedSetsResponse
            {
                Results =
                {
                    new MutateCampaignSharedSetResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCampaignSharedSets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignSharedSetServiceClient   client   = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignSharedSetsResponse response = client.MutateCampaignSharedSets(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCampaignSharedSetsRequestObject()
        {
            moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(moq::MockBehavior.Strict);
            MutateCampaignSharedSetsRequest request = new MutateCampaignSharedSetsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CampaignSharedSetOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateCampaignSharedSetsResponse expectedResponse = new MutateCampaignSharedSetsResponse
            {
                Results =
                {
                    new MutateCampaignSharedSetResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCampaignSharedSets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignSharedSetServiceClient   client   = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignSharedSetsResponse response = client.MutateCampaignSharedSets(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task MutateCampaignSharedSetsAsync2()
        {
            Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(MockBehavior.Strict);
            MutateCampaignSharedSetsRequest request = new MutateCampaignSharedSetsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCampaignSharedSetsResponse expectedResponse = new MutateCampaignSharedSetsResponse();

            mockGrpcClient.Setup(x => x.MutateCampaignSharedSetsAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateCampaignSharedSetsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            CampaignSharedSetServiceClient   client   = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignSharedSetsResponse response = await client.MutateCampaignSharedSetsAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCampaignSharedSets2()
        {
            Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(MockBehavior.Strict);
            MutateCampaignSharedSetsRequest request = new MutateCampaignSharedSetsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCampaignSharedSetsResponse expectedResponse = new MutateCampaignSharedSetsResponse();

            mockGrpcClient.Setup(x => x.MutateCampaignSharedSets(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CampaignSharedSetServiceClient   client   = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null);
            MutateCampaignSharedSetsResponse response = client.MutateCampaignSharedSets(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetCampaignSharedSet2()
        {
            Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(MockBehavior.Strict);
            GetCampaignSharedSetRequest request = new GetCampaignSharedSetRequest
            {
                ResourceName = new CampaignSharedSetName("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]").ToString(),
            };
            CampaignSharedSet expectedResponse = new CampaignSharedSet
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaignSharedSet(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CampaignSharedSetServiceClient client = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null);
            CampaignSharedSet response            = client.GetCampaignSharedSet(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetCampaignSharedSetAsync()
        {
            Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(MockBehavior.Strict);
            GetCampaignSharedSetRequest expectedRequest = new GetCampaignSharedSetRequest
            {
                ResourceName = new CampaignSharedSetName("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]").ToString(),
            };
            CampaignSharedSet expectedResponse = new CampaignSharedSet
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaignSharedSetAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CampaignSharedSet>(Task.FromResult(expectedResponse), null, null, null, null));
            CampaignSharedSetServiceClient client   = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null);
            string            formattedResourceName = new CampaignSharedSetName("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]").ToString();
            CampaignSharedSet response = await client.GetCampaignSharedSetAsync(formattedResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #9
0
        public void GetCampaignSharedSet()
        {
            moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(moq::MockBehavior.Strict);
            GetCampaignSharedSetRequest request = new GetCampaignSharedSetRequest
            {
                ResourceNameAsCampaignSharedSetName = gagvr::CampaignSharedSetName.FromCustomerCampaignSharedSet("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]"),
            };
            gagvr::CampaignSharedSet expectedResponse = new gagvr::CampaignSharedSet
            {
                ResourceNameAsCampaignSharedSetName = gagvr::CampaignSharedSetName.FromCustomerCampaignSharedSet("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]"),
                Status = gagve::CampaignSharedSetStatusEnum.Types.CampaignSharedSetStatus.Enabled,
                CampaignAsCampaignName   = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
                SharedSetAsSharedSetName = gagvr::SharedSetName.FromCustomerSharedSet("[CUSTOMER]", "[SHARED_SET]"),
            };

            mockGrpcClient.Setup(x => x.GetCampaignSharedSet(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignSharedSetServiceClient client   = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CampaignSharedSet       response = client.GetCampaignSharedSet(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #10
0
        public async Task MutateCampaignSharedSetsAsync()
        {
            Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(MockBehavior.Strict);
            MutateCampaignSharedSetsRequest expectedRequest = new MutateCampaignSharedSetsRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateCampaignSharedSetsResponse expectedResponse = new MutateCampaignSharedSetsResponse();

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

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