Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        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();
            }
        }
Esempio n. 3
0
        public void getAllPeople()
        {
            try
            {
                DatabaseUtil.initializeDatabase();

                IPhoneBook           phoneBook = new PhoneBook();
                IEnumerable <Person> people    = phoneBook.getAllPeople();

                Assert.AreEqual(2, people.Count());
            }
            finally
            {
                DatabaseUtil.CleanUp();
            }
        }
Esempio n. 4
0
        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();
            }
        }
Esempio n. 5
0
        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();
            }
        }
Esempio n. 6
0
 public void Dispose()
 {
     DatabaseUtil.CleanUp();
 }