Exemple #1
0
        public static Customer[] Generate()
        {
            var company = new Bogus.DataSets.Company(locale: "en");
            var name    = new Bogus.DataSets.Name("en");
            var address = new Bogus.DataSets.Address("en_GB");

            var fake = new Faker <Customer>("en")
                       .StrictMode(true)
                       .RuleFor(x => x.CustomerType, (f) => f.PickRandom(new[] { CustomerType.New, CustomerType.Continue }))
                       .RuleFor(x => x.Name, (f) => name.FullName())
                       .RuleFor(x => x.Id, (f) => f.UniqueIndex)
                       .RuleFor(x => x.Company, f => {
                return(company.CompanyName());
            })
                       .RuleFor(x => x.Address, (f) => address.City());

            var datas = new[] {
                fake.Generate(),
                fake.Generate(),
                fake.Generate(),
                fake.Generate(),
                fake.Generate(),
                fake.Generate(),
                fake.Generate()
            };

            return(datas);
        }
Exemple #2
0
    public void GeneratePackage()
    {
        //assigns random data to the box the player must check matches screen
        var random = new Bogus.Randomizer();
        var data   = new Bogus.DataSets.Commerce("en");
        var local  = new Bogus.DataSets.Address("en");
        var user   = new Bogus.DataSets.Name("en");

        zip     = local.ZipCode();
        address = local.StreetAddress();
        ID      = random.Number(1, 9999);
        item    = data.Product();
        name    = user.FullName();
    }
        public static List <Employee> GenerateEmployees(int count)
        {
            var croatianNames = new Bogus.DataSets.Name("hr");

            var testEmployees = new Faker <Employee>()
                                .RuleFor(e => e.EmployeeName, (f, e) => croatianNames.FullName())
                                .RuleFor(e => e.HasDriverLicence, f => f.Random.Bool());


            var generatedEmployees = testEmployees.Generate(count);

            int id = 1;

            foreach (var employee in generatedEmployees)
            {
                employee.EmployeeId = id++;
            }
            return(generatedEmployees);
        }
Exemple #4
0
    public void GenerateAnswer(int num)
    {
        //if num is 1 generate 1 false answer if not set the answer to the values already asssigned
        var random = new Bogus.Randomizer();
        var data   = new Bogus.DataSets.Commerce("en");
        var local  = new Bogus.DataSets.Address("en");
        var user   = new Bogus.DataSets.Name("en");

        reject   = false;
        zipA     = zip;
        addressA = address;
        nameA    = name;
        IDA      = ID;
        itemA    = item;
        if (num == 1)
        {
            reject = true;
            int numb = random.Number(1, 5);
            if (numb == 1)
            {
                zipA = zip = local.ZipCode();
            }
            if (numb == 2)
            {
                address = local.StreetAddress();
            }
            if (numb == 3)
            {
                ID = random.Number(1, 9999);
            }
            if (numb == 4)
            {
                item = data.Product();
            }
            else
            {
                name = user.FullName();
            }
        }
    }