Ejemplo n.º 1
0
        public async stt::Task GetAdGroupCriterionSimulationRequestObjectAsync()
        {
            moq::Mock <AdGroupCriterionSimulationService.AdGroupCriterionSimulationServiceClient> mockGrpcClient = new moq::Mock <AdGroupCriterionSimulationService.AdGroupCriterionSimulationServiceClient>(moq::MockBehavior.Strict);
            GetAdGroupCriterionSimulationRequest request = new GetAdGroupCriterionSimulationRequest
            {
                ResourceNameAsAdGroupCriterionSimulationName = gagvr::AdGroupCriterionSimulationName.FromCustomerAdGroupCriterionTypeModificationMethodStartDateEndDate("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]", "[TYPE]", "[MODIFICATION_METHOD]", "[START_DATE]", "[END_DATE]"),
            };
            gagvr::AdGroupCriterionSimulation expectedResponse = new gagvr::AdGroupCriterionSimulation
            {
                ResourceNameAsAdGroupCriterionSimulationName = gagvr::AdGroupCriterionSimulationName.FromCustomerAdGroupCriterionTypeModificationMethodStartDateEndDate("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]", "[TYPE]", "[MODIFICATION_METHOD]", "[START_DATE]", "[END_DATE]"),
                Type = gagve::SimulationTypeEnum.Types.SimulationType.PercentCpcBid,
                ModificationMethod     = gagve::SimulationModificationMethodEnum.Types.SimulationModificationMethod.Unknown,
                CpcBidPointList        = new gagvc::CpcBidSimulationPointList(),
                AdGroupId              = -2072405675042603230L,
                CriterionId            = 8584655242409302840L,
                StartDate              = "start_date11b9dbea",
                EndDate                = "end_date89dae890",
                PercentCpcBidPointList = new gagvc::PercentCpcBidSimulationPointList(),
            };

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

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetAdGroupCriterionSimulationAsync2()
        {
            Mock <AdGroupCriterionSimulationService.AdGroupCriterionSimulationServiceClient> mockGrpcClient = new Mock <AdGroupCriterionSimulationService.AdGroupCriterionSimulationServiceClient>(MockBehavior.Strict);
            GetAdGroupCriterionSimulationRequest request = new GetAdGroupCriterionSimulationRequest
            {
                ResourceName = new AdGroupCriterionSimulationName("[CUSTOMER]", "[AD_GROUP_CRITERION_SIMULATION]").ToString(),
            };
            AdGroupCriterionSimulation expectedResponse = new AdGroupCriterionSimulation
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetAdGroupCriterionSimulationAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <AdGroupCriterionSimulation>(Task.FromResult(expectedResponse), null, null, null, null));
            AdGroupCriterionSimulationServiceClient client = new AdGroupCriterionSimulationServiceClientImpl(mockGrpcClient.Object, null);
            AdGroupCriterionSimulation response            = await client.GetAdGroupCriterionSimulationAsync(request);

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