Subversion Repository Public Repository

insightly-api

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TS.Insightly.API;
using TS.Insightly.API.Contract;

namespace UnitTestInsightly
{
    /// <summary>
    /// Test class for various methods to delete contact details from insightly.
    /// </summary>
    [TestClass]
    public class ContactDeleteTest
    {
        /// <summary>
        /// Test deleting a contact that is in the system.
        /// </summary>
        [TestMethod]
        public void DeleteExistingContact()
        {
            InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY);

            Contact newContact = new Contact();
            newContact.SALUTATION = "Dr";
            newContact.FIRST_NAME = "Temp";
            newContact.LAST_NAME = "Delete";

            Contact addedContact = api.AddNewContact(newContact);

            Assert.IsNotNull(addedContact, "Failed to add contact to test delete!");

            bool deleteResult = api.DeleteContact(addedContact.CONTACT_ID);

            Assert.IsTrue(deleteResult);
        }

        /// <summary>
        /// Test deleting a non existent contact.
        /// </summary>
        [TestMethod]
        public void DeleteNonExistentContact()
        {
            InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY);

            bool deleteResult = api.DeleteContact(1);

            Assert.IsFalse(deleteResult);
        }
    }
}

Commits for insightly-api/trunk/UnitTestInsightly/ContactDeleteTest.cs

Diff revisions: vs.
Revision Author Commited Message
4 HadleyHope picture HadleyHope Fri 20 Sep, 2013 15:08:23 +0000

Added code and tests to add a basic contact with email address.