public void TestGetAlbumListModels() { List <AlbumEntity> entities; using (var context = new MyPhotoDbContext()) { if (!context.Albums.Any()) { context.Albums.Add(new AlbumEntity { Name = "album test", Description = "album test desc" } ); context.SaveChanges(); } entities = context.Albums.ToList(); } var albums = _repository.GetAlbumListModels().ToList(); foreach (var entity in entities) { var album = albums.FirstOrDefault(a => a.Id == entity.Id); Assert.NotNull(album); Assert.Equal(entity.Name, album.Name); } }