Пример #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 Precise4GView ConstructView(PreciseCoverage4G stat, IENodebRepository repository)
        {
            var view   = Mapper.Map <PreciseCoverage4G, Precise4GView>(stat);
            var eNodeb = repository.GetByENodebId(stat.CellId);

            view.ENodebName = eNodeb?.Name;
            return(view);
        }
Пример #3
0
        public Precise4GView GetOneWeekStats(int cellId, byte sectorId, DateTime date)
        {
            var begin   = date.AddDays(-7);
            var end     = date;
            var stats   = GetTimeSpanStats(cellId, sectorId, begin, end).ToArray();
            var sumStat = new PreciseCoverage4G
            {
                CellId          = cellId,
                SectorId        = sectorId,
                FirstNeighbors  = stats.Sum(q => q.FirstNeighbors),
                SecondNeighbors = stats.Sum(q => q.SecondNeighbors),
                ThirdNeighbors  = stats.Sum(q => q.ThirdNeighbors),
                TotalMrs        = stats.Sum(q => q.TotalMrs)
            };

            return(Precise4GView.ConstructView(sumStat, _eNodebRepository));
        }
Пример #4
0
        public void Test_Constructor(string statTime, int cellId, byte sectorId, int totalMrs, double firstRate,
                                     double secondRate, double thirdRate)
        {
            var info = new PreciseCoverage4GCsv
            {
                StatTime           = DateTime.Parse(statTime),
                CellId             = cellId,
                SectorId           = sectorId,
                TotalMrs           = totalMrs,
                FirstNeighborRate  = firstRate,
                SecondNeighborRate = secondRate,
                ThirdNeighborRate  = thirdRate
            };
            var stat = PreciseCoverage4G.ConstructStat(info);

            Assert.AreEqual(stat.StatTime, DateTime.Parse(statTime));
            Assert.AreEqual(stat.CellId, cellId);
            Assert.AreEqual(stat.SectorId, sectorId);
            Assert.AreEqual(stat.TotalMrs, totalMrs);
            Assert.AreEqual(stat.FirstNeighbors, (int)(totalMrs * firstRate) / 100);
            Assert.AreEqual(stat.SecondNeighbors, (int)(totalMrs * secondRate) / 100);
            Assert.AreEqual(stat.ThirdNeighbors, (int)(totalMrs * thirdRate) / 100);
        }
Пример #5
0
 public void Test_Construction(int cellId, byte sectorId, int totalMrs,
     double thirdRate, double secondRate, double firstRate,
     int thirdCount, int secondCount, int firstCount)
 {
     PreciseCoverage4GCsv info = new PreciseCoverage4GCsv
     {
         CellId = cellId,
         SectorId = sectorId,
         TotalMrs = totalMrs,
         ThirdNeighborRate = thirdRate,
         SecondNeighborRate = secondRate,
         FirstNeighborRate = firstRate,
         StatTime = DateTime.Today
     };
     PreciseCoverage4G resultCoverage4G = new PreciseCoverage4G();
     resultCoverage4G.Import(info);
     Assert.AreEqual(resultCoverage4G.CellId, cellId);
     Assert.AreEqual(resultCoverage4G.SectorId, sectorId);
     Assert.AreEqual(resultCoverage4G.StatTime, DateTime.Today);
     Assert.AreEqual(resultCoverage4G.ThirdNeighbors, thirdCount);
     Assert.AreEqual(resultCoverage4G.SecondNeighbors, secondCount);
     Assert.AreEqual(resultCoverage4G.FirstNeighbors, firstCount);
 }
        public void Test_Construction(int cellId, byte sectorId, int totalMrs,
                                      double thirdRate, double secondRate, double firstRate,
                                      int thirdCount, int secondCount, int firstCount)
        {
            PreciseCoverage4GCsv info = new PreciseCoverage4GCsv
            {
                CellId             = cellId,
                SectorId           = sectorId,
                TotalMrs           = totalMrs,
                ThirdNeighborRate  = thirdRate,
                SecondNeighborRate = secondRate,
                FirstNeighborRate  = firstRate,
                StatTime           = DateTime.Today
            };
            PreciseCoverage4G resultCoverage4G = new PreciseCoverage4G();

            resultCoverage4G.Import(info);
            Assert.AreEqual(resultCoverage4G.CellId, cellId);
            Assert.AreEqual(resultCoverage4G.SectorId, sectorId);
            Assert.AreEqual(resultCoverage4G.StatTime, DateTime.Today);
            Assert.AreEqual(resultCoverage4G.ThirdNeighbors, thirdCount);
            Assert.AreEqual(resultCoverage4G.SecondNeighbors, secondCount);
            Assert.AreEqual(resultCoverage4G.FirstNeighbors, firstCount);
        }