예제 #1
0
        public static TypicalPersonData MakeRandom()
        {
            var rnd = counter++;

            var data = new TypicalPersonData
            {
                FirstName        = NaturalTextGenerator.GenerateFirstName(),
                MiddleName       = NaturalTextGenerator.GenerateFirstName(),
                LastName         = NaturalTextGenerator.GenerateLastName(),
                DOB              = DateTime.Now.AddYears(5),
                Salary           = 55435345,
                YearsOfService   = 25,
                CreditScore      = 0.7562,
                RegisteredToVote = (DateTime.UtcNow.Ticks & 1) == 0,
                MaritalStatus    = MaritalStatus.HatesAll,
                Address1         = NaturalTextGenerator.GenerateAddressLine(),
                Address2         = NaturalTextGenerator.GenerateAddressLine(),
                AddressCity      = NaturalTextGenerator.GenerateCityName(),
                AddressState     = "CA",
                AddressZip       = "91606",
                HomePhone        = (DateTime.UtcNow.Ticks & 1) == 0 ? "(555) 123-4567" : null,
                EMail            = NaturalTextGenerator.GenerateEMail()
            };

            if (0 != (rnd & (1 << 32)))
            {
                data.Notes = NaturalTextGenerator.Generate(45);
            }
            if (0 != (rnd & (1 << 31)))
            {
                data.SkypeID = NaturalTextGenerator.GenerateEMail();
            }
            if (0 != (rnd & (1 << 30)))
            {
                data.YahooID = NaturalTextGenerator.GenerateEMail();
            }

            if (0 != (rnd & (1 << 29)))
            {
                data.IsSmoker = 0 != (rnd & (1 << 17));
            }
            if (0 != (rnd & (1 << 28)))
            {
                data.IsLoving = 0 != (rnd & (1 << 16));
            }
            if (0 != (rnd & (1 << 27)))
            {
                data.IsLoved = 0 != (rnd & (1 << 15));
            }
            if (0 != (rnd & (1 << 26)))
            {
                data.IsDangerous = 0 != (rnd & (1 << 14));
            }
            if (0 != (rnd & (1 << 25)))
            {
                data.IsEducated = 0 != (rnd & (1 << 13));
            }

            if (0 != (rnd & (1 << 24)))
            {
                data.LastSmokingDate = DateTime.Now.AddYears(-10);
            }

            if (0 != (rnd & (1 << 23)))
            {
                data.DesiredSalary = rnd / 1000m;
            }
            if (0 != (rnd & (1 << 22)))
            {
                data.ProbabilityOfSpaceFlight = rnd / (double)int.MaxValue;
            }

            if (0 != (rnd & (1 << 21)))
            {
                data.CurrentFriendCount = rnd % 123;
                data.DesiredFriendCount = rnd % 121000;
            }

            return(data);
        }
예제 #2
0
        public static TypicalPersonData MakeRandom()
        {
            var rnd = counter++;

            var data = new TypicalPersonData
            {
                FirstName = NaturalTextGenerator.GenerateFirstName(),
                MiddleName = NaturalTextGenerator.GenerateFirstName(),
                LastName = NaturalTextGenerator.GenerateLastName(),
                DOB = DateTime.Now.AddYears(5),
                Salary = 55435345,
                YearsOfService = 25,
                CreditScore = 0.7562,
                RegisteredToVote = (DateTime.UtcNow.Ticks & 1) == 0,
                MaritalStatus = MaritalStatus.HatesAll,
                Address1 = NaturalTextGenerator.GenerateAddressLine(),
                Address2 = NaturalTextGenerator.GenerateAddressLine(),
                AddressCity = NaturalTextGenerator.GenerateCityName(),
                AddressState = "CA",
                AddressZip = "91606",
                HomePhone = (DateTime.UtcNow.Ticks & 1) == 0 ? "(555) 123-4567" : null,
                EMail = NaturalTextGenerator.GenerateEMail()
            };

            if (0 != (rnd & (1 << 32))) data.Notes = NaturalTextGenerator.Generate(45);
            if (0 != (rnd & (1 << 31))) data.SkypeID = NaturalTextGenerator.GenerateEMail();
            if (0 != (rnd & (1 << 30))) data.YahooID = NaturalTextGenerator.GenerateEMail();

            if (0 != (rnd & (1 << 29))) data.IsSmoker = 0 != (rnd & (1 << 17));
            if (0 != (rnd & (1 << 28))) data.IsLoving = 0 != (rnd & (1 << 16));
            if (0 != (rnd & (1 << 27))) data.IsLoved = 0 != (rnd & (1 << 15));
            if (0 != (rnd & (1 << 26))) data.IsDangerous = 0 != (rnd & (1 << 14));
            if (0 != (rnd & (1 << 25))) data.IsEducated = 0 != (rnd & (1 << 13));

            if (0 != (rnd & (1 << 24))) data.LastSmokingDate = DateTime.Now.AddYears(-10);

            if (0 != (rnd & (1 << 23))) data.DesiredSalary = rnd / 1000m;
            if (0 != (rnd & (1 << 22))) data.ProbabilityOfSpaceFlight = rnd / (double)int.MaxValue;

            if (0 != (rnd & (1 << 21)))
            {
                data.CurrentFriendCount = rnd % 123;
                data.DesiredFriendCount = rnd % 121000;
            }

            return data;
        }