Пример #1
0
        public void ContactsTest()
        {
            // first create contact
            Contact contact = new Contact("Rajesh", "Rolen", "Microlen Inc", "*****@*****.**", "delhi", "delhi", "India",
                                          new Contact.PhoneType()
            {
                cc = "7", ext = "", phone = "9764584199"
            });
            string id = target.CreateContact(contact);

            // get contact by id and check
            Contact contactResult = target.GetContact(id);

            compareContacts(contact, contactResult);

            // update contact
            contact.FirstName = "Vlad";
            target.UpdateContact(id, contact);

            // get it again and check it was pdated
            contactResult = target.GetContact(id);
            compareContacts(contact, contactResult);

            // now delete
            target.DeleteContact(id);

            // check that it is deleted
            try
            {
                contactResult = target.GetContact(id);
                Assert.Fail("Call to GetContact should be failed");
            }
            catch (Exception ex)
            {
                // expected exception!
            }
        }