public void SetUp() { _decoder = Substitute.For <ITrackDecoding>(); //Rigtige Klasser _uut = new Logger(); _Event = new SeparationEvent(); _Track1 = new TrackData() { Tag = "TAG1", X = 1000, Y = 2000, Altitude = 3000, Course = 30, Velocity = 23, FormattedTimestamp = "14-05-2018 17:18 53 1111" }; _Track2 = new TrackData() { Tag = "TAG2", X = 1000, Y = 2000, Altitude = 3000, Course = 30, Velocity = 23, FormattedTimestamp = "14-05-2018 17:18 53 1111" }; _Update = new Update(_decoder); //Lister _Tracklist = new List <ITracks>() { _Track1, _Track2 }; _fakeTransponderData = new TrackDataEventArgs(_Tracklist); //Substitueret _CalcDistance = Substitute.For <ICalcDistance>(); _calcCourse = Substitute.For <ICalcCourse>(); _calcVelocity = Substitute.For <ICalcVelocity>(); _monitor = Substitute.For <IMonitors>(); _decoder.TrackDataReadyForCalculation += (o, args) => _Tracklist = args.TrackData; }
public void Setup() { _separation = Substitute.For <ISeparation>(); _transponderReceiver = Substitute.For <ITransponderReceiver>(); _airspace = new Airspace(new Coordinates() { X = 10000, Y = 10000 }, new Coordinates() { X = 90000, Y = 90000 }, 500, 20000); _trackLogging = Substitute.For <ITrackLogging>(); _degreesCalculator = new DegreesCalculatorWithoutDecimals(); _velocityCalculator = new VelocityCalculator(); _airspaceMovementMonitoring = new AirspaceMovementMonitoring(_airspace, _velocityCalculator, _degreesCalculator, _trackLogging); _airspaceMonitoring = new AirspaceMonitoring(_airspace, _airspaceMovementMonitoring); _transponderDataConversion = new TransponderDataConversion(_airspaceMonitoring); _driver = new TransponderDataReceiver(_transponderReceiver, _transponderDataConversion, _separation, _airspace); _track = new Track() { Altitude = 10000, Position = new Coordinates() { X = 50000, Y = 60000 }, Tag = "XYZ123", TimeStamp = new DateTime(2015, 10, 06, 21, 34, 56, 789) }; }
public TransponderDataReceiver(ITransponderReceiver transponderReceiver, ITransponderDataConversion transponderDataConversion, ISeparation separation, Airspace airspace) { _transponderReceiver = transponderReceiver; _transponderDataConversion = transponderDataConversion; _separation = separation; _airspace = airspace; }
public Output(ITrackFactory trackFactory, IAirspace airspace, ISeparation separation) { airspace.OnAirspaceCheckEventDone += Airspace_OnAirspaceCheckEventDone; trackFactory.OnTrackListDoneEvent += TrackFactory_OnTrackListDoneEvent; airspace.OnPlaneEnteringAirspace += Airspace_OnPlaneEnteringAirspace; airspace.OnPlaneExitingAirspace += Airspace_OnPlaneExitingAirspace; separation.OnPlaneCollision += Separation_OnPlaneCollision; separation.OnPlaneAvoidedCollision += Separation_OnPlaneAvoidedCollision; }
public void Setup() { _uut = new Course(); _newTracks = new List <ITrackObject>(); _velocity = Substitute.For <IVelocity>(); _separation = Substitute.For <ISeparation>(); _distance = Substitute.For <IDistance>(); _listHandler = new ListHandler(_velocity, _uut, _separation, _distance); }
//Skal initialisere Calc udefra plus tilføje alt til listen! public void TrackCalculated(IMonitors monitor, ICalcDistance distance, ICalcCourse course, ICalcVelocity vel, ILog logger, ISeparation separation, List <ITracks> list) { //Initialisering af klasserne Monitor = monitor; Distance = distance; Velocity = vel; Course = course; Logger = logger; Separation = separation; }
public void Setup() { _trFakeData = Substitute.For <ITransponderReceiver>(); _trackFactory = new TrackFactory(_trFakeData); _airspace = new Airspace(_trackFactory); _separation = new Separation(_airspace); _uut = new Output(_trackFactory, _airspace, _separation); _insideAirspacePlane1 = new Track() { Altitude = 8000, AltitudeOld = 8000, Heading = 0, Tag = "PIE284", TimeStamp = new DateTime(2018, 11, 1, 11, 11, 11, 0), TimeStampOld = new DateTime(2018, 11, 1, 11, 11, 10, 0), Velocity = 0, XCoord = 15000, YCoord = 15000, XCoordOld = 16000, YCoordOld = 16000 }; _insideAirspacePlane2 = new Track() { Altitude = 8200, AltitudeOld = 8200, Heading = 0, Tag = "PIE285", TimeStamp = new DateTime(2018, 11, 1, 11, 11, 11, 0), TimeStampOld = new DateTime(2018, 11, 1, 11, 11, 10, 0), Velocity = 0, XCoord = 18000, YCoord = 18000, XCoordOld = 17000, YCoordOld = 17000 }; _insideAirspacePlane3 = new Track() { Altitude = 8200, AltitudeOld = 8200, Heading = 0, Tag = "PIE286", TimeStamp = new DateTime(2018, 11, 1, 11, 11, 11, 0), TimeStampOld = new DateTime(2018, 11, 1, 11, 11, 10, 0), Velocity = 0, XCoord = 12000, YCoord = 12000, XCoordOld = 17000, YCoordOld = 17000 }; }
//public Print(IOutput output) //{ // _myOutput = output; //} public Print(IUpdate update, ICalcDistance calcDist, ICalcCourse calcCourse, ICalcVelocity calcVel, ILog logger, ISeparation separation, IMonitors monitor, IOutput output, List <ITracks> tracks) { _Update = update; CalcDist = calcDist; CalcVel = calcVel; CalcCourse = calcCourse; Logger = logger; Separation = separation; _myOutput = output; Printing(tracks, monitor); }
public void Setup() { _position = Substitute.For <IPosition>(); _inDateTime = new DateTime(); _uut = new TrackObject("123ABC", _position, "20181111111111111", _inDateTime); _newTracks = new List <ITrackObject>(); _velocity = Substitute.For <IVelocity>(); _course = Substitute.For <ICourse>(); _separation = Substitute.For <ISeparation>(); _distance = Substitute.For <IDistance>(); _listHandler = new ListHandler(_velocity, _course, _separation, _distance); }
/// <summary> /// Logs separation to file /// </summary> /// <param name="separation"></param> public void LogSeperation(ISeparation separation) { StringBuilder sb = new StringBuilder(); sb.Append("\r\nLog Entry: " + separation.TimeOfOccurence); sb.AppendLine(); sb.Append("Tags involved: " + separation.TrackOne.Tag + " : " + separation.TrackTwo.Tag + "\r\n"); sb.Append("Are " + (separation.ConflictingSeperation ? "conflicting!" : "no longer conflicting!")); sb.AppendLine(); FileWriter.Write(sb.ToString()); }
public void Setup() { _fakeTrackFactory = Substitute.For <ITrackFactory>(); _fakeAirspace = Substitute.For <IAirspace>(); _fakeSeparation = Substitute.For <ISeparation>(); _uut = new Output(_fakeTrackFactory, _fakeAirspace, _fakeSeparation); _insideAirspacePlane1 = new Track() { Altitude = 8000, AltitudeOld = 8000, Heading = 0, Tag = "PIE284", TimeStamp = new DateTime(2018, 11, 1, 11, 11, 11, 0), TimeStampOld = new DateTime(2018, 11, 1, 11, 11, 10, 0), Velocity = 0, XCoord = 15000, YCoord = 15000, XCoordOld = 16000, YCoordOld = 16000 }; _insideAirspacePlane2 = new Track() { Altitude = 8200, AltitudeOld = 8200, Heading = 0, Tag = "PIE285", TimeStamp = new DateTime(2018, 11, 1, 11, 11, 11, 0), TimeStampOld = new DateTime(2018, 11, 1, 11, 11, 10, 0), Velocity = 0, XCoord = 18000, YCoord = 18000, XCoordOld = 17000, YCoordOld = 17000 }; _insideAirspacePlane3 = new Track() { Altitude = 8200, AltitudeOld = 8200, Heading = 0, Tag = "PIE286", TimeStamp = new DateTime(2018, 11, 1, 11, 11, 11, 0), TimeStampOld = new DateTime(2018, 11, 1, 11, 11, 10, 0), Velocity = 0, XCoord = 12000, YCoord = 12000, XCoordOld = 17000, YCoordOld = 17000 }; }
public ListHandler( IVelocity vel, ICourse cou, ISeparation separation, IDistance distance) { CurrentTracks = new List <ITrackObject>(); _velocity = vel; _course = cou; _separation = separation; _distance = distance; }
public void Setup() { _uut = new Separation(); /**************************** * // THIS MUST BE SUB - NEED FIX - ELSE OK *****************************/ _distance = new Distance(); _oldObj = Substitute.For <ITrackObject>(); _newObj = Substitute.For <ITrackObject>(); }
public void Setup() { _transponderReceiverFake = Substitute.For <ITransponderReceiver>(); _transponderDataConversionFake = Substitute.For <ITransponderDataConversion>(); _separationFake = Substitute.For <ISeparation>(); _airspace = new Airspace(new Coordinates() { X = 10000, Y = 10000 }, new Coordinates() { X = 25000, Y = 25000 }, 500, 10000); _uut = new TransponderDataReceiver(_transponderReceiverFake, _transponderDataConversionFake, _separationFake, _airspace); }
public void Setup() { _eventHandled = false; _console = Substitute.For <ILog>(); _airspace = Substitute.For <IAirspace>(); _separation = Substitute.For <ISeparation>(); _uut = new ConsoleMonitor(_console, _airspace, _separation); _airspace.FlightAddedEvent += (sender, args) => _flightAddedEventArg = args; _airspace.FlightAddedEvent += (sender, args) => _eventHandled = true; _separation.SeparationWarningEvent += (sender, args) => _separationWarningEventArg = args; _separation.SeparationWarningEvent += (sender, args) => _eventHandled = true; }
public CivilStatusType ToCivilStatusType(ISeparation currentSeparation) { var statusCode = new CivilStatusLookupMap().Map(this._CivilStatus.CivilStatusCode); // TODO: Copy from DPR if (currentSeparation != null && (statusCode == CivilStatusKodeType.Gift || statusCode == CivilStatusKodeType.RegistreretPartner)) { return(currentSeparation.ToCivilStatusType()); } else { return(new CivilStatusType() { CivilStatusKode = statusCode, TilstandVirkning = TilstandVirkningType.Create(this._CivilStatus.ToStartTS()), }); } }
public void Setup() { _uut = new CalcDistance(); _Track1 = new TrackData() { Tag = "TAG1", X = 10000, Y = 21000, Altitude = 3000, Course = 0, Velocity = 100, FormattedTimestamp = "14-05-2018 17:18 53 4000" }; _Track2 = new TrackData() { Tag = "TAG1", X = 50000, Y = 20000, Altitude = 3000, Course = 0, Velocity = 100, FormattedTimestamp = "14-05-2018 17:18 53 1111" }; _Track3 = new TrackData() { Tag = "TAG1", X = 100, Y = 21000, Altitude = 3000, Course = 0, Velocity = 100, FormattedTimestamp = "14-05-2018 17:18 53 4000" }; _Event = Substitute.For <ISeparation>(); }
public void Setup() { TestSeparation = new Separation(); trackList = new List <Track>(); pos1 = new Position(27541, 25884); pos2 = new Position(22513, 75141); pos3 = new Position(15245, 24154); pos4 = new Position(30245, 28884); T1 = new Track("H5JS", pos1, 5422, 251, 150, "20181005"); T2 = new Track("J8HD", pos2, 2481, 241, 45, "20180528"); T3 = new Track("K9JR", pos3, 5385, 301, 126, "20180321"); T4 = new Track("N8DY", pos4, 5632, 130, 75, "20180421"); trackList.Add(T1); trackList.Add(T2); trackList.Add(T3); trackList.Add(T4); D1 = new Danger(T1, T4, 4038);// Yes i calculated it myself. // Skal test ingen danger // alt too close, dist out of range // alt too close dist too close , not same tag }
public void SetUp() { _decoder = Substitute.For <ITrackDecoding>(); //Rigtige Klasser _Track1 = new TrackData() { Tag = "TAG1", X = 10000, Y = 21000, Altitude = 3000, Course = 0, Velocity = 100, FormattedTimestamp = "14-05-2018 17:18 53 4000" }; _Track2 = new TrackData() { Tag = "TAG1", X = 50000, Y = 20000, Altitude = 3000, Course = 0, Velocity = 100, FormattedTimestamp = "14-05-2018 17:18 53 1111" }; _Track3 = new TrackData() { Tag = "TAG1", X = 100, Y = 21000, Altitude = 3000, Course = 0, Velocity = 100, FormattedTimestamp = "14-05-2018 17:18 53 4000" }; _CalcDistance = new CalcDistance(); _calcCourse = new CalcCourse(); _calcVelocity = new CalcVelocity(); _monitor = new Monitor(); _uut = new Update(_decoder); //Lister _Tracklist = new List <ITracks>() { _Track1, _Track2 }; _fakeTransponderData = new TrackDataEventArgs(_Tracklist); //Substitueret _logger = Substitute.For <ILog>(); _output = Substitute.For <IOutput>(); _print = Substitute.For <IPrints>(); _Separation = Substitute.For <ISeparation>(); _decoder.TrackDataReadyForCalculation += (o, args) => _Tracklist = args.TrackData; }
public void Setup() { _track1 = Substitute.For <ITracks>(); _track2 = Substitute.For <ITracks>(); _decoder = Substitute.For <ITrackDecoding>(); receivedTrackData = new List <ITracks>(); _uut = new Update(_decoder); _calcDistance = Substitute.For <ICalcDistance>(); _calcCourse = Substitute.For <ICalcCourse>(); _calcVelocity = Substitute.For <ICalcVelocity>(); _logger = Substitute.For <ILog>(); _separation = Substitute.For <ISeparation>(); _monitor = Substitute.For <IMonitors>(); //Tilsæt ny data _track1.Tag = "Tag1"; _track1.Altitude = 500; _track1.X = 20000; _track1.Y = 40000; //_track1.Course = 0; _track1.Timestamp = new DateTime(20180419152929150); //_track1.Velocity = 0; _track2.Tag = "Tag1"; _track2.Altitude = 600; _track2.X = 40000; _track2.Y = 90000; //_track2.Course = 0; _track2.Timestamp = new DateTime(20180419152929100); //_track2.Velocity = 0; _fakeTransponderData = new TrackDataEventArgs(new List <ITracks>()); _fakeTransponderData.TrackData.Add(Substitute.For <ITracks>()); _fakeTransponderData.TrackData.Add(Substitute.For <ITracks>()); //Her bliver eventet sat til at være lige med receivedTrackData _decoder.TrackDataReadyForCalculation += (o, args) => receivedTrackData = args.TrackData; }
public void Setup() { _trFakeData = Substitute.For <ITransponderReceiver>(); _trackFactory = new TrackFactory(_trFakeData); _airspace = new Airspace(_trackFactory); _uut = new Separation(_airspace); _insideAirspacePlane1 = new Track() { Altitude = 8000, AltitudeOld = 8000, Heading = 0, Tag = "PIE284", TimeStamp = new DateTime(2018, 11, 1, 11, 11, 11, 0), TimeStampOld = new DateTime(2018, 11, 1, 11, 11, 10, 0), Velocity = 0, XCoord = 15000, YCoord = 15000, XCoordOld = 16000, YCoordOld = 16000 }; _insideAirspacePlane2 = new Track() { Altitude = 8200, AltitudeOld = 8200, Heading = 0, Tag = "PIE285", TimeStamp = new DateTime(2018, 11, 1, 11, 11, 11, 0), TimeStampOld = new DateTime(2018, 11, 1, 11, 11, 10, 0), Velocity = 0, XCoord = 18000, YCoord = 18000, XCoordOld = 17000, YCoordOld = 17000 }; _insideAirspacePlane3 = new Track() { Altitude = 15000, AltitudeOld = 15000, Heading = 0, Tag = "PIE286", TimeStamp = new DateTime(2018, 11, 1, 11, 11, 11, 0), TimeStampOld = new DateTime(2018, 11, 1, 11, 11, 10, 0), Velocity = 0, XCoord = 18000, YCoord = 18000, XCoordOld = 17000, YCoordOld = 17000 }; _uut.OnPlaneCollision += (s, e) => { FoundPlanesOnCollision = true; if (e.Plane1.Tag == e.Plane2.Tag) { Assert.Fail(); } if (_insideAirspacePlane1.Tag == e.Plane1.Tag || _insideAirspacePlane1.Tag == e.Plane2.Tag || _insideAirspacePlane2.Tag == e.Plane1.Tag || _insideAirspacePlane2.Tag == e.Plane2.Tag) { Assert.IsTrue(Math.Abs(e.Plane1.Altitude - e.Plane2.Altitude) <= verticalSeparation && Math.Abs(e.Plane1.XCoord - e.Plane2.XCoord) <= horizontalSeparation && Math.Abs(e.Plane1.YCoord - e.Plane2.YCoord) <= horizontalSeparation); } else { Assert.Fail(); } }; }
public SeparationEventArgs(ISeparation separation) { Separation = separation; }
public ConsoleMonitor(ILog console, IAirspace airspace, ISeparation separation) { _console = console; airspace.FlightAddedEvent += HandleFlightAddedEvent; separation.SeparationWarningEvent += HandleSeparationWarningEvent; }