Exemple #1
0
        public void AsExpression_Returns_CorrectNumberOfRestaurants()
        {
            var restaurantList = new List <Restaurant>
            {
                new Restaurant {
                    AverageRating = 4.56
                },
                new Restaurant {
                    AverageRating = 6.16
                },
                new Restaurant {
                    AverageRating = 4.56
                },
                new Restaurant {
                    AverageRating = 1.36
                },
            };

            const int numberToTake = 3;
            var       query        = new TopRatedRestaurantsQuery(restaurantList, numberToTake);

            var results = query.AsExpression();

            Assert.AreEqual(numberToTake, results.Count);
        }
Exemple #2
0
        public void AsExpression_Returns_CorrectRestaurants()
        {
            var lowReview = new Restaurant {
                AverageRating = 0.01
            };
            var restaurantList = new List <Restaurant>
            {
                new Restaurant {
                    AverageRating = 4.56
                },
                new Restaurant {
                    AverageRating = 6.16
                },
                new Restaurant {
                    AverageRating = 4.56
                },
                lowReview
            };

            const int numberToTake = 3;
            var       query        = new TopRatedRestaurantsQuery(restaurantList, numberToTake);

            var results = query.AsExpression();

            Assert.IsFalse(results.Contains(lowReview));
        }
        public List <Restaurant> TopThreeRatedRestaurants()
        {
            var allRestaurants = _restaurantRepository.Get();

            const int takeTopThree = 3;
            var       query        = new TopRatedRestaurantsQuery(allRestaurants, takeTopThree);

            return(query.AsExpression());
        }