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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
´╗┐using Microsoft.VisualStudio.TestTools.UnitTesting;
using TS.Insightly.API;
using TS.Insightly.API.Contract;
using TS.Insightly.API.Interface;

namespace UnitTestInsightly
{
    [TestClass]
    public class ProjectTests
    {
        private const int CRMTrainingProjectId = 884059;

        private static IApi _api;

        /// <summary>
        /// Test class initialise.
        /// </summary>
        /// <param name="context">The context.</param>
        [ClassInitialize]
        public static void ContactTestsInitialise(TestContext context)
        {
            _api = new InsightlyAPI(APIUser.PLAIN_API_KEY);
        }

        /// <summary>
        /// Test class cleanup.
        /// </summary>
        [ClassCleanup]
        public static void ContactTestsCleanup()
        {
            _api = null;
        }

        #region Get

        /// <summary>
        /// Test returns project record smith enterprises crm training for CRM project unique identifier.
        /// </summary>
        [TestMethod]
        public void GetSmithEnterprisesCRMTrainingForCRMProjectId()
        {
            var project = _api.GetProject(CRMTrainingProjectId);

            Assert.IsNotNull(project);
            Assert.IsInstanceOfType(project, typeof(Project));
            Assert.AreEqual(CRMTrainingProjectId, project.PROJECT_ID);
        }

        /// <summary>
        /// Test getting the basic project details.
        /// </summary>
        [TestMethod]
        public void GetBasicProjectDetails()
        {
            var projects = _api.GetProjects(false);

            Assert.IsTrue(projects.Count > 0);
            Assert.IsNull(projects[0].LINKS);
        }

        #endregion Get

        #region Post

        #endregion Post

        #region Put


        #endregion Put

        #region Delete

        #endregion Delete
    }
}

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

Diff revisions: vs.
Revision Author Commited Message
16 Diff Diff HadleyHope picture HadleyHope Tue 01 Oct, 2013 14:59:43 +0000

Refactored unit tests.

15 Diff Diff HadleyHope picture HadleyHope Tue 01 Oct, 2013 13:47:15 +0000

Refactored, added Ninject to load controllers for each part of the API.
InsightlyAPI class is now a true facade for the API.

14 HadleyHope picture HadleyHope Mon 30 Sep, 2013 15:36:43 +0000

Refactor unit tests.
Refactor API use get method to return REST client.