Ejemplo n.º 1
0
        public async stt::Task GetCampaignCriterionSimulationRequestObjectAsync()
        {
            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.GetCampaignCriterionSimulationAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::CampaignCriterionSimulation>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CampaignCriterionSimulationServiceClient client = new CampaignCriterionSimulationServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CampaignCriterionSimulation       responseCallSettings = await client.GetCampaignCriterionSimulationAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetCampaignCriterionSimulationAsync2()
        {
            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.GetCampaignCriterionSimulationAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CampaignCriterionSimulation>(Task.FromResult(expectedResponse), null, null, null, null));
            CampaignCriterionSimulationServiceClient client = new CampaignCriterionSimulationServiceClientImpl(mockGrpcClient.Object, null);
            CampaignCriterionSimulation response            = await client.GetCampaignCriterionSimulationAsync(request);

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