Exemple #1
0
        public static Company Random()
        {
            var rand         = new Random();
            var numEmployees = rand.Next(1, 100);
            var people       = RandomUser.RandomUsers(numEmployees + 2);
            var person       = people.First();

            people = people.Skip(1);
            return(new Company()
            {
                companyName = person.fullName + companyType,

                netWorth = rand.Next(1000, 1000000),
                address = new Address()
                {
                    number = person.location.street.number,
                    street = person.location.street.name,
                    city = person.location.city
                },
                shareholders = Shareholder.Randoms(),
                employees = people.Select(p => new Employee()
                {
                    name = p.fullName, age = p.dob.age.ToString()
                }).ToList()
            });
        }
Exemple #2
0
        public static Employee Random()
        {
            var rand         = new Random();
            var randomPerson = RandomUser.Random();
            var employee     = new Employee()
            {
                name   = randomPerson.fullName,
                salary = rand.Next(32000, 250000).ToString(),
                age    = rand.Next(18, 80).ToString()
            };

            return(employee);
        }
Exemple #3
0
        public static List <Shareholder> Randoms()
        {
            var shareholders   = new List <Shareholder>();
            var remainingStake = 100;
            var people         = RandomUser.RandomUsers(100);
            var random         = new Random();

            while (remainingStake > 0)
            {
                var stake       = random.Next(1, remainingStake + 1);
                var shareholder = new Shareholder(people.First().fullName, stake);
                people          = people.Skip(1);
                remainingStake -= stake;
                shareholders.Add(shareholder);
            }
            return(shareholders);
        }