public static Album GenerateAlbumWithTracks() { var album = GenerateAlbum(); var tracksPerAlbum = new Limit(rng, 8, 20); var trackCount = tracksPerAlbum.RandomValue(); album.Tracks = GenerateTracks(album, album.Artist).Take(trackCount).ToList(); return(album); }
public static Album GenerateAlbum() { var albumYear = new Limit(rng, 1980, DateTime.Now.Year); var artist = GenerateArtist(); return(new Album { Artist = artist, Id = Guid.NewGuid().ToString(), Title = GenerateTitle(), Year = albumYear.RandomValue(), CoverUri = new Uri("https://placehold.it/256") }); }
public static Album GenerateAlbum() { var tracksPerAlbum = new Limit(8, 20); var wordsInAlbumTitle = new Limit(1, 3); var wordsInTrackTitle = new Limit(1, 6); var trackCount = tracksPerAlbum.RandomValue(); var artistRng = new Random(); var artistName = ArtistNames[artistRng.Next(ArtistNames.Length)]; var album = new Album { Artist = new Artist { Name = artistName }, Id = Guid.NewGuid().ToString(), Title = ToTitleCase(String.Join(" ", wordsInAlbumTitle.RandomSet(AlbumWords))), Tracks = new List <Track>(), CoverUri = new Uri("https://placehold.it/256") }; for (var i = 0; i < trackCount; i++) { album.Tracks.Add(new Track { Album = album, Artist = new Artist { Name = artistName }, DiscNumber = 1, TrackNumber = i + 1, Id = Guid.NewGuid().ToString(), Title = ToTitleCase(String.Join(" ", wordsInTrackTitle.RandomSet(TrackWords))) }); } return(album); }