示例#1
0
        public void runSelfTest_UpdateTransponderData()
        {
            List <string> listOfStrings = new List <string>();
            string        testerString  = "ATR423;39045;12932;14000;20151006213456789";
            string        testerString1 = "ATR424;39045;12932;14000;20151006213456789";

            listOfStrings.Add(testerString);
            listOfStrings.Add(testerString1);
            //  Decodes into list = _AirCraft

            // Explit Old data from last tick
            AircraftData aircraftDataNew2 = new AircraftData("FlIGHT02", 0002, 00002, 00002, new TimeStamp(0002, 02, 2, 2, 2, 2, 2));
            AircraftData aircraftDataNew3 = new AircraftData("FlIGHT03", 0003, 00003, 00003, new TimeStamp(0003, 03, 3, 3, 3, 3, 3));

            List <AircraftData> toMock = new List <AircraftData>();

            toMock.Add(aircraftDataNew3);
            toMock.Add(aircraftDataNew2);

            _utility.CloneList(toMock).ReturnsForAnyArgs(toMock);
            _utility.Speed(aircraftDataNew3, aircraftDataNew2).ReturnsForAnyArgs(5);
            _utility.CalculateDegree(aircraftDataNew2, aircraftDataNew2).ReturnsForAnyArgs(300);

            //_uut.UpdateTransponderData(listOfStrings);
            _reciever.TransponderDataReady += Raise.EventWith(new RawTransponderDataEventArgs(listOfStrings));

            Assert.AreEqual(numberOfEventTriggered, 1);

            Assert.That(_uut._Aircrafts[0].Tag == "ATR423" && _uut._Aircrafts[0].Speed == 5 && _uut._Aircrafts[0].Coords == 300);
            Assert.That(_uut._Aircrafts[1].Tag == "ATR424" && _uut._Aircrafts[0].Speed == 5 && _uut._Aircrafts[0].Coords == 300);
        }
示例#2
0
        public void Test_AnalyseData()
        {
            List <AircraftData> FakeAircrafts = new List <AircraftData>();

            TimeStamp ts = new TimeStamp(2018, 10, 2, 14, 0, 0, 0);

            AircraftData a1 = new AircraftData("Plane1", 40000, 40000, 10000, ts);
            AircraftData a2 = new AircraftData("Plane2", 10000, 10000, 11000, ts);
            AircraftData a3 = new AircraftData("Plane3", 70000, 70000, 7000, ts);
            AircraftData a4 = new AircraftData("Plane4", 20000, 20000, 12000, ts);
            AircraftData a5 = new AircraftData("Plane5", 75000, 75000, 7300, ts);
            AircraftData a6 = new AircraftData("Plane6", 30000, 30000, 9000, ts);

            FakeAircrafts.Add(a1);
            FakeAircrafts.Add(a2);
            FakeAircrafts.Add(a3);
            FakeAircrafts.Add(a4);
            FakeAircrafts.Add(a5);
            FakeAircrafts.Add(a6);

            _uut._FilteredAircrafts.Add(a1);
            _uut._FilteredAircrafts.Add(a2);
            _uut._FilteredAircrafts.Add(a3);
            _uut._FilteredAircrafts.Add(a4);
            _uut._FilteredAircrafts.Add(a5);
            _uut._FilteredAircrafts.Add(a6);

            List <AircraftData> OldFakeAircrafts = new List <AircraftData>();

            OldFakeAircrafts.Add(a1);
            OldFakeAircrafts.Add(a2);
            OldFakeAircrafts.Add(a3);
            OldFakeAircrafts.Add(a4);
            OldFakeAircrafts.Add(a5);
            OldFakeAircrafts.Add(a6);

            _utility.CloneList(_uut._FilteredAircrafts).Returns(FakeAircrafts);

            _utility.CalcDistance(a3, a5).Returns(5000);

            //_uut.AnalyseData(FakeAircrafts);

            _decoder.DecodedDataReadyEvent +=
                Raise.EventWith(_decoder, new DecodedTransponderDataEventArgs(FakeAircrafts));

            //_uut.AnalyseEventMethod(_uut, new DecodedTransponderDataEventArgs(FakeAircrafts));

            Assert.AreEqual(_nSeparationEventsRaised, 1);
            Assert.AreEqual(_nAnalysedDataReadyEventsRaised, 1);
        }
示例#3
0
        public void FilterAircrafts(List <AircraftData> _list)
        {
            _OldFilteredAircrafts = _utility.CloneList(_FilteredAircrafts);

            _FilteredAircrafts.Clear();

            foreach (var item in _list)
            {
                if ((item.Altitude >= 500 && item.Altitude <= 20000) &&
                    (item.X_coordinate >= 10000 && item.X_coordinate <= 90000) &&
                    (item.Y_coordinate <= 90000 && item.Y_coordinate >= 10000))
                {
                    _FilteredAircrafts.Add(item);
                }
            }
        }
示例#4
0
        // A method for updating our lists, both old and new
        // We first clone the objects from TrasnponderData to a 'old' list
        public void UpdateTransponderData(List <string> _TransponderData)
        {
            _OldAircraftDatas.Clear();
            _OldAircraftDatas = _utility.CloneList(_Aircrafts);
            _Aircrafts.Clear();

            foreach (var item in _TransponderData)
            {
                _Aircrafts.Add(DecodeString(item));
            }

            InsertSpeedAndCourse(_OldAircraftDatas, _Aircrafts);
            if (DecodedDataReadyEvent != null)
            {
                DecodedDataReadyEvent(this, new DecodedTransponderDataEventArgs(_Aircrafts));
            }
        }