Subversion Repository Public Repository

insightly-api

Diff Revisions 15 vs 16 for /trunk/UnitTestInsightly/ContactOrganisationTests.cs

Diff revisions: vs.
  @@ -9,6 +9,27 @@
9 9 [TestClass]
10 10 public class ContactOrganisationTests
11 11 {
12 + private static IApi _api;
13 +
14 + /// <summary>
15 + /// Test class initialise.
16 + /// </summary>
17 + /// <param name="context">The context.</param>
18 + [ClassInitialize]
19 + public static void ContactTestsInitialise(TestContext context)
20 + {
21 + _api = new InsightlyAPI(APIUser.PLAIN_API_KEY);
22 + }
23 +
24 + /// <summary>
25 + /// Test class cleanup.
26 + /// </summary>
27 + [ClassCleanup]
28 + public static void ContactTestsCleanup()
29 + {
30 + _api = null;
31 + }
32 +
12 33 #region Get
13 34
14 35
  @@ -22,10 +43,9 @@
22 43 [TestMethod]
23 44 public void AddNewContactWithExistingOrganisation()
24 45 {
25 - //IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY);
26 46 //const string orgName = "Smith Enterprises";
27 47
28 - //var orgs = api.GetOrganisationsForName(orgName);
48 + //var orgs = _api.GetOrganisationsForName(orgName);
29 49
30 50 //Assert.IsTrue(orgs.Count > 0, "Failed to get organisation to link to new contact");
31 51
  @@ -47,7 +67,7 @@
47 67 //}
48 68 //finally
49 69 //{
50 - // DeleteContact(api, addedContact);
70 + // DeleteContact(addedContact);
51 71 //}
52 72 }
53 73
  @@ -66,15 +86,14 @@
66 86 /// <summary>
67 87 /// Deletes the contact.
68 88 /// </summary>
69 - /// <param name="api">The API.</param>
70 89 /// <param name="contact">The contact.</param>
71 - private void DeleteContact(IApi api, Contact contact)
90 + private void DeleteContact(Contact contact)
72 91 {
73 92 try
74 93 {
75 94 if (contact != null && contact.CONTACT_ID > 0)
76 95 {
77 - api.DeleteContact(contact.CONTACT_ID);
96 + _api.DeleteContact(contact.CONTACT_ID);
78 97 }
79 98 }
80 99 catch (Exception)