Beispiel #1
0
        public ActionResult Index()
        {
            var albums = new List <AlbumVM>();

            if (repo != null)
            {
                var albumsFromDB = repo.All();

                if (albumsFromDB != null)
                {
                    foreach (var album in albumsFromDB)
                    {
                        var albumToAdd = ModelMapper.EntityToModel(album);
                        albums.Add(albumToAdd);
                    }
                }
            }
            return(View(albums));
        }
        public void should_not_find_album_when_two_albums_have_same_name()
        {
            var albums = Builder <Album> .CreateListOfSize(2)
                         .All()
                         .With(x => x.Id               = 0)
                         .With(x => x.Artist           = _artist)
                         .With(x => x.ArtistMetadataId = _artist.ArtistMetadataId)
                         .With(x => x.Title            = "Weezer")
                         .With(x => x.CleanTitle       = "weezer")
                         .Build();

            _albumRepo.InsertMany(albums);

            var album = _albumRepo.FindByTitle(_artist.ArtistMetadataId, "Weezer");

            _albumRepo.All().Should().HaveCount(4);
            album.Should().BeNull();
        }