Exemple #1
0
        public void Rating_Includes_Only_First_N_reviews()
        {
            Restaurant data   = BuildRestaurantAndReviews(1, 1, 1, 10, 10, 10);
            var        rater  = new RestaurantRater(data);
            var        result = rater.ComputeResult(new SimpleRatingAlgorithm(), 3);

            Assert.AreEqual(1, result.Rating);
        }
Exemple #2
0
        public void Weighted_Averaging_For_Two_Reviews()
        {
            Restaurant data   = BuildRestaurantAndReviews(3, 9);
            var        rater  = new RestaurantRater(data);
            var        result = rater.ComputeResult(new WeightedRatingAlgorithm(), 10);

            Assert.AreEqual(5, result.Rating);
        }
Exemple #3
0
        public void Computes_Result_For_Two_Reviews()
        {
            Restaurant data   = BuildRestaurantAndReviews(ratings: new int[] { 4, 8 });
            var        rater  = new RestaurantRater(data);
            var        result = rater.ComputeResult(new SimpleRatingAlgorithm(), 10);

            Assert.AreEqual(6, result.Rating);
        }
        public void Compute_Results_For_Two_Reviews()
        {
            var data = BuildRestaurantAndReviews(ratings: new[] { 4, 8 });

            var rater = new RestaurantRater(data);
            var result = rater.ComputeResult(new SimpleRatingAlgorith(), 10);

            Assert.AreEqual(6, result.Rating);
        }
Exemple #5
0
        public void Computes_Weightedf_Average_For_Two_Review()
        {
            var data = BuilRestaurantsWithReviews(3, 9);

            var rater  = new RestaurantRater(data);
            var result = rater.ComputeWeightedRate(new WeightedRatingAlgorithm(), 0);

            Assert.AreEqual(5, result.Rating);
        }
Exemple #6
0
        public void Rating_Only_Uses_First_N_Reviews()
        {
            var data = BuilRestaurantsWithReviews(ratings: new[] { 1, 1, 1, 10, 10, 10 });

            var rater  = new RestaurantRater(data);
            var result = rater.ComputeResult(new SimpleRatingAlgorithm(), 3);

            Assert.AreEqual(1, result.Rating);
        }
Exemple #7
0
        public void Computes_Result_For_One_Review()
        {
            var data = BuildRestaurantAndReviews(ratings: 4);

            var rater = new RestaurantRater(data);
            var result = rater.ComputeResult(new SimpleRatingAlgorithm(), 10);

            Assert.AreEqual(4, result.Rating);
        }
Exemple #8
0
        public void Weighted_Averaging_For_Multiple_Reviews()
        {
            var restaurant = BuildRestaurantAndReviews(2, 2, 2, 0, 0, 0);

            var rater  = new RestaurantRater(restaurant);
            var result = rater.ComputerResult(new WeightedRatingAlgorithm(), 5);

            Assert.AreEqual(1, result.Rating);
        }
Exemple #9
0
        public void Weighted_Average_Of_Two_Reviews()
        {
            var data = BuildRestaurantAndReviews(3, 9);

            var rater  = new RestaurantRater(data);
            var result = rater.ComputeWeightedRate(10);

            Assert.AreEqual(6, result.Rating);
        }
Exemple #10
0
        public void Weighted_Average_For_Two_Reviews()
        {
            var data = BuildRestaurantsAndReviews(3,9);

            var rater = new RestaurantRater(data);
            var result = rater.ComputeWeightedRate(10);

            Assert.AreEqual(5, result.Rating);
        }
Exemple #11
0
        public void Computes_Result_For_Two_Reviews()
        {
            var data = BuildRestaurantsAndReviews(ratings: new [] {4, 8});

            var rater = new RestaurantRater(data);
            var result = rater.ComputeRating(10);

            Assert.AreEqual(6, result.Rating);
        }
        public void Computes_Result_For_One_Review()
        {
            var data = BuildRestaurantAndReviews(ratings: 4);

            var rater  = new RestaurantRater(data);
            var result = rater.ComputeResult(new SimpleRatingAlgorithm(), 10);

            Assert.AreEqual(4, result.Rating);
        }
        public void Weighted_Averaging_For_Two_Reviews()
        {
            var data = BuildRestaurantAndReviews(3, 9);

            var rater = new RestaurantRater(data);
            var result = rater.ComputeResult(new WeightRatingAlgorithm(), 10);

            Assert.AreEqual(5, result.Rating);
        }
        public void Rating_Includes_Only_First_N_Reviews()
        {
            var data = BuildRestaurantAndReviews(1, 1, 1, 10, 10, 10);

            var rater = new RestaurantRater(data);
            var result = rater.ComputeResult(new SimpleRatingAlgorithm(), 3);

            Assert.AreEqual(1, result.Rating);
        }
Exemple #15
0
        public void Compute_Result_For_Two_Reviews()
        {
            var data = BuildRestaurantAndReviews(4, 8);


            var rater  = new RestaurantRater(data);
            var result = rater.ComputeRating(10);

            Assert.AreEqual(6, result.Rating);
        }
        public void Computes_Result_For_One_Review()
        {
            var data = new Restaurant();
            data.Reviews = new List<RestaurantReview>();
            data.Reviews.Add(new RestaurantReview() { Rating = 4 });

            var rater = new RestaurantRater(data);
            var result = rater.ComputeResult(new SimpleRatingAlgorithm(),10);

            Assert.AreEqual(4, result.Rating);
        }
Exemple #17
0
        public void Computes_Result_For_One_Review()
        {
            // Arrange
            var data = BuildRestaurantAndReviews(ratings: 4);

            // Act
            var rater = new RestaurantRater(data);
            var result = rater.ComputeRating(10);

            // Assert
            Assert.AreEqual(4, result.Rating);
        }
Exemple #18
0
        public void Computes_Result_For_One_Review()
        {
            //First we need a restaurant
            var data = BuildRestaurantsAndReviews(ratings: 4);
            //Lets create some method to calculate our rating - "rater"

            var rater = new RestaurantRater(data);
            //ComputerRating accepts number of reviews to use
            var result = rater.ComputeRating(10);

            //Assert the result
            Assert.AreEqual(4,result.Rating);
        }
Exemple #19
0
        public void Computes_Result_For_One_Review()
        {
            var data = new Restaurant();

            data.Reviews = new List <RestaurantReview>();
            data.Reviews.Add(new RestaurantReview()
            {
                Rating = 4
            });

            var rater  = new RestaurantRater(data);
            var result = rater.ComputeRating(10);

            Assert.AreEqual(4, result.Rating);
        }