Exemple #1
0
        public IEnumerable <SectorView> QuerySectors(SectorRangeContainer container)
        {
            var cells =
                _repository.GetAllList(container.West, container.East, container.South, container.North)
                .Where(x => x.IsInUse).ToList();

            if (container.ExcludedCells.Any())
            {
                var excludeCells = from cell in cells
                                   join sector in container.ExcludedCells on new
                {
                    CellId = cell.ENodebId,
                    cell.SectorId
                } equals new
                {
                    sector.CellId,
                    sector.SectorId
                }
                select cell;
                cells = cells.Except(excludeCells).ToList();
            }

            return(cells.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       cells.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : new List <SectorView>());
        }
 public void Test_GetExceptCells()
 {
     var container = new SectorRangeContainer
     {
         West = 113,
         East = 114,
         South = 22,
         North = 23,
         ExcludedCells = new List<CellIdPair>
         {
             new CellIdPair {CellId = 1, SectorId = 2}
         }
     };
     var cells = new List<Cell>
     {
         new Cell {ENodebId = 1, SectorId = 2},
         new Cell {ENodebId = 3, SectorId = 4}
     };
     var excludeCells = from cell in cells
         join sector in container.ExcludedCells on new
         {
             CellId = cell.ENodebId,
             cell.SectorId
         } equals new
         {
             sector.CellId,
             sector.SectorId
         }
         select cell;
     Assert.AreEqual(excludeCells.Count(), 1);
 }
 public void TestQuerySectors_ExcludedOneCell(int eNodebId, byte sectorId)
 {
     var container = new SectorRangeContainer
     {
         West = 113,
         East = 114,
         South = 22,
         North = 23,
         ExcludedCells = new List<CellIdPair>
         {
             new CellIdPair {CellId = eNodebId, SectorId = sectorId}
         }
     };
     var sectors = _service.QuerySectors(container);
     Assert.AreEqual(sectors.Count(), 5);
 }
Exemple #4
0
        public void TestQuerySectors_ExcludedOneCell(int eNodebId, byte sectorId)
        {
            var container = new SectorRangeContainer
            {
                West          = 113,
                East          = 114,
                South         = 22,
                North         = 23,
                ExcludedCells = new List <CellIdPair>
                {
                    new CellIdPair {
                        CellId = eNodebId, SectorId = sectorId
                    }
                }
            };
            var sectors = _service.QuerySectors(container);

            Assert.AreEqual(sectors.Count(), 5);
        }
Exemple #5
0
 public IEnumerable<SectorView> QuerySectors(SectorRangeContainer container)
 {
     var cells =
         _repository.GetAllList(container.West, container.East, container.South, container.North)
             .Where(x => x.IsInUse).ToList();
     var excludeCells = from cell in cells join sector in container.ExcludedCells on new
         {
             CellId = cell.ENodebId,
             cell.SectorId
         } equals new
         {
             sector.CellId,
             sector.SectorId
         } select cell;
     cells = cells.Except(excludeCells).ToList();
     return cells.Any()
         ? Mapper.Map<IEnumerable<CellView>, IEnumerable<SectorView>>(
             cells.Select(x => CellView.ConstructView(x, _eNodebRepository)))
         : new List<SectorView>();
 }
Exemple #6
0
        public void Test_GetExceptCells()
        {
            var container = new SectorRangeContainer
            {
                West          = 113,
                East          = 114,
                South         = 22,
                North         = 23,
                ExcludedCells = new List <CellIdPair>
                {
                    new CellIdPair {
                        CellId = 1, SectorId = 2
                    }
                }
            };
            var cells = new List <Cell>
            {
                new Cell {
                    ENodebId = 1, SectorId = 2
                },
                new Cell {
                    ENodebId = 3, SectorId = 4
                }
            };
            var excludeCells = from cell in cells
                               join sector in container.ExcludedCells on new
            {
                CellId = cell.ENodebId,
                cell.SectorId
            } equals new
            {
                sector.CellId,
                sector.SectorId
            }
            select cell;

            Assert.AreEqual(excludeCells.Count(), 1);
        }
 public IEnumerable <SectorView> Get(SectorRangeContainer container)
 {
     return(_service.QuerySectors(container));
 }
 public IEnumerable<SectorView> Get(SectorRangeContainer container)
 {
     return _service.QuerySectors(container);
 }