/// <summary> /// Presents list of all parks from SQL DB for user selection /// </summary> /// <param name="">No arguments for method</param> private void ParkListMenu() { bool exit = false; while (!exit) { Console.Clear(); var parks = dal.GetParkList(); int counter = 0; Console.WriteLine("Please Choose a Park\n"); foreach (Park park in parks) { counter++; Console.WriteLine($"{counter}) {park.Name}"); } Console.WriteLine($"\nPress 0 to Logout"); int userInput = int.Parse(Console.ReadLine()); try { if (userInput == 0) { exit = true; } else { int parkNum = userInput; SingleParkMenu(parks[parkNum - 1]); } } catch (Exception ex) { Console.WriteLine("\nWrong."); //Console.WriteLine(ex.Message); //Console.WriteLine(ex.StackTrace); Console.ReadKey(); Thread.Sleep(1000); } } }
public void GetParkListTest() { var list = dal.GetParkList(); Assert.AreEqual(1, list.Count); }