public void GetAllContacts() { List <Contact> contacts = new List <Contact>(); for (int i = 0; i < 10; i++) { Contact contact = new Contact { FirstName = "Frodo", EmailAddress = string.Format("frodo{0}@test.com", i), BusinessPhone = "666-666" }; context.Add(contact); contacts.Add(contact); } context.SaveChanges(); this.itemsAdded.AddRange(contacts); var readContacts = context.GetAll <Contact>(); Assert.AreEqual(10 + InitialItemCount, readContacts.Count()); readContacts = readContacts.Where(c => string.IsNullOrEmpty(c.FirstName) == false && c.FirstName.Equals("Frodo")).ToList(); Assert.AreEqual(10, readContacts.Count()); Assert.IsFalse(readContacts.Any(i => string.IsNullOrEmpty(i.Id))); Assert.IsTrue(readContacts.All(c => c.BusinessPhone.Equals("666-666"))); Assert.IsTrue(readContacts.All(c => c.FirstName.Equals("Frodo"))); }
public static void ClassInitialize(TestContext testContext) { User = ConfigurationManager.AppSettings[UserName]; Passwrd = ConfigurationManager.AppSettings[Password]; Company = ConfigurationManager.AppSettings[CompanyId]; var context = new EloquaContext(User, Passwrd, Company); InitialItemCount = context.GetAll <Contact>().Count(); }