public void findPerson() { try { DatabaseUtil.initializeDatabase(); Person objPerson = new Person() { name = "Cynthia Smith", phoneNumber = "(824) 128-8758", address = "875 Main St, Ann Arbor, MI" }; phonebook.AddPerson(objPerson); var person = phonebook.findPerson("Cynthia", "Smith"); Assert.IsNotNull(person); Assert.IsNotNull(person.name); } catch (Exception ex) { Assert.Fail(); } finally { DatabaseUtil.CleanUp(); } }
public void addPerson() { try { DatabaseUtil.initializeDatabase(); long initialNumPeople = GetNumPeopleInDatabase(); IPhoneBook phoneBook = new PhoneBook(); phoneBook.addPerson( new Person() { Name = "Elwood Blues", Address = "1060 West Addison, Chicago, IL", PhoneNumber = "(888) THE-BAND" }); long numPeopleAfterAdd = GetNumPeopleInDatabase(); Assert.AreEqual(initialNumPeople + 1, numPeopleAfterAdd); } finally { DatabaseUtil.CleanUp(); } }
public void getAllPeople() { try { DatabaseUtil.initializeDatabase(); IPhoneBook phoneBook = new PhoneBook(); IEnumerable <Person> people = phoneBook.getAllPeople(); Assert.AreEqual(2, people.Count()); } finally { DatabaseUtil.CleanUp(); } }
public void findPerson() { try { DatabaseUtil.initializeDatabase(); IPhoneBook phoneBook = new PhoneBook(); // "Chris Johnson" is added by the DatabaseUtil.initializeDatabase call. Assert.IsNotNull(phoneBook.findPerson("Chris Johnson")); // "Jake Blues", however, is not. Assert.IsNull(phoneBook.findPerson("Jake Blues")); } finally { DatabaseUtil.CleanUp(); } }
public void addPerson() { try { DatabaseUtil.initializeDatabase(); Person objPerson = new Person() { name = "Test Name", phoneNumber = "(248) 123-4567", address = "1234 Sand Hill Dr, Royal Oak, MI" }; phonebook.AddPerson(objPerson); } catch (Exception ex) { Assert.Fail(); } finally { DatabaseUtil.CleanUp(); } }
public void Dispose() { DatabaseUtil.CleanUp(); }