Пример #1
0
        public bool TryGetValue(string key, out Func <object> result)
        {
            var random = new Random(id);

            switch (key)
            {
            case "id": result = () => id; break;

            case "name": result = () => {
                    var firstName = RandomPicker.Pick(random, firstNames);
                    if (firstName == "Melissa")
                    {
                        System.Diagnostics.Debugger.Break();
                    }
                    return(firstName + " " + RandomPicker.Pick(random, lastNames));
            }; break;

            case "dob": result = () => new RandomDate(random); break;

            case "address": result = () => new Address(random.Next()); break;

            case "phone": result = () => RandomPicker.Pick(random, 100, 999) + "-" + RandomPicker.Pick(random, 100, 999) + "-" + RandomPicker.Pick(random, 1000, 9999); break;

            case "friends": result = () => PickFriends(random); break;

            default: result = null; break;
            }
            return(result != null);
        }
Пример #2
0
        public bool TryGetValue(string key, out Func <object> result)
        {
            var random = new Random(_id);

            switch (key)
            {
            case "street": result = () => RandomPicker.Pick(random, 1, 1000) + " " + RandomPicker.Pick(random, streetNames) + " " + RandomPicker.Pick(random, streetTypes); break;

            case "zipCode": result = () => RandomPicker.Pick(random, 10000, 99999); break;

            default: result = null; break;
            }
            return(result != null);
        }
Пример #3
0
 public RandomDate(Random random)
 {
     day   = RandomPicker.Pick(random, 1, 28);
     month = RandomPicker.Pick(random, 1, 12);
     year  = RandomPicker.Pick(random, 1925, 2019);
 }