Created
February 8, 2017 22:32
-
-
Save jhalbrecht/c9325da49fc9642db196b01df4eefc6e to your computer and use it in GitHub Desktop.
Worked up a nice seed of fake data in LinqPad before implementing in my Visual Studio solution.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var playlists = PlayListFaker.Generator.Generate(5).ToList(); | |
playlists.Dump(); | |
} | |
public class PlayListFaker : PlayList | |
{ | |
static Random random = new Random(); | |
public static Faker<PlayList> Generator | |
{ get; } = new Faker<PlayList>() | |
.RuleFor(p => p.PlayListId, p => IdCounter++) | |
.RuleFor(p => p.PlayListName, p => p.Name.FirstName()) | |
.RuleFor(p => p.Sounds, p => LocalSfxV2Faker.Generator.Generate(random.Next(2, 12)).ToList()); | |
protected static int IdCounter = 0; | |
public static IList<PlayList> PlayLists { get; } = PlayListFaker.Generator.Generate(5).ToList(); | |
} | |
public class LocalSfxV2Faker : LocalSfxV2 | |
{ | |
public static Faker<LocalSfxV2> Generator { get; } = new Faker<LocalSfxV2>() | |
.RuleFor(p => p.Id, p => IdState++) | |
.RuleFor(p => p.Name, p => p.Name.FirstName()) | |
.RuleFor(p => p.CreateDate, p => p.Date.Recent()) | |
.RuleFor(p => p.Duration, p => p.Date.Timespan(new TimeSpan(0, 0, 0, 10, 0))) | |
.RuleFor(p => p.NumerTimesPlayed, p => p.Random.Number(25)) | |
.RuleFor(p => p.StarRating, p => p.Random.Number(5)) | |
.RuleFor(p => p.Creator, p => p.Name.FirstName()) | |
.RuleFor(p => p.Description, p => p.Lorem.Sentence()); | |
protected static int IdState = 0; | |
public static IList<LocalSfxV2> PlayLists { get; } = LocalSfxV2Faker.Generator.Generate(5).ToList(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment