예제 #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);
 }
예제 #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);
 }
예제 #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);
 }
예제 #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);
 }
예제 #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);
 }
예제 #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();
            }

        }