コード例 #1
0
        public void Setup()
        {
            //Ceating fake
            _fakeFlightHandler = Substitute.For <IFlightHandler>();

            _uut = Substitute.For <FlightValidator>();

            _validFlights = new List <Flight>()
            {
                new Flight()
                {
                    position = new Coords(16000, 16000, 5000)
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 20000)
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 500)
                }
            };

            _oneInvalidFlights = new List <Flight>()
            {
                new Flight()
                {
                    position = new Coords(16000, 16000, 5000)
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 25000) // Invalid, z too high
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 500)
                }
            };

            _twoInvalidFlights = new List <Flight>()
            {
                new Flight()
                {
                    position = new Coords(16000, 16000, 5000)
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 25000)
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 400) // Invalid, z too low
                }
            };
        }
コード例 #2
0
        public void Update(IFlightHandler fh)
        {
            _conflicts.Clear();

            List <Flight> flightList = fh.GetFlights();

            for (int i = 0; i < flightList.Count; i++)
            {
                var flightToCheck = flightList[i];

                for (int j = i + 1; j < flightList.Count; j++)
                {
                    CheckForConflicts(flightToCheck, flightList[j]);
                }
            }

            Notify(this);
        }
コード例 #3
0
 public FlightController(ILogger <FlightController> logger, IFlightHandler flightHandler) : base(logger)
 {
     _flightHandler = flightHandler;
 }
コード例 #4
0
 public void SetFlightHandler(IFlightHandler handler)
 {
     _flightHandler = handler;
 }
コード例 #5
0
        public void Setup()
        {
            // Create fakes
            _FakeFlightHandler   = Substitute.For <IFlightHandler>();
            _FakeFlightValidator = Substitute.For <IFlightValidator>();

            _uut = Substitute.For <ConflictHandler>(300, 500);

            EmptyListFlights = new List <Flight>();

            ReturnedText = $"Conflicting flights and time of occurrence\r\nATY (15500, 15500, 16000) conflicts with PRQ (15600, 15450, 15900), Time of occurrence: {DateTime.Now}\r\n\r\n";

            testFlightsWithConflicts = new List <Flight>()
            {
                new Flight()
                {
                    tag      = "ATR423",
                    position = new Coords(10005, 8000, 14000),
                },
                new Flight()
                {
                    tag      = "DTY420",
                    position = new Coords(14005, 15000, 15500),
                },
                new Flight()
                {
                    tag      = "PRY696",
                    position = new Coords(10105, 7900, 13600),
                },
            };

            testFlightsNoConflicts = new List <Flight>()
            {
                new Flight()
                {
                    tag      = "ATR423",
                    position = new Coords(75005, 15600, 14056),
                },
                new Flight()
                {
                    tag      = "DTY420",
                    position = new Coords(50605, 20654, 18860),
                },
                new Flight()
                {
                    tag      = "PRY696",
                    position = new Coords(11005, 7900, 13600),
                },
            };

            _flight1 = new Flight
            {
                tag       = "ATY",
                position  = new Coords(15500, 15500, 16000),
                timestamp = DateTime.Now,
            };

            _flight2 = new Flight
            {
                tag       = "PRQ",
                position  = new Coords(15600, 15450, 15900),
                timestamp = DateTime.Now,
            };

            _conflict = new Conflict(_flight1, _flight2);
        }