public SongRatings SongRatings(int takeAmount)
        {
            var songs = _songRepository.Get();

            var query = new TopRatedSongsQuery(songs, takeAmount);

            return(new SongRatings
            {
                TopAllTimeRatedSongs = query.AllTime(),
                TopDailyRatedSongs = query.Daily(),
                TopWeeklyRatedSongs = query.Weekly(),
                TopMonthlyRatedSongs = query.Monthly()
            });
        }
        public void AllTime_NoParameter_ReturnsTakeAmount()
        {
            _songs = new List <Song>
            {
                new Song
                {
                    AverageRating = 1.0,
                    Ratings       = new List <Rating>
                    {
                        new Rating
                        {
                            RatedOn = DateTime.Today
                        }
                    }
                },
                new Song
                {
                    AverageRating = 3.0,
                    Ratings       = new List <Rating>
                    {
                        new Rating
                        {
                            RatedOn = DateTime.Today
                        }
                    }
                }
            };

            _query = new TopRatedSongsQuery(_songs, 1);

            var result = _query.AllTime();

            const int expected = 1;

            Assert.AreEqual(expected, result.Count);
        }
        public void AllTime_NoParameter_ReturnsSongsByRatingDescending()
        {
            _songs = new List <Song>
            {
                new Song
                {
                    AverageRating = 1.0,
                    Ratings       = new List <Rating>
                    {
                        new Rating
                        {
                            RatedOn = DateTime.Today
                        }
                    }
                },
                new Song
                {
                    AverageRating = 3.0,
                    Ratings       = new List <Rating>
                    {
                        new Rating
                        {
                            RatedOn = DateTime.Today
                        }
                    }
                }
            };

            _query = new TopRatedSongsQuery(_songs, 3);

            var result = _query.AllTime();

            const double expected = 3.0;

            Assert.AreEqual(expected, result.First().AverageRating);
        }