internal static void Find()
        {
            string option;

            Console.Write("Search for restaurant by full or parital name: ");
            string Search = Console.ReadLine();

            SearchRestaurantsSer.ReturnGetRestaurantFullName(Search);
            if (SearchRestaurantsSer.GetRestaurantFullName(Search).Item1 == null)
            {
                Console.WriteLine();
                Console.WriteLine("Make sure search is a name, or try shortening the search");
                Find();
            }
            Console.WriteLine();
            Console.WriteLine("What would you like to do?");
            Console.WriteLine("Type 'select' and then Restaurant name to select it ");
            Console.WriteLine("Type 'back' to go back");
            option = Console.ReadLine();
            if (option.Length > 6)
            {
                if (option.Substring(0, 6).Equals("select"))
                {
                    Select(option.Substring(7, option.Length - 7));
                }
            }
        }
Пример #2
0
        public void GetBestReviewedRestaurantsTop3UnitTest()
        {
            init();
            List <Restaurant> expected = new List <Restaurant>
            {
                restaurant5,
                restaurant4,
                restaurant,
            };


            List <Restaurant> actual = SearchRestaurantsSer.GetBestReviewedRestaurantsTop3();

            CollectionAssert.AreEqual(expected, actual);
        }
Пример #3
0
        public void GetRestaurantsByLocationCityAscendingUnitTest()
        {
            init();
            List <Restaurant> expected = new List <Restaurant>
            {
                restaurant4,
                restaurant,
                restaurant3,
                restaurant2,
                restaurant5
            };

            List <Restaurant> actual = SearchRestaurantsSer.GetRestaurantsByLocationCityAscending();

            CollectionAssert.AreEqual(expected, actual);
        }
Пример #4
0
        public void GetAllRestaurantsByReviewAscendingUnitTest()
        {
            init();
            List <Restaurant> expected = new List <Restaurant>
            {
                restaurant5,
                restaurant4,
                restaurant,
                restaurant3,
                restaurant2
            };


            List <Restaurant> actual = SearchRestaurantsSer.GetAllRestaurantsByReviewDescending();

            CollectionAssert.AreEqual(expected, actual);
        }
        static void Main(string[] args)
        {
            //Console.WriteLine("Application Runs");
            Ser.CreateList();
            //for (int i = 0; i < 5; i++)
            //{
            //    SearchRestaurants.restaurants[i].PrintInfo();
            //    for (int j = 0; j < SearchRestaurants.restaurants[i].Reviews.Count - 1; j++)
            //    {
            //        Console.WriteLine(SearchRestaurants.restaurants[i].Reviews[j].GetFormattedReview());
            //    }
            //    Console.WriteLine("------------------------------------------------------------------------------------------------------");
            //}


            //need to add displaying restaurants by rating


Start:
            Console.WriteLine();
            Console.WriteLine("What would you like to do?: ");
            Console.WriteLine("Type 'find' to find restaurant");
            Console.WriteLine("Type 'top' to list top 3 best reviewed restauratns");
            Console.WriteLine("Type 'all review' to list all resturants in order of rating");
            Console.WriteLine("Type 'all city asc' to list all restauratns in order of city ascending");
            Console.WriteLine("Type 'all city desc' to list all restauratns in order of city descending");
            Console.WriteLine("Type 'all name asc' to list all restauratns in order of name ascending");
            Console.WriteLine("Type 'all name desc' to list all restauratns in order of name descending");
            Console.WriteLine("Type 'exit' to exit");
            Console.WriteLine();
            while (true)
            {
                List <Restaurant> top;
                string            option = Console.ReadLine();
                switch (option)
                {
                case "find":
                    Console.WriteLine();
                    Running.Find();
                    break;

                case "exit":
                    Running.Exit();
                    break;

                case "top":
                    Console.WriteLine();
                    top = SearchRestaurantsSer.GetBestReviewedRestaurantsTop3();
                    foreach (var item in top)
                    {
                        Console.WriteLine("Restaurant Name: " + item.Name + ", Rating: " + item.GetAvgReview());
                    }
                    goto Start;

                case "all review":
                    Console.WriteLine();
                    top = SearchRestaurantsSer.GetAllRestaurantsByReviewDescending();
                    foreach (var item in top)
                    {
                        Console.WriteLine("Restaurant Name: " + item.Name + ", Rating: " + item.GetAvgReview());
                    }
                    goto Start;

                case "all name asc":
                    Console.WriteLine();
                    top = SearchRestaurantsSer.GetRestaurantsByNameAscending();
                    foreach (var item in top)
                    {
                        Console.WriteLine("Restaurant Name: " + item.Name + ", Rating: " + item.GetAvgReview());
                    }
                    goto Start;

                case "all name desc":
                    Console.WriteLine();
                    top = SearchRestaurantsSer.GetRestaurantsByNameDescending();
                    foreach (var item in top)
                    {
                        Console.WriteLine("Restaurant Name: " + item.Name + ", Rating: " + item.GetAvgReview());
                    }
                    goto Start;

                case "all city asc":
                    Console.WriteLine();
                    top = SearchRestaurantsSer.GetRestaurantsByLocationCityAscending();
                    foreach (var item in top)
                    {
                        Console.WriteLine("Restaurant location: " + item.GetLocation() + ", Restaurant Name: " + item.Name + ", Rating: " + item.GetAvgReview());
                    }
                    goto Start;

                case "all city desc":
                    Console.WriteLine();
                    top = SearchRestaurantsSer.GetRestaurantsByLocationCityDescending();
                    foreach (var item in top)
                    {
                        Console.WriteLine("Restaurant location: " + item.GetLocation() + ", Restaurant Name: " + item.Name + ", Rating: " + item.GetAvgReview());
                    }
                    goto Start;

                default:
                    Console.WriteLine("Enter Valid Option");
                    Console.WriteLine();
                    goto Start;
                }
            }
        }