static void Main(string[] args)
        {
            var restaurantRepo = new RestaurantRepo();
            var restaurants    = restaurantRepo.GetRestaurants();
            var input          = "";

            while (input.ToLower() != "end")
            {
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("Enter 'restaurants' to see Restaurants");
                Console.WriteLine("Enter 'highest rated' to see the highest rated restaurant");
                Console.WriteLine("Enter 'sorted' to see the sorted restaurants by name");
                Console.WriteLine("Enter 'end' to end program");

                input = Console.ReadLine();

                if (string.IsNullOrEmpty(input))
                {
                    input = "";
                }

                if (input.ToLower() == "restaurants")
                {
                    foreach (var r in restaurants)
                    {
                        Console.WriteLine(r);
                    }
                }

                if (input.ToLower() == "highest rated")
                {
                    Console.WriteLine(restaurantRepo.GetTopRatedRestaurant());
                }

                if (input.ToLower() == "sorted")
                {
                    foreach (var r in HelperLibrary.SortRestaurantsByName(restaurants))
                    {
                        Console.WriteLine(r);
                    }
                }
            }
        }
예제 #2
0
        public void SortRestaurantsByNameReturnsCorrectlyOrderedRestaurants4()
        {
            var list = HelperLibrary.SortRestaurantsByName(_restaurants);

            Assert.AreEqual(list[4].Id, _restaurantsSorted[4].Id);
        }
예제 #3
0
        public void SortRestaurantsByNameDoesNotReturnUnCorrectlyOrderedRestaurants1()
        {
            var list = HelperLibrary.SortRestaurantsByName(_restaurants);

            Assert.AreNotEqual(list[4].Id, _restaurantsSorted[2].Id);
        }