示例#1
0
        public void Weekly_Empty_ReturnsGenresRatedInLastWeek()
        {
            var genres = new List <Genre>
            {
                new Genre
                {
                    Artists = new List <Artist>
                    {
                        new Artist
                        {
                            Songs = new List <Song>
                            {
                                new Song
                                {
                                    Ratings = new List <Rating>
                                    {
                                        new Rating
                                        {
                                            RatedOn = DateTime.Today
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                new Genre
                {
                    Artists = new List <Artist>
                    {
                        new Artist
                        {
                            Songs = new List <Song>
                            {
                                new Song
                                {
                                    Ratings = new List <Rating>
                                    {
                                        new Rating
                                        {
                                            RatedOn = DateTime.Today - TimeSpan.FromDays(8)
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };

            _query = new TopRatedGenreQuery(genres, 3);

            var results = _query.Weekly();

            const int expected = 1;

            Assert.AreEqual(expected, results.Count);
        }
        public GenreRatings GenreRatings(int takeAmount)
        {
            var albums = _genreRepository.Get();

            var query = new TopRatedGenreQuery(albums, takeAmount);

            return(new GenreRatings
            {
                TopAllTimeRatedGenres = query.AllTime(),
                TopDailyRatedGenres = query.Daily(),
                TopWeeklyRatedGenres = query.Weekly(),
                TopMonthlyRatedGenres = query.Monthly()
            });
        }