Beispiel #1
0
        public KpiController(IRegionRepository regionRepository,
            ITownRepository townRepository,
            ITopCellRepository<CdmaRegionStat> cdmaStatRepository,
            ITopCellRepository<TopDrop2GCell> topDrop2GRepository,
            ITopCellRepository<TopDrop2GCellDaily> topDrop2GDailyRepository,
            ITopCellRepository<TopConnection3GCell> topConnection3GRepository,
            ITopCellRepository<TownPreciseCoverage4GStat> townPrecise4GRepository,
            IBtsRepository btsRepository,
            IENodebRepository eNodebRepository)
        {
            this.regionRepository = regionRepository;
            this.townRepository = townRepository;
            this.cdmaStatRepository = cdmaStatRepository;
            this.topDrop2GRepository = topDrop2GRepository;

            this.topDrop2GDailyRepository = topDrop2GDailyRepository;
            this.topConnection3GRepository = topConnection3GRepository;

            this.townPrecise4GRepository = townPrecise4GRepository;
            this.btsRepository = btsRepository;
            this.eNodebRepository = eNodebRepository;

            this.Initialize(topDrop2GRepository, topConnection3GRepository);
            regionNamesService = new QueryRegionCityNamesService(this.regionRepository.GetAll());
            districtNamesService = new QueryDistinctDistrictNamesService(this.townRepository.GetAll());
        }
 public int ConstructTestId()
 {
     service = new QueryDistinctCityNamesService(repository.GetAll());
     return service.QueryCount();
 }
 public int ConstructTestId(int cityId)
 {
     service = new QueryDistinctDistrictNamesService(repository.GetAll(), "C-" + cityId);
     return service.QueryCount();
 }
 public RegionViewModelInitializeTestHelper(IEnumerable<Town> towns, RegionViewModel viewModel)
 {
     this.towns = towns;
     this.viewModel = viewModel;
     service = new QueryDistinctCityNamesService(towns);
 }
 public int ConstructTestCities()
 {
     service = new QueryRegionCityNamesService(repository.GetAll());
     return service.QueryCount();
 }
 public int ConstructTestRegions()
 {
     service = new QueryOptimizeRegionNamesService(repository.GetAll());
     return service.QueryCount();
 }
 public int ConstructRegions(int cityId, int districtId)
 {
     service = new ByCityDistrictQueryRegionCityNamesService(
         repository.GetAll(), "C-" + cityId, "D-" + districtId);
     return service.QueryCount();
 }
 private void UpdateServices(RegionViewModel viewModel)
 {
     districtService = new QueryDistinctDistrictNamesService(townRepository.GetAll(), viewModel.CityName);
     townService = new QueryDistinctTownNamesService(townRepository.GetAll(),
         viewModel.CityName, viewModel.DistrictName);
 }
 public RegionAndAddTownTestHelper(RegionController controller, ITownRepository townRepository)
 {
     this.controller = controller;
     this.townRepository = townRepository;
     cityService = new QueryDistinctCityNamesService(townRepository.GetAll());
 }
 public IRegionDefViewModelTestHelper(ITownDefViewModel viewModel, IEnumerable<Town> towns)
 {
     this.viewModel = viewModel;
     this.towns = towns;
     service = new QueryDistinctCityNamesService(towns);
 }
 public void AssertTest(string cityName = "", string districtName = "", string townName = "")
 {
     ViewResult result = controller.Region();
     RegionViewModel viewModel = result.Model as RegionViewModel;
     Assert.IsNotNull(viewModel);
     if (!string.IsNullOrEmpty(cityName)) { viewModel.CityName = cityName; }
     if (!string.IsNullOrEmpty(districtName)) { viewModel.DistrictName = districtName; }
     if (!string.IsNullOrEmpty(townName)) { viewModel.TownName = townName; }
     controller.DeleteTown(viewModel);
     if (controller.TempData["error"] == null)
     {
         Assert.AreEqual(controller.TempData["success"].ToString(), viewModel.DeleteSuccessMessage);
         result = controller.Region();
         viewModel = result.Model as RegionViewModel;
         Assert.IsNotNull(viewModel);
         Assert.IsNotNull(viewModel.CityList);
         Assert.IsNotNull(viewModel.DistrictList);
         Assert.IsNotNull(viewModel.TownList);
         Town town = townRepository.GetAll().First();
         Assert.AreEqual(viewModel.CityName, town.CityName);
         Assert.AreEqual(viewModel.DistrictName, town.DistrictName);
         Assert.AreEqual(viewModel.TownName, town.TownName);
         Assert.AreEqual(viewModel.CityList.Count, service.QueryCount());
         service = new QueryDistinctDistrictNamesService(townRepository.GetAll(), viewModel.CityName);
         Assert.AreEqual(viewModel.DistrictList.Count, service.QueryCount());
         service = new QueryDistinctTownNamesService(townRepository.GetAll(), viewModel.CityName,
             viewModel.DistrictName);
         Assert.AreEqual(viewModel.TownList.Count, service.QueryCount());
     }
 }