Ejemplo n.º 1
0
        public void GetCampaign2()
        {
            Mock <CampaignService.CampaignServiceClient> mockGrpcClient = new Mock <CampaignService.CampaignServiceClient>(MockBehavior.Strict);
            GetCampaignRequest request = new GetCampaignRequest
            {
                ResourceName = new CampaignName("[CUSTOMER]", "[CAMPAIGN]").ToString(),
            };
            Campaign expectedResponse = new Campaign
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaign(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CampaignServiceClient client = new CampaignServiceClientImpl(mockGrpcClient.Object, null);
            Campaign response            = client.GetCampaign(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 2
0
        public void GetCampaignResourceNames()
        {
            moq::Mock <CampaignService.CampaignServiceClient> mockGrpcClient = new moq::Mock <CampaignService.CampaignServiceClient>(moq::MockBehavior.Strict);
            GetCampaignRequest request = new GetCampaignRequest
            {
                ResourceNameAsCampaignName = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
            };
            gagvr::Campaign expectedResponse = new gagvr::Campaign
            {
                ResourceNameAsCampaignName = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
                Id           = -6774108720365892680L,
                CampaignName = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
                Status       = gagve::CampaignStatusEnum.Types.CampaignStatus.Removed,
                CampaignBudgetAsCampaignBudgetName = gagvr::CampaignBudgetName.FromCustomerCampaignBudget("[CUSTOMER]", "[CAMPAIGN_BUDGET]"),
                AdServingOptimizationStatus        = gagve::AdServingOptimizationStatusEnum.Types.AdServingOptimizationStatus.ConversionOptimize,
                AdvertisingChannelType             = gagve::AdvertisingChannelTypeEnum.Types.AdvertisingChannelType.MultiChannel,
                AdvertisingChannelSubType          = gagve::AdvertisingChannelSubTypeEnum.Types.AdvertisingChannelSubType.VideoOutstream,
                TrackingUrlTemplate = "tracking_url_template157f152a",
                UrlCustomParameters =
                {
                    new gagvc::CustomParameter(),
                },
                NetworkSettings     = new gagvr::Campaign.Types.NetworkSettings(),
                ExperimentType      = gagve::CampaignExperimentTypeEnum.Types.CampaignExperimentType.Unknown,
                StartDate           = "start_date11b9dbea",
                EndDate             = "end_date89dae890",
                ServingStatus       = gagve::CampaignServingStatusEnum.Types.CampaignServingStatus.Ended,
                BiddingStrategyType = gagve::BiddingStrategyTypeEnum.Types.BiddingStrategyType.TargetCpa,
                BiddingStrategyAsBiddingStrategyName = gagvr::BiddingStrategyName.FromCustomerBiddingStrategy("[CUSTOMER]", "[BIDDING_STRATEGY]"),
                ManualCpc   = new gagvc::ManualCpc(),
                ManualCpm   = new gagvc::ManualCpm(),
                TargetCpa   = new gagvc::TargetCpa(),
                TargetSpend = new gagvc::TargetSpend(),
                BaseCampaignAsCampaignName = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
                TargetRoas              = new gagvc::TargetRoas(),
                MaximizeConversions     = new gagvc::MaximizeConversions(),
                MaximizeConversionValue = new gagvc::MaximizeConversionValue(),
                HotelSetting            = new gagvr::Campaign.Types.HotelSettingInfo(),
                DynamicSearchAdsSetting = new gagvr::Campaign.Types.DynamicSearchAdsSetting(),
                PercentCpc              = new gagvc::PercentCpc(),
                ShoppingSetting         = new gagvr::Campaign.Types.ShoppingSetting(),
                ManualCpv              = new gagvc::ManualCpv(),
                FinalUrlSuffix         = "final_url_suffix046ed37a",
                RealTimeBiddingSetting = new gagvc::RealTimeBiddingSetting(),
                FrequencyCaps          =
                {
                    new gagvc::FrequencyCapEntry(),
                },
                TargetCpm = new gagvc::TargetCpm(),
                VideoBrandSafetySuitability = gagve::BrandSafetySuitabilityEnum.Types.BrandSafetySuitability.Unknown,
                TargetingSetting            = new gagvc::TargetingSetting(),
                VanityPharma               = new gagvr::Campaign.Types.VanityPharma(),
                SelectiveOptimization      = new gagvr::Campaign.Types.SelectiveOptimization(),
                TrackingSetting            = new gagvr::Campaign.Types.TrackingSetting(),
                GeoTargetTypeSetting       = new gagvr::Campaign.Types.GeoTargetTypeSetting(),
                TargetImpressionShare      = new gagvc::TargetImpressionShare(),
                Commission                 = new gagvc::Commission(),
                AppCampaignSetting         = new gagvr::Campaign.Types.AppCampaignSetting(),
                PaymentMode                = gagve::PaymentModeEnum.Types.PaymentMode.Clicks,
                LabelsAsCampaignLabelNames =
                {
                    gagvr::CampaignLabelName.FromCustomerCampaignLabel("[CUSTOMER]", "[CAMPAIGN_LABEL]"),
                },
                OptimizationScore = -4.7741588361660064E+17,
            };

            mockGrpcClient.Setup(x => x.GetCampaign(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignServiceClient client   = new CampaignServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::Campaign       response = client.GetCampaign(request.ResourceNameAsCampaignName);

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