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

            _context.Artists.Add(artist);
            _context.SaveChanges();

            var results = _ratingService.ArtistRatings(3);

            const int expected = 1;

            Assert.AreEqual(expected, results.TopDailyRatedArtists.Count());
            Assert.AreEqual(expected, results.TopWeeklyRatedArtists.Count());
            Assert.AreEqual(expected, results.TopMonthlyRatedArtists.Count());
            Assert.AreEqual(expected, results.TopAllTimedRatedArtists.Count());
        }
Пример #2
0
        public void ArtistRatings_IntTakeAmount_CallsArtistRepoGet()
        {
            _ratingService.ArtistRatings(new int());

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