Esempio n. 1
0
        public void TestRandomContactGenerator()
        {
            var contactArray = new Contact[100];

            contactArray = RandomContactGenerator.ContactGenerator();
            Assert.AreEqual("John4", contactArray[4].FirstName);
        }
Esempio n. 2
0
 public void EnsureDatabaseCreation()
 {
     using (var context = new ContactManagerDbContext(_contextOptions))
     {
         if (context.Database.EnsureCreated())
         {
             var randomContactGenerator = new RandomContactGenerator();
             var contacts = randomContactGenerator.GenerateContacts(5000);
             context.Contacts.AddRange(contacts);
             context.SaveChanges();
         }
     }
 }
            public AddressInfo(string Country)
            {
                this.Country = Country;

                this.Telephone = RandomContactGenerator.Next(1, 9).ToString()
                                 + RandomContactGenerator.Next(1, 9).ToString()
                                 + RandomContactGenerator.Next(1, 9).ToString() + "-"
                                 + RandomContactGenerator.Next(1, 9).ToString()
                                 + RandomContactGenerator.Next(1, 9).ToString()
                                 + RandomContactGenerator.Next(1, 9).ToString()
                                 + RandomContactGenerator.Next(1, 9).ToString();

                this.Address = RandomContactGenerator.Next(1, 9).ToString()
                               + RandomContactGenerator.Next(1, 9).ToString()
                               + RandomContactGenerator.Next(1, 9).ToString()
                               + RandomContactGenerator.Next(1, 9).ToString() + " "
                               + Lastnames[RandomContactGenerator.Next(0, Lastnames.Count - 1)];

                int streettype = RandomContactGenerator.Next(1, 100);

                if (streettype < 25)
                {
                    this.Address += " Lane";
                }
                else if (streettype > 25 && streettype < 50)
                {
                    this.Address += " Drive";
                }
                else if (streettype > 50 && streettype < 75)
                {
                    this.Address += " Street";
                }
                else if (streettype > 75)
                {
                    this.Address += " Court";
                }
            }
Esempio n. 4
0
        protected override void Seed(ContactManager.Models.DataContext context)
        {
            var contacts = RandomContactGenerator.ContactGenerator();

            context.Contacts.AddOrUpdate(m => m.FirstName, contacts);
        }