Пример #1
0
        public void getBestCommercialFlightTest()
        {
            //this implementation will hit the live data so it has been disabled
            //until a new implementation that uses static test data is ready

            //throw new NotImplementedException();


            string makeModel = "Boeing 737-800";

            FSEDataAPI fse = new FSEDataAPI();
            //TODO: make a better assert using a list of assignments that is then fed into the get best method
            //TODO: make sure this is actually return the best and not the best minus one due to index weirdness
            Assignment actualBestAssignment         = fse.getBestCommercialAssignment(makeModel);
            string     actualBestAssignmentLocation = actualBestAssignment.Location;

            //TODO: make this assert better
            Assert.IsTrue(actualBestAssignmentLocation.Length == 4);
        }
Пример #2
0
        //TODO: migrate to .net 3.0
        //https://docs.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset?view=msvc-160
        static void Main(string[] args)
        {
            printWelcomeInstructions();

            FSEDataAPI fSEData = new FSEDataAPI();

            string consoleInput = "";
            bool   running      = true;

            while (running)
            {
                consoleInput = Console.ReadLine();

                //check for back input or the quit command
                if (consoleInput.ToLower() == "q" || consoleInput.ToLower() == "exit")
                {
                    running = false;
                }
                else if (!int.TryParse(consoleInput, out int n))
                {
                    //invalid input, found a char where there should be a number
                    Console.WriteLine("Invalid input, try a different option.");
                }
                else
                {
                    //check to see which option was selected and perform required tasks to generate output
                    switch (int.Parse(consoleInput))
                    {
                    case 1:
                        //print the best 737 assignment
                        Console.WriteLine("Finding the location of the best 737-800 assignment..." + Environment.NewLine);
                        printAssignment(fSEData.getBestCommercialAssignment("Boeing 737-800"));
                        Console.WriteLine();
                        Console.WriteLine();
                        break;

                    case 2:
                        //print top 5 737 assignments
                        Console.WriteLine("Finding the top 25 737-800 assignments..." + Environment.NewLine);
                        printAssignments(fSEData.getCommercialAssignments(AircraftMakeModelStrEnum.Boeing737_800, 25));

                        break;

                    case 3:
                        Console.WriteLine("Finding All 737 Assignments to or from the US..." + Environment.NewLine);
                        printAssignments(fSEData.GetUSAssignments(AircraftMakeModelStrEnum.Boeing737_800));
                        break;

                    case 4:
                        //print the best 747 assignment
                        Console.WriteLine("Finding the location of the best 747-400 assignment..." + Environment.NewLine);
                        printAssignment(fSEData.getBestCommercialAssignment("Boeing 747-400"));
                        Console.WriteLine();
                        Console.WriteLine();
                        break;

                    case 5:
                        Console.WriteLine("Finding All 747 Assignments to or from the US..." + Environment.NewLine);
                        printAssignments(fSEData.GetUSAssignments(AircraftMakeModelStrEnum.Boeing747_400));
                        break;

                    case 6:
                        Console.WriteLine("Finding all 747-400 assignments..." + Environment.NewLine);
                        printAssignments(fSEData.getCommercialAssignments(AircraftMakeModelStrEnum.Boeing747_400));
                        break;

                    case 7:
                        //TODO: Test A320 jobs
                        Console.WriteLine("Finding all Airbus A320 (MSFS) assignments..." + Environment.NewLine);
                        printAssignments(fSEData.getCommercialAssignments(AircraftMakeModelStrEnum.AirbusA320_MSFS));
                        break;

                    case 8:
                        //TODO: Test A320 jobs
                        Console.WriteLine("Finding all Airbus A320 (MSFS) assignments that start in the US..." + Environment.NewLine);
                        printAssignments(fSEData.GetUSAssignments(AircraftMakeModelStrEnum.AirbusA320_MSFS));
                        break;

                    default:
                        //invalid input
                        Console.WriteLine("Invalid option selected, try a different option." + Environment.NewLine);
                        break;
                    }

                    //reprint the instructions
                    printWelcomeInstructions();
                }
            }
        }