public void shouldGetNumberOfRestaurantsForManagerWithManyRestaurants()
        {
            RestaurantManager theManager = new RestaurantManager();

            Restaurant firstRestaurant  = new Random_Restaurant_Picker.Models.Restaurant("Matt's Pizza", "770-644-4488", "$", "Senoia GA", "9:00 - 5:00", "5 Miles", 4.5, 5, "MenuURL.com", "ImageURL.com", "5");
            Restaurant secondRestaurant = new Random_Restaurant_Picker.Models.Restaurant("Katy Lou's", "770-644-4488", "$$$", "Senoia GA", "8:00 - 6:00", "5 Miles", 4.9, 3, "MenuURL.com", "ImageURL.com", "6");
            Restaurant thirdRestaurant  = new Random_Restaurant_Picker.Models.Restaurant("Senoia Coffee", "770-644-4488", "$$", "Senoia GA", "9:00 - 2:00", "5 Miles", 5, 0, "MenuURL.com", "ImageURL.com", "7");

            theManager.AddRestaurant(firstRestaurant);
            theManager.AddRestaurant(secondRestaurant);
            theManager.AddRestaurant(thirdRestaurant);

            Assert.AreEqual(3, theManager.GetNumberOfRestaurants());
        }
Exemplo n.º 2
0
        public void shouldAllowMinimumAndMaximumIndexOneAboveMinimum()
        {
            RestaurantManager theManager = new RestaurantManager();

            Restaurant firstRestaurant  = new Random_Restaurant_Picker.Models.Restaurant("Matt's Pizza", "770-644-4488", "$", "Senoia GA", "9:00 - 5:00", "5 Miles", 4.5, 5, "MenuURL.com", "ImageURL.com", "5");
            Restaurant secondRestaurant = new Random_Restaurant_Picker.Models.Restaurant("Katy Lou's", "770-644-4488", "$$$", "Senoia GA", "8:00 - 6:00", "0 Miles", 4.9, 3, "MenuURL.com", "ImageURL.com", "6");
            Restaurant thirdRestaurant  = new Random_Restaurant_Picker.Models.Restaurant("Senoia Coffee", "770-644-4488", "$$", "Senoia GA", "9:00 - 2:00", "25 Miles", 5, 0, "MenuURL.com", "ImageURL.com", "7");

            theManager.AddRestaurant(firstRestaurant);
            theManager.AddRestaurant(secondRestaurant);
            theManager.AddRestaurant(thirdRestaurant);

            Assert.AreEqual("Restaurant (name: Katy Lou's price: $$$ location: Senoia GA hours: 8:00 - 6:00 distance: 0 Miles review score: 4.9 review count: 3 menu URL: MenuURL.com image URL: ImageURL.com id: 6)", theManager.PickRandomRestaurant(1, 1).ToString());
        }
Exemplo n.º 3
0
        public void shouldAddManyRestaurants()
        {
            RestaurantManager theManager       = new RestaurantManager();
            Restaurant        firstRestaurant  = new Random_Restaurant_Picker.Models.Restaurant("Matt's Pizza", "770-644-4488", "$", "Senoia GA", "9:00 - 5:00", "5 Miles", 4.5, 5, "MenuURL.com", "ImageURL.com", "5");
            Restaurant        secondRestaurant = new Random_Restaurant_Picker.Models.Restaurant("Katy Lou's", "770-644-4488", "$$$", "Senoia GA", "8:00 - 6:00", "0 Miles", 4.9, 3, "MenuURL.com", "ImageURL.com", "6");
            Restaurant        thirdRestaurant  = new Random_Restaurant_Picker.Models.Restaurant("Senoia Coffee", "770-644-4488", "$$", "Senoia GA", "9:00 - 2:00", "25 Miles", 5, 0, "MenuURL.com", "ImageURL.com", "7");

            theManager.AddRestaurant(firstRestaurant);
            theManager.AddRestaurant(secondRestaurant);
            theManager.AddRestaurant(thirdRestaurant);

            Assert.AreEqual("Restaurant (name: Matt's Pizza price: $ location: Senoia GA hours: 9:00 - 5:00 distance: 5 Miles review score: 4.5 review count: 5 menu URL: MenuURL.com image URL: ImageURL.com id: 5)\n"
                            + "Restaurant (name: Katy Lou's price: $$$ location: Senoia GA hours: 8:00 - 6:00 distance: 0 Miles review score: 4.9 review count: 3 menu URL: MenuURL.com image URL: ImageURL.com id: 6)\n"
                            + "Restaurant (name: Senoia Coffee price: $$ location: Senoia GA hours: 9:00 - 2:00 distance: 25 Miles review score: 5 review count: 0 menu URL: MenuURL.com image URL: ImageURL.com id: 7)\n", theManager.ToString());
        }
Exemplo n.º 4
0
        public void shouldAllowMinimumAndMaximumIndexAtMinimum()
        {
            RestaurantManager theManager    = new RestaurantManager();
            Restaurant        theRestaurant = new Random_Restaurant_Picker.Models.Restaurant("Matt's Pizza", "770-644-4488", "$", "Senoia GA", "9:00 - 5:00", "5 Miles", 4.5, 5, "MenuURL.com", "ImageURL.com", "5");

            theManager.AddRestaurant(theRestaurant);

            Assert.AreEqual("Restaurant (name: Matt's Pizza price: $ location: Senoia GA hours: 9:00 - 5:00 distance: 5 Miles review score: 4.5 review count: 5 menu URL: MenuURL.com image URL: ImageURL.com id: 5)", theManager.PickRandomRestaurant(0, 0).ToString());
        }
        public void shouldGetNumberOfRestaurantsForManagerWithOneRestaurant()
        {
            RestaurantManager theManager = new RestaurantManager();

            Restaurant firstRestaurant = new Random_Restaurant_Picker.Models.Restaurant("Matt's Pizza", "770-644-4488", "$", "Senoia GA", "9:00 - 5:00", "5 Miles", 4.5, 5, "MenuURL.com", "ImageURL.com", "5");

            theManager.AddRestaurant(firstRestaurant);

            Assert.AreEqual(1, theManager.GetNumberOfRestaurants());
        }
        public void shouldRemoveRestaurantFromManagerWithOneMatchingRestaurant()
        {
            RestaurantManager theManager    = new RestaurantManager();
            Restaurant        theRestaurant = new Random_Restaurant_Picker.Models.Restaurant("Matt's Pizza", "770-644-4488", "$", "Senoia GA", "9:00 - 5:00", "5 Miles", 4.5, 5, "MenuURL.com", "ImageURL.com", "5");

            theManager.AddRestaurant(theRestaurant);
            theManager.RemoveRestaurant(theRestaurant);

            Assert.AreEqual("", theManager.ToString());
        }
Exemplo n.º 7
0
        public void shouldGetRandomRestaurant()
        {
            RestaurantManager theManager    = new RestaurantManager();
            Restaurant        theRestaurant = new Random_Restaurant_Picker.Models.Restaurant("Katy Lou's", "770-644-4488", "$$$", "Senoia GA", "8:00 - 6:00", "0 Miles", 4.9, 3, "MenuURL.com", "ImageURL.com", "6");

            theManager.AddRestaurant(theRestaurant);

            theManager.PickRandomRestaurant(0, theManager.GetNumberOfRestaurants());

            Assert.AreEqual("Restaurant (name: Katy Lou's price: $$$ location: Senoia GA hours: 8:00 - 6:00 distance: 0 Miles review score: 4.9 review count: 3 menu URL: MenuURL.com image URL: ImageURL.com id: 6)", theManager.GetRandomRestaurant().ToString());
        }
        public void shouldNotRemoveRestaurantFromManagerWithOneNotMatchingRestaurant()
        {
            RestaurantManager theManager       = new RestaurantManager();
            Restaurant        firstRestaurant  = new Random_Restaurant_Picker.Models.Restaurant("Matt's Pizza", "770-644-4488", "$", "Senoia GA", "9:00 - 5:00", "5 Miles", 4.5, 5, "MenuURL.com", "ImageURL.com", "5");
            Restaurant        secondRestaurant = new Random_Restaurant_Picker.Models.Restaurant("Katy Lou's", "770-644-4488", "$$$", "Senoia GA", "8:00 - 6:00", "0 Miles", 4.9, 3, "MenuURL.com", "ImageURL.com", "6");

            theManager.AddRestaurant(firstRestaurant);
            theManager.RemoveRestaurant(secondRestaurant);

            Assert.AreEqual("Restaurant (name: Matt's Pizza price: $ location: Senoia GA hours: 9:00 - 5:00 distance: 5 Miles review score: 4.5 review count: 5 menu URL: MenuURL.com image URL: ImageURL.com id: 5)\n", theManager.ToString());
        }
Exemplo n.º 9
0
 private void addRestaurant(JObject restaurantObjectData, RestaurantManager theManager)
 {
     try {
         Restaurant restaurantToAdd = new Restaurant(
             restaurantObjectData.GetValue("name").ToString(),
             restaurantObjectData.GetValue("display_phone").ToString(),
             restaurantObjectData.GetValue("price").ToString(),
             this.AssembleLocationString(restaurantObjectData.GetValue("location")),
             null,
             restaurantObjectData.GetValue("distance").ToString(),
             (double)restaurantObjectData.GetValue("rating"),
             (int)restaurantObjectData.GetValue("review_count"),
             restaurantObjectData.GetValue("url").ToString(),
             restaurantObjectData.GetValue("image_url").ToString(),
             restaurantObjectData.GetValue("id").ToString()
             );
         theManager.AddRestaurant(restaurantToAdd);
     }
     catch (NullReferenceException e) {
         Console.WriteLine(e.Message);
     }
 }
Exemplo n.º 10
0
        public void shouldNotAddNullRestaurant()
        {
            RestaurantManager theManager = new RestaurantManager();

            Assert.ThrowsException <ArgumentException>(() => theManager.AddRestaurant(null));
        }