示例#1
0
        private static void CheckTimeGenerateList(int count, GenerateList func, IGetHashCode getHashCode)
        {
            Stopwatch stopwatch = new();

            stopwatch.Start();
            func(getHashCode, count);
            stopwatch.Stop();
            Console.WriteLine($"Время генерации для {count} объектов: {stopwatch.ElapsedMilliseconds}");
        }
示例#2
0
        private void CreatePersonList(IGetHashCode getHashCode, int count)
        {
            List <Human> persons = new();
            Faker        faker   = new();
            DateTime     dateTime;

            for (int i = 0; i < count; i++)
            {
                dateTime = new(faker.Random.Int(1980, 2000), faker.Random.Int(1, 12), faker.Random.Int(1, 28));
                var   gender = faker.Person.Gender;
                Human person = new(faker.Name.FirstName(gender) + faker.Name.FullName(gender), dateTime, faker.Address.City(), 19999999, getHashCode);
                persons.Add(person);
            }
        }
示例#3
0
        private void CreatePersonDictionary(IGetHashCode getHashCode, int count)
        {
            Dictionary <Human, string> persons = new();
            Faker    faker = new("ru");
            DateTime dateTime;

            for (int i = 0; i < count; i++)
            {
                dateTime = new(faker.Random.Int(1980, 2000), faker.Random.Int(1, 12), faker.Random.Int(1, 28));
                var   gender = faker.Person.Gender;
                Human human  = new(faker.Name.FirstName(gender) + faker.Name.FullName(gender), dateTime, faker.Address.City(), 19999999, getHashCode);
                persons.Add(human, faker.Address.City());
            }
        }
示例#4
0
        public Human(string fullName, DateTime date, string place, int passport, IGetHashCode getHashCode)
        {
            if (fullName == null)
            {
                throw new ArgumentNullException($"Значение {nameof(fullName)} не может быть {fullName}");
            }

            if (passport < 1000000 && passport > 9999999)
            {
                throw new ArgumentOutOfRangeException($"Значение {nameof(passport)} не может быть {passport}");
            }

            PlaceBirth = place ?? throw new ArgumentNullException($"Значение {nameof(place)} не может быть {place}");

            NameSurnamePatronymic = GetFullName(fullName);
            DateBirth             = date;
            Passport = passport;
            _getCode = getHashCode;
        }