Example #1
0
 public void WhenSearchingForRestaurantWith_SE19_ShouldThrowExcptionWhenExternalURLIsDown()
 {
     string         BaseURI        = "https://blah/";
     FindRestaurant findRestaurant = new FindRestaurant(BaseURI);
     var            restaurant     = findRestaurant.WithOutCode("SE19");
     bool           any            = restaurant.Any(c => c.IsOpenNow == false);
 }
Example #2
0
        public void WhenSearchingForRestaurantWith_SE19_ShouldReturn_FoodType()
        {
            string         BaseURI        = "https://public.je-apis.com/";
            FindRestaurant findRestaurant = new FindRestaurant(BaseURI);
            var            restaurant     = findRestaurant.WithOutCode("SE19");

            Assert.IsNotNull(restaurant[0].CuisineTypes[0].Name);
        }
Example #3
0
        public void WhenSearchingForRestaurantWith_SE19_ShouldReturn_Rating()
        {
            string         BaseURI        = "https://public.je-apis.com/";
            FindRestaurant findRestaurant = new FindRestaurant(BaseURI);
            var            restaurant     = findRestaurant.WithOutCode("SE19");

            Assert.IsNotNull(restaurant[0].RatingStars);
        }
Example #4
0
        public void WhenSearchingForRestaurantWith_BLANK_ShouldReturn_Null()
        {
            string         BaseURI        = "https://public.je-apis.com/";
            FindRestaurant findRestaurant = new FindRestaurant(BaseURI);
            var            restaurant     = findRestaurant.WithOutCode("");

            Assert.IsNull(restaurant);
        }
Example #5
0
        public void WhenSearchingForRestaurantWith_SE19_ShouldReturnRestaurantWhichAreAvailable()
        {
            string         BaseURI        = "https://public.je-apis.com/";
            FindRestaurant findRestaurant = new FindRestaurant(BaseURI);
            var            restaurant     = findRestaurant.WithOutCode("SE19");
            bool           any            = restaurant.Any(c => c.IsOpenNow == false);

            Assert.IsFalse(any);
        }
Example #6
0
        protected void Find_Click(object sender, EventArgs e)
        {
            RestaurantView.EmptyDataText = "No data available.";
            string         searchText     = [email protected];
            string         BaseURI        = ConfigurationManager.AppSettings["BaseURL"];
            FindRestaurant findRestaurant = new FindRestaurant(BaseURI);

            try
            {
                List <Restaurant> restaurants = findRestaurant.WithOutCode(searchText);
                RestaurantView.DataSource = restaurants;
                RestaurantView.DataBind();
            }
            catch (Exception)
            {
                RestaurantView.EmptyDataText = "Something got a bit wrong Please try again later";
                RestaurantView.DataBind();
            }
        }