//return all restaurants and make a list public IEnumerable <Restaurant> GetRestaurants() { var rests = _db.GetRestaurants().ToList(); //rests.Sort(); var result = rests.Select(x => ToWeb(x)); return(result); }
public void TestLibHelper() { //arrange LibHelper libHelper = new LibHelper(); String restName = "IHOP"; String expected = "Diner"; String actual = ""; //act var results = libHelper.GetRestaurants(); //assert foreach (var restaurant in results) { if (restaurant.Name == restName) { actual = restaurant.FoodType; } } Assert.AreEqual(expected, actual); }
static void Main(string[] args) { Console.WriteLine("Enter new Restaurant name: "); var newName = Console.ReadLine(); var libHelper = new LibHelper(); libHelper.AddRestaurant(new Restaurant() { Name = newName }); // saves changes, updates dbsets var results = libHelper.GetRestaurants(); Console.WriteLine("All stored restaurants:"); foreach (var restaurant in results) { Console.WriteLine(restaurant.Name); } Console.ReadKey(); }