示例#1
0
 private async void GetValue(int cellCount, int townCount, int[] totalMrsByCell, double[] thirdNeighborCellCountsByCell,
                             double[] secondNeighborCellCountsByCell, double[] firstNeighborCellCountsByCell, int[] totalMrsByTown,
                             double[] thirdNeighborCellCountsByTown, double[] secondNeighborCellCountsByTown,
                             double[] firstNeighborCellCountsByTown, StreamReader reader)
 {
     Assert.AreEqual(await importer.ImportStat(reader, CsvFileDescription.CommaDescription), cellCount);
     Assert.AreEqual(cellRepository.Object.Stats.Count(), cellCount);
     Assert.AreEqual(townRepository.Object.Stats.Count(), townCount);
     for (int i = 0; i < cellCount; i++)
     {
         PreciseCoverage4G stat = cellRepository.Object.Stats.ElementAt(i);
         Assert.AreEqual(stat.TotalMrs, totalMrsByCell[i]);
         Assert.AreEqual(stat.ThirdNeighbors, (int)thirdNeighborCellCountsByCell[i]);
         Assert.AreEqual(stat.SecondNeighbors, (int)secondNeighborCellCountsByCell[i]);
         Assert.AreEqual(stat.FirstNeighbors, (int)firstNeighborCellCountsByCell[i]);
     }
     for (int i = 0; i < townCount; i++)
     {
         TownPreciseCoverage4GStat stat = townRepository.Object.Stats.ElementAt(i);
         Assert.AreEqual(stat.TotalMrs, totalMrsByTown[i]);
         Assert.AreEqual(stat.ThirdNeighbors, (int)thirdNeighborCellCountsByTown[i]);
         Assert.AreEqual(stat.SecondNeighbors, (int)secondNeighborCellCountsByTown[i]);
         Assert.AreEqual(stat.FirstNeighbors, (int)firstNeighborCellCountsByTown[i]);
     }
 }
示例#2
0
        public static TownPreciseView ConstructView(TownPreciseCoverage4GStat stat, ITownRepository repository)
        {
            var town = stat.TownId == -1 ? null : repository.Get(stat.TownId);
            var view = Mapper.Map <TownPreciseCoverage4GStat, TownPreciseView>(stat);

            view.City     = town?.CityName;
            view.District = town?.DistrictName;
            view.Town     = town?.TownName;
            return(view);
        }