示例#1
0
        public void GetParkInfoTest()
        {
            //Arrange
            CampgroundSqlDAL campgroundSqlDAL = new CampgroundSqlDAL();

            //Act
            Park park = campgroundSqlDAL.GetParkInfo("park");

            //Assert
            Assert.AreEqual(3333, park.Area);
        }
        private bool GetParkInfo(int parkDictionaryKey)
        {
            bool returnToPrevious = false;


            CampgroundSqlDAL campgroundDAL = new CampgroundSqlDAL();

            Park park = campgroundDAL.GetParkInfo(Parks[parkDictionaryKey]);

            Console.Clear();
            Console.WriteLine();
            Console.WriteLine($"{park.Name} National Park");
            Console.WriteLine(String.Format("").PadRight(30, '='));
            Console.WriteLine(String.Format("Location:").PadRight(19) + park.Location);
            Console.WriteLine(String.Format("Established:").PadRight(19) + park.Establish_Date.ToShortDateString());
            Console.WriteLine(String.Format("Area:").PadRight(19) + park.Area + " sq km");
            Console.WriteLine(String.Format("Annual Visitors:").PadRight(19) + park.Visitors);

            Console.WriteLine();

            PrintParkInfoMenu();
            ConsoleKeyInfo userInput = Console.ReadKey();
            string         command   = userInput.KeyChar.ToString();

            const string command_PreviousScreen          = "4";
            const string command_Get30DaysOfReservations = "3";

            switch (command)
            {
            case command_ViewCampgrounds:
                GetCampgrounds(Parks[parkDictionaryKey]);
                break;

            case command_SearchReservations:
                GetParkWideAvailability(park.Name);
                break;

            case command_Get30DaysOfReservations:
                GetAllReservationsFor30DaysByPark(park.Name);
                break;

            case command_PreviousScreen:
                returnToPrevious = true;
                break;

            default:
                Console.WriteLine("The command provided was not a valid, please try again.");
                command = Console.ReadKey().ToString();
                break;
            }
            return(returnToPrevious);
        }