public void VenueDetails() { try { string idInput = Console.ReadLine(); venue.Id = int.Parse(idInput); IList <Venue> newListTwo = venueDAL.GetVenues(); IList <Category> newCategoryList = venueDAL.GetVenueCategories(); string location = ""; string description = ""; string categories = ""; foreach (Venue room in newListTwo) { if (venue.Id < 1 || venue.Id > newListTwo.Count) { Console.WriteLine("Please enter a valid selection"); Console.WriteLine(""); returnToMainMenu = true; return; } if (venue.Id == room.Id) { Console.WriteLine(); // blank line venue.Name = room.Name; location = room.City + ", " + room.State; description = room.Description; continue; } } for (int i = 0; i < newCategoryList.Count; i++) { if (idInput == newCategoryList[i].VenueId.ToString()) { categories += (i == 0 ? "" : " | ") + newCategoryList[i].Name; } } Console.WriteLine(venue.Name); Console.WriteLine("Location: " + location); Console.WriteLine("Categories: " + categories); Console.WriteLine(); Console.WriteLine(description); } catch { returnToMainMenu = true; Console.WriteLine("Please enter a valid selection"); return; } }
//Test GetVenueCategories() public void TestGetVenueCategories() { VenueDAL newVenue = new VenueDAL(connectionString); IList <Category> categoryList = newVenue.GetVenueCategories(); bool found = false; foreach (Category category in categoryList) { if (category.Name == "TestCategory") { found = true; break; } } Assert.IsTrue(found); }