public void PrintRestaurantByNameTest() { MethodCalls.SetLibRest(); int expected = 1; List <Restaurant> test1 = MethodCalls.rest; List <Restaurant> actual = RestaurantReviews.Library.PrintRestaurant.PrintRestaurantByName(test1, "Shake Shack"); Assert.AreEqual(expected, actual.Count()); }
public void PrintReviewsByIdTest() { MethodCalls.SetLibRest(); int expected = 3; List <Restaurant> test1 = MethodCalls.rest; List <Restaurant> actual = RestaurantReviews.Library.PrintRestaurant.PrintReviewsById(test1, 4); Assert.AreEqual(expected, actual.Count()); }
public void LookupTest() { MethodCalls.SetLibRest(); int expected = 2; List <Restaurant> test1 = MethodCalls.rest; List <Restaurant> actual = RestaurantReviews.Library.Search.Lookup(test1, "ch"); Assert.AreEqual(expected, actual.Count()); }
public void AvgRatingSortTest() { MethodCalls.SetLibRest(); string expected = "Martha's Bakery"; List <Restaurant> test1 = MethodCalls.rest; List <Restaurant> actual = RestaurantReviews.Library.Sort.AvgRatingSort(test1); Assert.AreEqual(expected, actual.ElementAt(0).Name); }
public void StringSizeSortTest() { MethodCalls.SetLibRest(); string expected = "Wendy's"; List <Restaurant> test1 = MethodCalls.rest; List <Restaurant> actual = RestaurantReviews.Library.Sort.StringSizeSort(test1); Assert.AreEqual(expected, actual.ElementAt(0).Name); }
public void AlphabeticalSortTest() { MethodCalls.SetLibRest(); string expected = "Applebee's"; List <Restaurant> test1 = MethodCalls.rest; List <Restaurant> actual = RestaurantReviews.Library.Sort.AlphabeticalSort(test1); Assert.AreEqual(expected, actual.ElementAt(0).Name); }
public void SetLibRestTest() { //Arrange int expected = 10; //Act MethodCalls.SetLibRest(); List <Restaurant> actual = MethodCalls.rest; //Assert Assert.AreEqual(expected, actual.Count()); }
static void Main(string[] args) { int x; bool execute = true; string restName; MethodCalls.SetLibRest(); Logger log = LogManager.GetCurrentClassLogger(); log.Info("Starting application"); while (execute) { Console.WriteLine("Press the number corresponding to the option you want:"); Console.WriteLine("1. Display the top 3 restaurants by average rating."); Console.WriteLine("2. Display all restaurants."); Console.WriteLine("3. Display details of a restaurant."); Console.WriteLine("4. Display all the reviews of a restaurant"); Console.WriteLine("5. Search for a restaurant."); Console.WriteLine("6. Quit Application"); x = Convert.ToInt32(Console.ReadLine()); while (x > 6 || x < 1) { Console.WriteLine("That is an invalid input. Please try again: "); x = Convert.ToInt32(Console.ReadKey()); } switch (x) { case 1: { MethodCalls.Topthree(); break; } case 2: { Console.WriteLine("Press the number corresponding to the method of sorting the restaurants"); Console.WriteLine("1. Sort Alphabetically"); Console.WriteLine("2. Sort Reverse Alphabetically"); Console.WriteLine("3. Sort by size of restaurant name"); Console.WriteLine("4. Sort by Average Rating Descending"); x = Convert.ToInt32(Console.ReadLine()); while (x > 5 || x < 1) { Console.WriteLine("That is an invalid input. Please try again: "); x = Convert.ToInt32(Console.ReadLine()); } MethodCalls.chooseSort(x); break; } case 3: { Console.WriteLine("Choose the method of selecting a restaurant"); Console.WriteLine("1. By Name"); Console.WriteLine("2. By ID"); x = Convert.ToInt32(Console.ReadLine()); while (x > 2 || x < 1) { Console.WriteLine("That is an invalid input. Please try again: "); x = Convert.ToInt32(Console.ReadLine()); } if (x == 1) { Console.WriteLine("Enter the name of the restaurant"); restName = Console.ReadLine(); MethodCalls.returnRestByName(restName); } if (x == 2) { Console.WriteLine("Enter the ID of the restaurant"); x = Convert.ToInt32(Console.ReadLine()); MethodCalls.returnRestById(x); } break; } case 4: { Console.WriteLine("Choose the method of selecting a restaurant"); Console.WriteLine("1. By Name"); Console.WriteLine("2. By ID"); x = Convert.ToInt32(Console.ReadLine()); while (x > 2 || x < 1) { Console.WriteLine("That is an invalid input. Please try again: "); x = Convert.ToInt32(Console.ReadLine()); } if (x == 1) { Console.WriteLine("Enter the name of the restaurant"); restName = Console.ReadLine(); MethodCalls.getReviewsByName(restName); } if (x == 2) { Console.WriteLine("Enter the ID of the restaurant"); x = Convert.ToInt32(Console.ReadLine()); MethodCalls.MCReviewsById(x); } break; } case 5: { Console.WriteLine("Enter the string to search"); restName = Console.ReadLine(); MethodCalls.searchRestName(restName); break; } case 6: { log.Info(x); execute = false; break; } } } }
public RestaurantController() { MethodCalls.SetLibRest(); restaurants = MethodCalls.rest; log = LogManager.GetCurrentClassLogger(); }