Exemplo n.º 1
0
        public void AskFlightMereTime()
        {
            FlightCalculator calculator = new FlightCalculator();

            // Positions at the flight plan.
            DateTime        launchTime = new DateTime(2020, 5, 24, 20, 4, 30);
            InitialLocation launch     = new InitialLocation(100, 100, launchTime);
            FlightStatus    middle     = new FlightStatus(120, 200, 300);
            FlightStatus    end        = new FlightStatus(140, 250, 200);

            // Generate the flight plan based on those positions.
            FlightPlan flightPlan = new FlightPlan(256, "TestCompany", launch, new FlightStatus[2] {
                middle, end
            });


            DateTime mereTime = launchTime.AddSeconds(150);

            // The test asks for a point at mere time.
            var res = calculator.CreateFlightFromPlan(flightPlan, mereTime, false);

            // Check that expected values are retrieved.
            Assert.AreEqual(110, res.Longitude);
            Assert.AreEqual(150, res.Latitude);
        }
Exemplo n.º 2
0
        public void AskFlightAfterLand()
        {
            FlightCalculator calculator = new FlightCalculator();

            // Positions at the flight plan.
            DateTime        launchTime = new DateTime(2020, 5, 24, 20, 4, 30);
            InitialLocation launch     = new InitialLocation(100, 100, launchTime);
            FlightStatus    middle     = new FlightStatus(100, 200, 300);
            FlightStatus    end        = new FlightStatus(100, 250, 200);

            // Generate the flight plan based on those positions.
            FlightPlan flightPlan = new FlightPlan(256, "TestCompany", launch, new FlightStatus[2] {
                middle, end
            });

            // The test asks for a point after land time.
            DateTime afterLand = new DateTime(2021, 6, 27, 22, 41, 35);

            // The expected value is null.
            Assert.IsNull(calculator.CreateFlightFromPlan(flightPlan, afterLand, false));
        }