コード例 #1
0
        public void GetCampaignCriterionSimulation()
        {
            moq::Mock <CampaignCriterionSimulationService.CampaignCriterionSimulationServiceClient> mockGrpcClient = new moq::Mock <CampaignCriterionSimulationService.CampaignCriterionSimulationServiceClient>(moq::MockBehavior.Strict);
            GetCampaignCriterionSimulationRequest request = new GetCampaignCriterionSimulationRequest
            {
                ResourceNameAsCampaignCriterionSimulationName = gagvr::CampaignCriterionSimulationName.FromCustomerCampaignCriterionSimulation("[CUSTOMER]", "[CAMPAIGN_CRITERION_SIMULATION]"),
            };
            gagvr::CampaignCriterionSimulation expectedResponse = new gagvr::CampaignCriterionSimulation
            {
                ResourceNameAsCampaignCriterionSimulationName = gagvr::CampaignCriterionSimulationName.FromCustomerCampaignCriterionSimulation("[CUSTOMER]", "[CAMPAIGN_CRITERION_SIMULATION]"),
                CampaignId           = -3743237468908008719L,
                CriterionId          = 8584655242409302840L,
                Type                 = gagve::SimulationTypeEnum.Types.SimulationType.CpvBid,
                ModificationMethod   = gagve::SimulationModificationMethodEnum.Types.SimulationModificationMethod.Unknown,
                StartDate            = "start_date11b9dbea",
                EndDate              = "end_date89dae890",
                BidModifierPointList = new gagvc::BidModifierSimulationPointList(),
            };

            mockGrpcClient.Setup(x => x.GetCampaignCriterionSimulation(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignCriterionSimulationServiceClient client   = new CampaignCriterionSimulationServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CampaignCriterionSimulation       response = client.GetCampaignCriterionSimulation(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public void GetCampaignCriterionSimulationRequestObject()
        {
            moq::Mock <CampaignCriterionSimulationService.CampaignCriterionSimulationServiceClient> mockGrpcClient = new moq::Mock <CampaignCriterionSimulationService.CampaignCriterionSimulationServiceClient>(moq::MockBehavior.Strict);
            GetCampaignCriterionSimulationRequest request = new GetCampaignCriterionSimulationRequest
            {
                ResourceNameAsCampaignCriterionSimulationName = gagvr::CampaignCriterionSimulationName.FromCustomerCampaignCriterionTypeModificationMethodStartDateEndDate("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[CRITERION_ID]", "[TYPE]", "[MODIFICATION_METHOD]", "[START_DATE]", "[END_DATE]"),
            };
            gagvr::CampaignCriterionSimulation expectedResponse = new gagvr::CampaignCriterionSimulation
            {
                ResourceNameAsCampaignCriterionSimulationName = gagvr::CampaignCriterionSimulationName.FromCustomerCampaignCriterionTypeModificationMethodStartDateEndDate("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[CRITERION_ID]", "[TYPE]", "[MODIFICATION_METHOD]", "[START_DATE]", "[END_DATE]"),
                Type = gagve::SimulationTypeEnum.Types.SimulationType.BidModifier,
                ModificationMethod   = gagve::SimulationModificationMethodEnum.Types.SimulationModificationMethod.Default,
                BidModifierPointList = new gagvc::BidModifierSimulationPointList(),
                CampaignId           = -3743237468908008719L,
                CriterionId          = 8584655242409302840L,
                StartDate            = "start_date11b9dbea",
                EndDate = "end_date89dae890",
            };

            mockGrpcClient.Setup(x => x.GetCampaignCriterionSimulation(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignCriterionSimulationServiceClient client   = new CampaignCriterionSimulationServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CampaignCriterionSimulation       response = client.GetCampaignCriterionSimulation(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetCampaignCriterionSimulation2()
        {
            Mock <CampaignCriterionSimulationService.CampaignCriterionSimulationServiceClient> mockGrpcClient = new Mock <CampaignCriterionSimulationService.CampaignCriterionSimulationServiceClient>(MockBehavior.Strict);
            GetCampaignCriterionSimulationRequest request = new GetCampaignCriterionSimulationRequest
            {
                ResourceName = new CampaignCriterionSimulationName("[CUSTOMER]", "[CAMPAIGN_CRITERION_SIMULATION]").ToString(),
            };
            CampaignCriterionSimulation expectedResponse = new CampaignCriterionSimulation
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaignCriterionSimulation(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CampaignCriterionSimulationServiceClient client = new CampaignCriterionSimulationServiceClientImpl(mockGrpcClient.Object, null);
            CampaignCriterionSimulation response            = client.GetCampaignCriterionSimulation(request);

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