public void AssertImportTwoDifferentRecordsResults(List<CdrTaRecord> details, 
     CdrRtdRecord record1, CdrRtdRecord record2)
 {
     AssertResultsWithTwoDetails(details, record1, record2);
     AssertDistributionParameters(details[0], record1);
     AssertDistributionParameters(details[1], record2);
 }
 protected void AssertResultsWithTwoDetails(List<CdrTaRecord> details, CdrRtdRecord record1,
     CdrRtdRecord record2)
 {
     Assert.AreEqual(details.Count, 2);
     AssertBasicParameters(details[0], record1);
     AssertBasicParameters(details[1], record2);
 }
Пример #3
0
 public void Test_Contructor_FromFields(string fields, int cellId, byte sectorId, double rtd)
 {
     CdrRtdRecord record = new CdrRtdRecord(fields.Split(','));
     Assert.AreEqual(record.CellId, cellId);
     Assert.AreEqual(record.SectorId, sectorId);
     Assert.AreEqual(record.Rtd, rtd, Eps);
 }
Пример #4
0
 private void Import(List<CdrTaRecord> details, CdrRtdRecord record)
 {
     ImportCdrTaRecordsService service = new ImportMainCdrTaRecordsService(details, record);
     service.Import();
     service = new ImportExcessCdrTaRecordsService(details, record);
     service.Import();
 }
 private void AssertBasicParameters(CdrTaRecord details, CdrRtdRecord record)
 {
     Assert.AreEqual(details.CellId, record.CellId);
     Assert.AreEqual(details.SectorId, record.SectorId);
     Assert.AreEqual(details.TaMax, record.Rtd, 1E-6);
     Assert.AreEqual(details.TaMin, record.Rtd, 1E-6);
     Assert.AreEqual(details.TaAverage, record.Rtd, 1E-6);
 }
Пример #6
0
        private void GenerateDetails(List<CdrTaRecord> details)
        {
            string[] segments = line.GetSplittedFields(';');
            CdrRtdRecord record = new CdrRtdRecord(segments[1].GetSplittedFields('_'));
            Import(details, record);

            record = new CdrRtdRecord(segments[2].GetSplittedFields('_'));
            Import(details, record);
        }
 public void AssertImportTwoSameRecordsResults(List<CdrTaRecord> details, CdrRtdRecord record)
 {
     AssertResultsWithOneDetails(details, record);
     Assert.AreEqual(details[0].TaSum, 2 * record.Rtd, 1E-6);
     if (InterferenceStat.IsInnerBound(record.Rtd))
     {
         Assert.AreEqual(details[0].TaInnerIntervalNum, 2);
         Assert.AreEqual(details[0].TaOuterIntervalNum, 0);
     }
     else
     {
         Assert.AreEqual(details[0].TaInnerIntervalNum, 0);
         Assert.AreEqual(details[0].TaOuterIntervalNum, 2);
     }
 }
Пример #8
0
 public void Test_Constructor_FromMrRecord(int cellId, byte sectorId, byte ta)
 {
     MrRecord mrRecord = new MroRecord
     {
         RefCell = new MrReferenceCell
         {
             CellId = cellId,
             SectorId = sectorId,
             Ta = ta
         }
     };
     CdrRtdRecord record = new CdrRtdRecord(mrRecord);
     Assert.AreEqual(record.CellId, cellId);
     Assert.AreEqual(record.SectorId, sectorId);
     Assert.AreEqual(record.Rtd, ta * 78.12, Eps);
 }
 public void AssertImportTwoRecordsWithSameCellResults(List<CdrTaRecord> details,
     CdrRtdRecord record1, CdrRtdRecord record2)
 {
     Assert.AreEqual(details.Count, 1);
     Assert.AreEqual(details[0].CellId, record1.CellId);
     Assert.AreEqual(details[0].SectorId, record1.SectorId);
     Assert.AreEqual(details[0].TaMax, Math.Max(record1.Rtd, record2.Rtd), 1E-6);
     Assert.AreEqual(details[0].TaMin, Math.Min(record1.Rtd, record2.Rtd), 1E-6);
     Assert.AreEqual(details[0].TaAverage, (record1.Rtd + record2.Rtd) / 2, 1E-6);
     Assert.AreEqual(details[0].TaSum, record1.Rtd + record2.Rtd, 1E-6);
     Assert.AreEqual(details[0].TaInnerIntervalNum,
         (InterferenceStat.IsInnerBound(record1.Rtd) ? 1 : 0)
         + (InterferenceStat.IsInnerBound(record2.Rtd) ? 1 : 0));
     Assert.AreEqual(details[0].TaOuterIntervalNum,
         (InterferenceStat.IsInnerBound(record1.Rtd) ? 0 : 1)
         + (InterferenceStat.IsInnerBound(record2.Rtd) ? 0 : 1));
 }
Пример #10
0
        private static void Import(TextReader reader, Action<CdrRtdRecord> ImportAction)
        {
            string line;
            while ((line = reader.ReadLine()) != null)
            {
                string[] segments = line.GetSplittedFields(';');

                for (int i = 1; i < segments.Length; i++)
                {
                    string[] fields = segments[i].GetSplittedFields('_');
                    if (fields[0] == "D0")
                    {
                        CdrRtdRecord record = new CdrRtdRecord(fields);
                        ImportAction(record);
                    }
                }
            }
        }
 protected abstract void AssertDistributionParameters(CdrTaRecord details, CdrRtdRecord record);
 public void AssertImportUniqueRecordResults(List<CdrTaRecord> details, CdrRtdRecord record1,
     CdrRtdRecord record2)
 {
     AssertResultsWithOneDetails(details, record1);
     AssertDistributionParameters(details[0], record2);
 }
 protected override void AssertDistributionParameters(CdrTaRecord details, CdrRtdRecord record)
 {
     Assert.AreEqual(details.TaSum, record.Rtd, 1E-6);
     if (InterferenceStat.IsInnerBound(record.Rtd))
     {
         Assert.AreEqual(details.TaInnerIntervalNum, 1);
         Assert.AreEqual(details.TaOuterIntervalNum, 0);
     }
     else
     {
         Assert.AreEqual(details.TaInnerIntervalNum, 0);
         Assert.AreEqual(details.TaOuterIntervalNum, 1);
     }
 }
 protected override void AssertDistributionParameters(CdrTaRecord details, CdrRtdRecord record)
 {
     if (record.Rtd > details.Threshold)
     {
         Assert.AreEqual(
             InterferenceStat.IsInnerBound(record.Rtd)
                 ? details.TaOuterIntervalExcessNum
                 : details.TaInnerIntervalExcessNum, 0);
         Assert.AreEqual(
             InterferenceStat.IsInnerBound(record.Rtd)
                 ? details.TaInnerIntervalExcessNum
                 : details.TaOuterIntervalExcessNum, 1);
     }
     else
     {
         Assert.AreEqual(details.TaOuterIntervalExcessNum, 0);
         Assert.AreEqual(details.TaInnerIntervalExcessNum, 0);
     }
 }
 public ImportExcessCdrTaRecordsService(List<CdrTaRecord> details, CdrRtdRecord record)
     : base(details, record)
 {
 }
 protected ImportCdrTaRecordsService(List<CdrTaRecord> details, CdrRtdRecord record)
 {
     _details = details;
     _record = record;
     _detail = details.FirstOrDefault(x => x.CellId == record.CellId && x.SectorId == record.SectorId);
 }