

insightly-api
@ 10
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 } } |