Ejemplo n.º 1
0
        public void GetAlbumsListTest()
        {
            AddTrackTest();

            var track = _trackService.GetTracks(1, 10).Items.FirstOrDefault();

            Assert.IsNotNull(track);

            using (var repository = _factory.GetAlbumRepository())
            {
                repository.AddOrUpdate(new Album
                {
                    ArtistId = 1,
                    Name     = "Some album"
                });
                repository.SaveChanges();
            }

            using (var repository = _factory.GetAlbumTrackRelationRepository())
            {
                repository.AddOrUpdate(new AlbumTrackRelation
                {
                    TrackId = 1,
                    AlbumId = 2
                });
            }

            Assert.IsTrue(_trackService.GetAlbums(track.Id, 840, 1).Albums.Any());

            Mock.Get(_factory.GetAlbumRepository())
            .Verify(m => m.GetAll(It.IsAny <Expression <Func <Album, bool> > >(),
                                  It.IsAny <Expression <Func <Album, BaseEntity> >[]>()), Times.Once);
        }