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);
 }
 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);
 }
 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);
 }
 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);
 }
 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);
 }
Esempio n. 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();
            }

        }