public void TestTopDrop2GCellCsv_CdrCallsHourInfo() { CdrCallsHourInfo info = stats[3].GenerateHourInfo <CdrCallsHourInfo, int>(); info.AssertHourTest(new[] { 79, 48, 42, 14, 4, 2, 9, 40, 160, 488, 606, 578, 488, 469, 476, 595, 473, 506, 427, 174, 215, 208, 173, 88 }); }
public void Test_GenerateDropsHourDistribution_CdrCallsHourInfo( int[] values) { CdrCallsHourInfo info = new CdrCallsHourInfo { Hour0Info = values[0], Hour1Info = values[1], Hour2Info = values[2], Hour3Info = values[3], Hour4Info = values[4], Hour5Info = values[5], Hour6Info = values[6], Hour7Info = values[7], Hour8Info = values[8], Hour9Info = values[9], Hour10Info = values[10], Hour11Info = values[11], Hour12Info = values[12], Hour13Info = values[13], Hour14Info = values[14], Hour15Info = values[15], Hour16Info = values[16], Hour17Info = values[17], Hour18Info = values[18], Hour19Info = values[19], Hour20Info = values[20], Hour21Info = values[21], Hour22Info = values[22], Hour23Info = values[23] }; statList.Add(new TopDrop2GCellDaily { CellId = 1, SectorId = 2, Frequency = 3, StatTime = DateTime.Today, CdrCallsHourInfo = info }); mockRepository.SetupGet(x => x.Stats).Returns(statList.AsQueryable()); List <DropsHourDistribution> distribution = _service.GenerateDropsHourDistribution(); Assert.AreEqual(distribution.Count, 24); for (int i = 0; i < 24; i++) { Assert.AreEqual(distribution[i].CdrCalls, values[i]); } }
public void Test_GenerateDropsHourDistribution_CdrCallsHourInfo( int[] values) { CdrCallsHourInfo info = new CdrCallsHourInfo { Hour0Info = values[0], Hour1Info = values[1], Hour2Info = values[2], Hour3Info = values[3], Hour4Info = values[4], Hour5Info = values[5], Hour6Info = values[6], Hour7Info = values[7], Hour8Info = values[8], Hour9Info = values[9], Hour10Info = values[10], Hour11Info = values[11], Hour12Info = values[12], Hour13Info = values[13], Hour14Info = values[14], Hour15Info = values[15], Hour16Info = values[16], Hour17Info = values[17], Hour18Info = values[18], Hour19Info = values[19], Hour20Info = values[20], Hour21Info = values[21], Hour22Info = values[22], Hour23Info = values[23] }; statList.Add(new TopDrop2GCellDaily { CellId = 1, SectorId = 2, Frequency = 3, StatTime = DateTime.Today, CdrCallsHourInfo = info }); mockRepository.Setup(x => x.GetAll()).Returns(statList.AsQueryable()); List<DropsHourDistribution> distribution = _service.GenerateDropsHourDistribution(); Assert.AreEqual(distribution.Count, 24); for (int i = 0; i < 24; i++) { Assert.AreEqual(distribution[i].CdrCalls, values[i]); } }
public static void Import(this List<DropsHourDistribution> result, CdrCallsHourInfo cdrCallsInfo, CdrDropsHourInfo cdrDropsInfo, ErasureDropsHourInfo erasureDropsInfo, KpiCallsHourInfo kpiCallsInfo, KpiDropsHourInfo kpiDropsInfo) { for (int hour = 0; hour < 24; hour++) { string propertyName = "Hour" + hour + "Info"; PropertyInfo cdrCallsProperty = (typeof(CdrCallsHourInfo)).GetProperty(propertyName); PropertyInfo cdrDropsProperty = (typeof(CdrDropsHourInfo)).GetProperty(propertyName); PropertyInfo erasureDropsProperty = (typeof(ErasureDropsHourInfo)).GetProperty(propertyName); PropertyInfo kpiCallsProperty = (typeof(KpiCallsHourInfo)).GetProperty(propertyName); PropertyInfo kpiDropsProperty = (typeof(KpiDropsHourInfo)).GetProperty(propertyName); result.Add(new DropsHourDistribution { Hour = hour, CdrCalls = (cdrCallsInfo == null) ? 0 : (int)cdrCallsProperty.GetValue(cdrCallsInfo), CdrDrops = (cdrDropsInfo == null) ? 0 : (int)cdrDropsProperty.GetValue(cdrDropsInfo), ErasureDrops = (erasureDropsInfo == null) ? 0 : (int)erasureDropsProperty.GetValue(erasureDropsInfo), KpiCalls = (kpiCallsInfo == null) ? 0 : (int)kpiCallsProperty.GetValue(kpiCallsInfo), KpiDrops = (kpiDropsInfo == null) ? 0 : (int)kpiDropsProperty.GetValue(kpiDropsInfo) }); } }