Example #1
0
        public void MutateSmartCampaignSettings()
        {
            moq::Mock <SmartCampaignSettingService.SmartCampaignSettingServiceClient> mockGrpcClient = new moq::Mock <SmartCampaignSettingService.SmartCampaignSettingServiceClient>(moq::MockBehavior.Strict);
            MutateSmartCampaignSettingsRequest request = new MutateSmartCampaignSettingsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new SmartCampaignSettingOperation(),
                },
            };
            MutateSmartCampaignSettingsResponse expectedResponse = new MutateSmartCampaignSettingsResponse
            {
                PartialFailureError = new gr::Status(),
                Results             =
                {
                    new MutateSmartCampaignSettingResult(),
                },
            };

            mockGrpcClient.Setup(x => x.MutateSmartCampaignSettings(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SmartCampaignSettingServiceClient   client   = new SmartCampaignSettingServiceClientImpl(mockGrpcClient.Object, null);
            MutateSmartCampaignSettingsResponse response = client.MutateSmartCampaignSettings(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #2
0
        public async stt::Task MutateSmartCampaignSettingsRequestObjectAsync()
        {
            moq::Mock <SmartCampaignSettingService.SmartCampaignSettingServiceClient> mockGrpcClient = new moq::Mock <SmartCampaignSettingService.SmartCampaignSettingServiceClient>(moq::MockBehavior.Strict);
            MutateSmartCampaignSettingsRequest request = new MutateSmartCampaignSettingsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new SmartCampaignSettingOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateSmartCampaignSettingsResponse expectedResponse = new MutateSmartCampaignSettingsResponse
            {
                PartialFailureError = new gr::Status(),
                Results             =
                {
                    new MutateSmartCampaignSettingResult(),
                },
            };

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

            Assert.AreEqual(expectedResponse, responseCallSettings);
            MutateSmartCampaignSettingsResponse responseCancellationToken = await client.MutateSmartCampaignSettingsAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task GetSmartCampaignSettingRequestObjectAsync()
        {
            moq::Mock <SmartCampaignSettingService.SmartCampaignSettingServiceClient> mockGrpcClient = new moq::Mock <SmartCampaignSettingService.SmartCampaignSettingServiceClient>(moq::MockBehavior.Strict);
            GetSmartCampaignSettingRequest request = new GetSmartCampaignSettingRequest
            {
                ResourceNameAsSmartCampaignSettingName = gagvr::SmartCampaignSettingName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
            };
            gagvr::SmartCampaignSetting expectedResponse = new gagvr::SmartCampaignSetting
            {
                ResourceNameAsSmartCampaignSettingName = gagvr::SmartCampaignSettingName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
                CampaignAsCampaignName = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
                PhoneNumber            = new gagvr::SmartCampaignSetting.Types.PhoneNumber(),
                FinalUrl                = "final_url01c3df1e",
                BusinessName            = "business_nameba1c7bb8",
                BusinessLocationId      = 7879742372906296557L,
                AdvertisingLanguageCode = "advertising_language_coded5ffed87",
            };

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

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void GetSmartCampaignSetting()
        {
            moq::Mock <SmartCampaignSettingService.SmartCampaignSettingServiceClient> mockGrpcClient = new moq::Mock <SmartCampaignSettingService.SmartCampaignSettingServiceClient>(moq::MockBehavior.Strict);
            GetSmartCampaignSettingRequest request = new GetSmartCampaignSettingRequest
            {
                ResourceNameAsSmartCampaignSettingName = gagvr::SmartCampaignSettingName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
            };
            gagvr::SmartCampaignSetting expectedResponse = new gagvr::SmartCampaignSetting
            {
                ResourceNameAsSmartCampaignSettingName = gagvr::SmartCampaignSettingName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
                CampaignAsCampaignName = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
                PhoneNumber            = new gagvr::SmartCampaignSetting.Types.PhoneNumber(),
                FinalUrl                = "final_url01c3df1e",
                BusinessName            = "business_nameba1c7bb8",
                BusinessLocationId      = 7879742372906296557L,
                AdvertisingLanguageCode = "advertising_language_coded5ffed87",
            };

            mockGrpcClient.Setup(x => x.GetSmartCampaignSetting(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SmartCampaignSettingServiceClient client   = new SmartCampaignSettingServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::SmartCampaignSetting       response = client.GetSmartCampaignSetting(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateSmartCampaignSettingsRequestObject()
        {
            moq::Mock <SmartCampaignSettingService.SmartCampaignSettingServiceClient> mockGrpcClient = new moq::Mock <SmartCampaignSettingService.SmartCampaignSettingServiceClient>(moq::MockBehavior.Strict);
            MutateSmartCampaignSettingsRequest request = new MutateSmartCampaignSettingsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new SmartCampaignSettingOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateSmartCampaignSettingsResponse expectedResponse = new MutateSmartCampaignSettingsResponse
            {
                PartialFailureError = new gr::Status(),
                Results             =
                {
                    new MutateSmartCampaignSettingResult(),
                },
            };

            mockGrpcClient.Setup(x => x.MutateSmartCampaignSettings(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SmartCampaignSettingServiceClient   client   = new SmartCampaignSettingServiceClientImpl(mockGrpcClient.Object, null);
            MutateSmartCampaignSettingsResponse response = client.MutateSmartCampaignSettings(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }