public void GetCampgroundsByParkTest() { Dictionary <int, Campground> results = _db.GetCampgroundByPark(1); int expectedParkId = 1; foreach (var item in results) { Assert.AreEqual(expectedParkId, item.Value.ParkId); } }
private void ViewCampground(int parkId) { Dictionary <int, Campground> campgrounds = new Dictionary <int, Campground>(); bool quit = false; try { campgrounds = _db.GetCampgroundByPark(parkId); } catch (Exception ex) { Console.Clear(); Console.WriteLine(ex); Console.WriteLine($"No campgrounds exist for {_parks[parkId].Name}"); Console.WriteLine("Press any key to return to previous screen..."); Console.ReadKey(); quit = true; } if (campgrounds.Count == 0) { Console.Clear(); Console.WriteLine($"No campgrounds exist for {_parks[parkId].Name}"); Console.WriteLine("Press any key to return to previous screen..."); Console.ReadKey(); quit = true; } while (!quit) { Console.Clear(); DisplayCampgroundsByPark(parkId, campgrounds); Console.WriteLine("\nSelect a command\n"); Console.WriteLine("1) Search for Available Reservation"); Console.WriteLine("2) Return to Previous Screen"); string userChoice = Console.ReadLine(); try { int choice = int.Parse(userChoice); if (choice == 1) { SearchForCampgroundReservation(parkId, campgrounds); } else if (choice == 2) { quit = true; } else { throw new Exception(); } } catch { Console.Clear(); Console.WriteLine("Please enter only valid command"); Console.Write("Press any key to return to the campgrounds screen..."); Console.ReadKey(); } } }