public void GenreRatings_Int_ReturnsCorrectGenreRatings()
        {
            var genre = new Genre
            {
                Id      = Guid.NewGuid(),
                Artists = new List <Artist>
                {
                    new Artist
                    {
                        Id    = Guid.NewGuid(),
                        Songs = new List <Song>
                        {
                            new Song
                            {
                                Id    = Guid.NewGuid(),
                                Album = new Album {
                                    Id = Guid.NewGuid()
                                },
                                Ratings = new List <Rating>
                                {
                                    new Rating
                                    {
                                        Id      = Guid.NewGuid(),
                                        RatedOn = DateTime.Today,
                                        User    = new User {
                                            Id = Guid.NewGuid()
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };

            _context.Genres.Add(genre);
            _context.SaveChanges();

            var results = _ratingService.GenreRatings(3);

            const int expected = 1;

            Assert.AreEqual(expected, results.TopDailyRatedGenres.Count());
            Assert.AreEqual(expected, results.TopWeeklyRatedGenres.Count());
            Assert.AreEqual(expected, results.TopMonthlyRatedGenres.Count());
            Assert.AreEqual(expected, results.TopAllTimeRatedGenres.Count());
        }
Ejemplo n.º 2
0
        public void GenreRatings_IntTakeAmount_CallsGenreRepoGet()
        {
            _ratingService.GenreRatings(new int());

            _genreRepository.Verify(x => x.Get(), Times.AtLeastOnce);
        }