public void Test_GetByENodebAndLocalCellId()
        {
            var result = _repository.GetRecent(500814, 2);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.iDate, "20160318");
            Assert.AreEqual(result.InterFreqHoA5Thd1Rsrp, -109);
            Assert.AreEqual(result.InterFreqHoA5Thd1Rsrq, -24);
        }
        public List <CellInterFreqHoView> Query()
        {
            var results     = new List <CellInterFreqHoView>();
            var huaweiCell  = _huaweiCellRepository.GetRecent(_eNodebId, _sectorId);
            var localCellId = huaweiCell?.LocalCellId ?? _sectorId;
            var nFreqs      = _huaweiNFreqRepository.GetRecentList(_eNodebId, localCellId);
            var hoGroup     = _huaweiCellHoRepository.GetRecent(_eNodebId, localCellId);

            if (hoGroup == null)
            {
                return(null);
            }
            var intraFreqConfig = _intraFreqHoGroupRepository.GetRecent(_eNodebId, localCellId);

            foreach (var config in nFreqs.Select(freq => new CellInterFreqHoView
            {
                Earfcn = freq.DlEarfcn,
                InterFreqHoEventType = freq.InterFreqHoEventType,
                InterFreqEventA1 = Mapper.Map <InterFreqHoGroup, InterFreqEventA1>(hoGroup),
                InterFreqEventA2 = Mapper.Map <InterFreqHoGroup, InterFreqEventA2>(hoGroup),
                InterFreqEventA3 = Mapper.Map <InterFreqHoGroup, InterFreqEventA3>(hoGroup),
                InterFreqEventA4 = Mapper.Map <InterFreqHoGroup, InterFreqEventA4>(hoGroup),
                InterFreqEventA5 = Mapper.Map <InterFreqHoGroup, InterFreqEventA5>(hoGroup)
            }))
            {
                if (intraFreqConfig != null)
                {
                    config.InterFreqEventA3.Hysteresis    = intraFreqConfig.IntraFreqHoA3Hyst;
                    config.InterFreqEventA3.TimeToTrigger = intraFreqConfig.IntraFreqHoA3TimeToTrig;
                }
                switch (config.InterFreqHoEventType)
                {
                case 0:
                    config.InterFreqEventA1.ThresholdOfRsrp = hoGroup.A3InterFreqHoA1ThdRsrp;
                    config.InterFreqEventA2.ThresholdOfRsrp = hoGroup.A3InterFreqHoA2ThdRsrp;
                    config.InterFreqEventA1.ThresholdOfRsrq = hoGroup.A3InterFreqHoA1ThdRsrq;
                    config.InterFreqEventA2.ThresholdOfRsrq = hoGroup.A3InterFreqHoA2ThdRsrq;
                    break;

                default:
                    config.InterFreqEventA1.ThresholdOfRsrp = hoGroup.InterFreqHoA1ThdRsrp;
                    config.InterFreqEventA2.ThresholdOfRsrp = hoGroup.InterFreqHoA2ThdRsrp;
                    config.InterFreqEventA1.ThresholdOfRsrq = hoGroup.InterFreqHoA1ThdRsrq;
                    config.InterFreqEventA2.ThresholdOfRsrq = hoGroup.InterFreqHoA2ThdRsrq;
                    break;
                }
                results.Add(config);
            }
            return(results);
        }