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
50
51
52
53
54
55
56
57
58
59
´╗┐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 details from insightly.
    /// </summary>
    [TestClass]
    public class DeleteTests
    {
        #region Contacts

        /// <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);
        }

        #endregion Contacts

        #region Organisations



        #endregion Organisations
    }
}

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

Diff revisions: vs.
Revision Author Commited Message
10 Diff Diff HadleyHope picture HadleyHope Tue 24 Sep, 2013 12:06:30 +0000

Added basic organisation functionality, at the moment cannot link organisation to contact.

4 HadleyHope picture HadleyHope Fri 20 Sep, 2013 15:08:23 +0000

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