示例#1
0
        protected override void Seed(ToDoDotNet.Data.ToDoDbContext context)
        {
            var lorem = new Bogus.DataSets.Lorem();
            var dates = new Bogus.DataSets.Date();

            context.ToDos.AddOrUpdate(x => x.Id,
                                      new ToDo()
            {
                Title = lorem.Word(), Body = lorem.Sentences(), CreationDate = dates.Soon()
            },
                                      new ToDo()
            {
                Title = lorem.Word(), Body = lorem.Sentences(), CreationDate = dates.Soon()
            },
                                      new ToDo()
            {
                Title = lorem.Word(), Body = lorem.Sentences(), CreationDate = dates.Soon()
            },
                                      new ToDo()
            {
                Title = lorem.Word(), Body = lorem.Sentences(), CreationDate = dates.Soon()
            },
                                      new ToDo()
            {
                Title = lorem.Word(), Body = lorem.Sentences(), CreationDate = dates.Soon()
            }
                                      );
        }
        public IEnumerable <Application> GetApplications()
        {
            var applicationId     = 1;
            var applicationData   = new Bogus.DataSets.Lorem("en");
            var applicationStatus = new[] { "New", "App Team Engaged", "Analyzed", "Disposition Initiated", "Dispositioned", "Deployed" };

            Randomizer.Seed = new Random(123789);

            var applicationGenerator = new Faker <Application>()
                                       .RuleFor(app => app.Id, mck => $"CA {applicationId++}")
                                       .RuleFor(app => app.Name, mck => String.Join(" ", applicationData.Words(4)))
                                       .RuleFor(app => app.RemedyId, mck => $"OI-{Guid.NewGuid()}")
                                       .RuleFor(app => app.Description, mck => applicationData.Sentence(8))
                                       .RuleFor(app => app.ShortAppId, mck => applicationData.Word())
                                       .RuleFor(app => app.Status, mck => mck.PickRandom(applicationStatus))
                                       .RuleFor(app => app.InstallDate, mck => mck.Date.Past(5).Date)
                                       .RuleFor(app => app.IsHighRisk, mck => mck.Random.Bool());

            return(applicationGenerator.Generate(100));
        }
示例#3
0
        static void Main(string[] args)
        {
            Program program = new Program(2);

            var lorem    = new Bogus.DataSets.Lorem("en");
            var testUser = new Faker <PlayerDetails>()
                           .StrictMode(true)
                           .RuleFor(o => o.UserName, f => lorem.Word())
                           .RuleFor(o => o.Rating, f => f.Random.Number(300, 3000));

            program.players = testUser.Generate(100);

            program.players = program.players.OrderBy(x => x.Rating).ToList();

            program.match.teams = new List <List <PlayerDetails> >();

            for (int i = 0; i < program.numberOfTeams; i++)
            {
                program.match.teams.Add(BuildTeam(program, program.numberOfTeams - i));
            }

            Console.WriteLine(program.match);
        }