public void Test_Construct(int btsId, byte sectorId, int cellId, bool outdoor, string indoor, double height, double eTilt, double mTilt, string lac) { var cell = new CdmaCell { BtsId = btsId, SectorId = sectorId, CellId = cellId, IsOutdoor = outdoor, Height = height, ETilt = eTilt, MTilt = mTilt, Lac = lac }; var view = CdmaCellView.ConstructView(cell, _repository.Object); if (btsId > 0 && btsId <= 3) Assert.AreEqual(view.BtsName, "Bts-" + btsId); else { Assert.IsNull(view.BtsName); } Assert.AreEqual(view.BtsId, btsId); Assert.AreEqual(view.SectorId, sectorId); Assert.AreEqual(view.CellId, cellId); Assert.AreEqual(view.Indoor, indoor); Assert.AreEqual(view.Height, height); Assert.AreEqual(view.DownTilt, eTilt + mTilt); Assert.AreEqual(view.Lac, lac); }
public void Test_CdmaCompoundCellView() { var info = new CdmaCell { ETilt = 0.2, MTilt = 0.3, IsOutdoor = false }; var view = info.MapTo<CdmaCompoundCellView>(); view.DownTilt.ShouldBe(0.5); view.Indoor.ShouldBe("室内"); }
public static CdmaCompoundCellView ConstructView(CdmaCell onexCell, CdmaCell evdoCell, IBtsRepository repository) { CdmaCompoundCellView view = null; if (onexCell != null) { view = Mapper.Map<CdmaCell, CdmaCompoundCellView>(onexCell); view.OnexFrequencyList = onexCell.FrequencyList; if (evdoCell != null) view.EvdoFrequencyList = evdoCell.FrequencyList; } else if (evdoCell != null) { view = Mapper.Map<CdmaCell, CdmaCompoundCellView>(evdoCell); view.EvdoFrequencyList = evdoCell.FrequencyList; } if (view != null) { var bts = repository.GetByBtsId(view.BtsId); view.BtsName = bts?.Name; } return view; }
public static CdmaCellView ConstructView(CdmaCell cell, IBtsRepository repository) { var view = Mapper.Map<CdmaCell, CdmaCellView>(cell); var bts = repository.GetByBtsId(cell.BtsId); view.BtsName = bts?.Name; return view; }
public void Test_Import_UpdateThirdFrequency( int btsId, byte sectorId, int cellId, short frequency, string cellType, double antennaGain, short overallFrequency) { var cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 3, Frequency = 3, CellType = "DO", AntennaGain = 12.8, Frequency1 = 37, Frequency2 = 78 }; var cellExcelInfo = new CdmaCellExcel { BtsId = btsId, SectorId = sectorId, CellId = cellId, Frequency = frequency, CellType = cellType, AntennaGain = antennaGain }; cell.Import(cellExcelInfo); Assert.AreEqual(cell.BtsId, 1, "btsId"); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 3); Assert.AreEqual(cell.CellType, "DO"); Assert.AreEqual(cell.Frequency, overallFrequency, "frequency"); Assert.AreEqual(cell.Frequency1, 37); Assert.AreEqual(cell.Frequency2, 78); Assert.AreEqual(cell.Frequency3, frequency == 37 || frequency == 78 || !frequency.IsCdmaFrequency() ? -1 : frequency); Assert.AreEqual(cell.AntennaGain, frequency == 37 || frequency == 78 || !frequency.IsCdmaFrequency() ? 12.8 : antennaGain); }
public void Test_Import_UpdateFirstFrequency( int btsId, byte sectorId, int cellId, short frequency, string cellType, double antennaGain, short overallFrequency) { var cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 3, Frequency = 0, CellType = "DO", AntennaGain = 12.8, Frequency1 = -1 }; var cellExcelInfo = new CdmaCellExcel { BtsId = btsId, SectorId = sectorId, CellId = cellId, Frequency = frequency, CellType = cellType, AntennaGain = antennaGain }; cell.Import(cellExcelInfo); Assert.AreEqual(cell.BtsId, 1, "btsId"); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 3); Assert.AreEqual(cell.CellType, "DO"); Assert.AreEqual(cell.Frequency, overallFrequency, "frequency"); Assert.AreEqual(cell.Frequency1, overallFrequency == 0 ? -1 : frequency, "frequency1"); Assert.AreEqual(cell.AntennaGain, overallFrequency != 0 ? antennaGain : 12.8); Assert.AreEqual(cell.HasFrequency(frequency), overallFrequency != 0); }