コード例 #1
0
        public void GetBiddingStrategyRequestObject()
        {
            moq::Mock <BiddingStrategyService.BiddingStrategyServiceClient> mockGrpcClient = new moq::Mock <BiddingStrategyService.BiddingStrategyServiceClient>(moq::MockBehavior.Strict);
            GetBiddingStrategyRequest request = new GetBiddingStrategyRequest
            {
                ResourceNameAsBiddingStrategyName = gagvr::BiddingStrategyName.FromCustomerBiddingStrategy("[CUSTOMER_ID]", "[BIDDING_STRATEGY_ID]"),
            };
            gagvr::BiddingStrategy expectedResponse = new gagvr::BiddingStrategy
            {
                ResourceNameAsBiddingStrategyName = gagvr::BiddingStrategyName.FromCustomerBiddingStrategy("[CUSTOMER_ID]", "[BIDDING_STRATEGY_ID]"),
                Type                    = gagve::BiddingStrategyTypeEnum.Types.BiddingStrategyType.ManualCpm,
                EnhancedCpc             = new gagvc::EnhancedCpc(),
                TargetCpa               = new gagvc::TargetCpa(),
                TargetRoas              = new gagvc::TargetRoas(),
                TargetSpend             = new gagvc::TargetSpend(),
                Status                  = gagve::BiddingStrategyStatusEnum.Types.BiddingStrategyStatus.Enabled,
                Id                      = -6774108720365892680L,
                BiddingStrategyName     = gagvr::BiddingStrategyName.FromCustomerBiddingStrategy("[CUSTOMER_ID]", "[BIDDING_STRATEGY_ID]"),
                CampaignCount           = 7086295369533367171L,
                NonRemovedCampaignCount = 8279371121198864414L,
                EffectiveCurrencyCode   = "effective_currency_code0045faae",
                MaximizeConversionValue = new gagvc::MaximizeConversionValue(),
                MaximizeConversions     = new gagvc::MaximizeConversions(),
                TargetImpressionShare   = new gagvc::TargetImpressionShare(),
            };

            mockGrpcClient.Setup(x => x.GetBiddingStrategy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            BiddingStrategyServiceClient client   = new BiddingStrategyServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::BiddingStrategy       response = client.GetBiddingStrategy(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public void GetBiddingStrategy2()
        {
            Mock <BiddingStrategyService.BiddingStrategyServiceClient> mockGrpcClient = new Mock <BiddingStrategyService.BiddingStrategyServiceClient>(MockBehavior.Strict);
            GetBiddingStrategyRequest request = new GetBiddingStrategyRequest
            {
                ResourceName = new BiddingStrategyName("[CUSTOMER]", "[BIDDING_STRATEGY]").ToString(),
            };
            BiddingStrategy expectedResponse = new BiddingStrategy
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetBiddingStrategy(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            BiddingStrategyServiceClient client = new BiddingStrategyServiceClientImpl(mockGrpcClient.Object, null);
            BiddingStrategy response            = client.GetBiddingStrategy(request);

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