Exemplo n.º 1
0
        public IEnumerable <ViewRestaurant> GetRestaurants(RestaurantFilter restaurantFilter)
        {
            IEnumerable <ViewRestaurant> restaurants =
                _viewRestaurantRepository.GetAll()
                .OrderByDescending(p => _restaurantRatingTask.GetConsolidatedRating(p.Id));

            if (restaurantFilter == null)
            {
                return(restaurants);
            }

            if (!string.IsNullOrWhiteSpace(restaurantFilter.Name))
            {
                restaurants =
                    restaurants.Where(
                        p => p.Name.IndexOf(restaurantFilter.Name, StringComparison.InvariantCultureIgnoreCase) != -1);
            }

            if (restaurantFilter.Cuisine != null)
            {
                restaurants =
                    restaurants?.Where(p => p.Type == restaurantFilter.Cuisine.ToString());
            }

            return(restaurants);
        }
        public void ConsolidatedRatingBasicTest()
        {
            //Arrange
            var expectation = 4;

            //Act
            var actual = _restaurantRatingTask.GetConsolidatedRating(_restaurantBranchId);

            //Assert
            Assert.AreEqual(expectation, actual);
        }
Exemplo n.º 3
0
 public float Get(int restaurantBranchId)
 {
     return(_restaurantRatingTask.GetConsolidatedRating(restaurantBranchId));
 }
Exemplo n.º 4
0
 public JsonResult GetRestaurantRating(int parameter)
 {
     return(Json(_restaurantRatingTask.GetConsolidatedRating(parameter)));
 }