public void Test_Save(int[] eNodebIds, int[] townIds, byte[] sectorIds, int[] kpis, int[] resultTownIds, int[] resultKpis, int count) { eNodebs = eNodebIds.Select((e, i) => new ENodeb { ENodebId = e, TownId = townIds[i] }); SaveTimeTownStatsService <FakeTownTimeStat, FakeCell> service = new SaveTimeTownStatsService <FakeTownTimeStat, FakeCell>(repository.Object, eNodebs); List <FakeCell> infos = eNodebIds.Select((c, i) => new FakeCell { CellId = c, SectorId = sectorIds[i], Kpi = kpis[i], StatTime = DateTime.Today }).ToList(); int resultCount = service.Save(infos); Assert.AreEqual(resultCount, count); for (int i = 0; i < count; i++) { FakeTownTimeStat stat = repository.Object.Stats.ElementAt(i); Assert.AreEqual(stat.TownId, resultTownIds[i]); Assert.AreEqual(stat.Kpi, resultKpis[i]); } }
public Precise4GCoverageImporter( ITopCellRepository <PreciseCoverage4G> cellStatRepository, ITopCellRepository <TownPreciseCoverage4GStat> townStatRepository, IEnumerable <ENodeb> eNodebs) { cellStatService = new SaveTimeSingleKpiStatsService <PreciseCoverage4G, PreciseCoverage4GCsv>( cellStatRepository); _timeTownStatService = new SaveTimeTownStatsService <TownPreciseCoverage4GStat, PreciseCoverage4GCsv>( townStatRepository, eNodebs); }
public Precise4GCoverageImporter( ITopCellRepository<PreciseCoverage4G> cellStatRepository, ITopCellRepository<TownPreciseCoverage4GStat> townStatRepository, IEnumerable<ENodeb> eNodebs) { cellStatService = new SaveTimeSingleKpiStatsService<PreciseCoverage4G, PreciseCoverage4GCsv>( cellStatRepository); _timeTownStatService = new SaveTimeTownStatsService<TownPreciseCoverage4GStat, PreciseCoverage4GCsv>( townStatRepository, eNodebs); }
public void Test_Save_ExistedDateConsidered( int[] eNodebIds, int[] townIds, byte[] sectorIds, int[] kpis, string[] dateStrings, int[] resultTownIds, int[] resultKpis, string[] resultDates, string[] existedDates, int count) { eNodebs = eNodebIds.Select((e, i) => new ENodeb { ENodebId = e, TownId = townIds[i] }); repository.SetupGet(x => x.Stats).Returns(existedDates.Select(x => new FakeTownTimeStat { StatTime = DateTime.Parse(x), TownId = 101, Kpi = 1002 }).AsQueryable()); SaveTimeTownStatsService <FakeTownTimeStat, FakeCell> service = new SaveTimeTownStatsService <FakeTownTimeStat, FakeCell>(repository.Object, eNodebs); List <FakeCell> infos = eNodebIds.Select((c, i) => new FakeCell { CellId = c, SectorId = sectorIds[i], Kpi = kpis[i], StatTime = DateTime.Parse(dateStrings[i]) }).ToList(); int resultCount = service.Save(infos); Assert.AreEqual(resultCount, count); for (int i = 0; i < count; i++) { FakeTownTimeStat stat = repository.Object.Stats.ElementAt(i + existedDates.Length); Assert.AreEqual(stat.TownId, resultTownIds[i]); Assert.AreEqual(stat.Kpi, resultKpis[i]); Assert.AreEqual(stat.StatTime, DateTime.Parse(resultDates[i])); } }
public void Test_Save(int[] eNodebIds, int[] townIds, byte[] sectorIds, int[] kpis, int[] resultTownIds, int[] resultKpis, int count) { eNodebs = eNodebIds.Select((e, i) => new ENodeb { ENodebId = e, TownId = townIds[i] }); SaveTimeTownStatsService<FakeTownTimeStat, FakeCell> service = new SaveTimeTownStatsService<FakeTownTimeStat, FakeCell>(repository.Object, eNodebs); List<FakeCell> infos = eNodebIds.Select((c, i) => new FakeCell { CellId = c, SectorId = sectorIds[i], Kpi = kpis[i], StatTime = DateTime.Today }).ToList(); int resultCount = service.Save(infos); Assert.AreEqual(resultCount, count); for (int i = 0; i < count; i++) { FakeTownTimeStat stat = repository.Object.GetAll().ElementAt(i); Assert.AreEqual(stat.TownId,resultTownIds[i]); Assert.AreEqual(stat.Kpi,resultKpis[i]); } }
public void Test_Save_ExistedDateConsidered( int[] eNodebIds, int[] townIds, byte[] sectorIds, int[] kpis, string[] dateStrings, int[] resultTownIds, int[] resultKpis, string[] resultDates, string[] existedDates, int count) { eNodebs = eNodebIds.Select((e, i) => new ENodeb { ENodebId = e, TownId = townIds[i] }); repository.Setup(x => x.GetAll()).Returns(existedDates.Select(x => new FakeTownTimeStat { StatTime = DateTime.Parse(x), TownId = 101, Kpi = 1002 }).AsQueryable()); SaveTimeTownStatsService<FakeTownTimeStat, FakeCell> service = new SaveTimeTownStatsService<FakeTownTimeStat, FakeCell>(repository.Object, eNodebs); List<FakeCell> infos = eNodebIds.Select((c, i) => new FakeCell { CellId = c, SectorId = sectorIds[i], Kpi = kpis[i], StatTime = DateTime.Parse(dateStrings[i]) }).ToList(); int resultCount = service.Save(infos); Assert.AreEqual(resultCount, count); for (int i = 0; i < count; i++) { FakeTownTimeStat stat = repository.Object.GetAll().ElementAt(i + existedDates.Length); Assert.AreEqual(stat.TownId, resultTownIds[i]); Assert.AreEqual(stat.Kpi, resultKpis[i]); Assert.AreEqual(stat.StatTime, DateTime.Parse(resultDates[i])); } }