|
@@ -7,6 +7,7 @@ |
7 |
7 |
|
using TS.Insightly.API; |
8 |
8 |
|
using TS.Insightly.API.Contract; |
9 |
9 |
|
using TS.Insightly.API.Exception; |
|
10 |
+ |
using TS.Insightly.API.Interface; |
10 |
11 |
|
using TS.Insightly.API.Utility; |
11 |
12 |
|
|
12 |
13 |
|
namespace UnitTestInsightly |
|
@@ -67,7 +68,7 @@ |
67 |
68 |
|
public void GetJohnSmithForEmailAddress() |
68 |
69 |
|
{ |
69 |
70 |
|
const string contactEmail = "johnsmith@smith.net"; |
70 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
71 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
71 |
72 |
|
|
72 |
73 |
|
var contacts = api.GetContactsForEmail(contactEmail); |
73 |
74 |
|
|
|
@@ -94,7 +95,7 @@ |
94 |
95 |
|
public void GetForNonExistentEmailAddress() |
95 |
96 |
|
{ |
96 |
97 |
|
const string contactEmail = "abcde@123.net"; |
97 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
98 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
98 |
99 |
|
|
99 |
100 |
|
var contacts = api.GetContactsForEmail(contactEmail); |
100 |
101 |
|
|
|
@@ -108,7 +109,7 @@ |
108 |
109 |
|
[TestMethod] |
109 |
110 |
|
public void GetPostalAddressForJohnSmith() |
110 |
111 |
|
{ |
111 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
112 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
112 |
113 |
|
|
113 |
114 |
|
var contact = api.GetContact(JohnSmithContactId); |
114 |
115 |
|
|
|
@@ -129,7 +130,7 @@ |
129 |
130 |
|
[TestMethod] |
130 |
131 |
|
public void GetCustomField1ForJohnSmith() |
131 |
132 |
|
{ |
132 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
133 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
133 |
134 |
|
|
134 |
135 |
|
var contact = api.GetContact(JohnSmithContactId); |
135 |
136 |
|
|
|
@@ -148,7 +149,7 @@ |
148 |
149 |
|
public void AddBasicContactRecord() |
149 |
150 |
|
{ |
150 |
151 |
|
Contact addedContact = null; |
151 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
152 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
152 |
153 |
|
|
153 |
154 |
|
try |
154 |
155 |
|
{ |
|
@@ -177,7 +178,7 @@ |
177 |
178 |
|
public void AddContactWithEmailAddress() |
178 |
179 |
|
{ |
179 |
180 |
|
Contact addedContact = null; |
180 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
181 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
181 |
182 |
|
|
182 |
183 |
|
try |
183 |
184 |
|
{ |
|
@@ -216,7 +217,7 @@ |
216 |
217 |
|
public void AddContactWithEmailAndPostalAddress() |
217 |
218 |
|
{ |
218 |
219 |
|
Contact addedContact = null; |
219 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
220 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
220 |
221 |
|
|
221 |
222 |
|
try |
222 |
223 |
|
{ |
|
@@ -269,7 +270,7 @@ |
269 |
270 |
|
public void AddNewContactWithCustomField1() |
270 |
271 |
|
{ |
271 |
272 |
|
Contact addedContact = null; |
272 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
273 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
273 |
274 |
|
|
274 |
275 |
|
try |
275 |
276 |
|
{ |
|
@@ -294,7 +295,7 @@ |
294 |
295 |
|
[TestMethod] |
295 |
296 |
|
public void DoNotAddExistingContact() |
296 |
297 |
|
{ |
297 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
298 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
298 |
299 |
|
|
299 |
300 |
|
ContactInfo newInfo = new ContactInfo(); |
300 |
301 |
|
newInfo.TYPE = ContactInfo.InfoType.Email.GetDescription(); |
|
@@ -319,7 +320,7 @@ |
319 |
320 |
|
public void AddBasicContactRecordUsingExistsCheck() |
320 |
321 |
|
{ |
321 |
322 |
|
Contact addedContact = null; |
322 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
323 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
323 |
324 |
|
|
324 |
325 |
|
try |
325 |
326 |
|
{ |
|
@@ -357,7 +358,7 @@ |
357 |
358 |
|
[ExpectedException(typeof(ContactException))] |
358 |
359 |
|
public void ContactExceptionWhenInvalidAdd() |
359 |
360 |
|
{ |
360 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
361 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
361 |
362 |
|
|
362 |
363 |
|
api.AddNewContact(null); |
363 |
364 |
|
} |
|
@@ -377,7 +378,7 @@ |
377 |
378 |
|
[TestMethod] |
378 |
379 |
|
public void DeleteExistingContact() |
379 |
380 |
|
{ |
380 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
381 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
381 |
382 |
|
|
382 |
383 |
|
Contact newContact = new Contact(); |
383 |
384 |
|
newContact.SALUTATION = "Dr"; |
|
@@ -399,7 +400,7 @@ |
399 |
400 |
|
[TestMethod] |
400 |
401 |
|
public void DeleteNonExistentContact() |
401 |
402 |
|
{ |
402 |
|
- |
InsightlyAPI api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
|
403 |
+ |
IApi api = new InsightlyAPI(APIUser.PLAIN_API_KEY); |
403 |
404 |
|
|
404 |
405 |
|
bool deleteResult = api.DeleteContact(1); |
405 |
406 |
|
|
|
@@ -413,7 +414,7 @@ |
413 |
414 |
|
/// </summary> |
414 |
415 |
|
/// <param name="api">The API.</param> |
415 |
416 |
|
/// <param name="contact">The contact.</param> |
416 |
|
- |
private void DeleteContact(InsightlyAPI api, Contact contact) |
|
417 |
+ |
private void DeleteContact(IApi api, Contact contact) |
417 |
418 |
|
{ |
418 |
419 |
|
try |
419 |
420 |
|
{ |