public void TestRandomContactGenerator() { var contactArray = new Contact[100]; contactArray = RandomContactGenerator.ContactGenerator(); Assert.AreEqual("John4", contactArray[4].FirstName); }
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"; } }
protected override void Seed(ContactManager.Models.DataContext context) { var contacts = RandomContactGenerator.ContactGenerator(); context.Contacts.AddOrUpdate(m => m.FirstName, contacts); }