public void TestIntegrationQueryTasks()
        {
            var inputTaskId = QueryTestTaskId;
            var inputApiKey = ApiKey;

            using (var unit = new CloseIoDotNetContext(inputApiKey))
            {
                var result = unit.Query <Task>(inputTaskId);
                Assert.IsNotNull(result);
                Assert.AreEqual(inputTaskId, result.Id);

                Assert.AreEqual(new DateTime(2016, 5, 22, 18, 12, 43, DateTimeKind.Utc).AddMilliseconds(570).ToUniversalTime(), result.DateUpdated.Value.ToUniversalTime());
                Assert.AreEqual("Follow up", result.Text);
                Assert.AreEqual(null, result.ObjectType);
                Assert.AreEqual(null, result.ContactId);
                Assert.AreEqual("user_K1WHnUaeXo6Kh5HbHkLTk7jG00VXmpqJzVtwrCpPTOP", result.CreatedBy);
                Assert.AreEqual("Jim Jones", result.LeadName);
                Assert.AreEqual(null, result.ContactName);
                Assert.AreEqual(null, result.ObjectId);
                Assert.AreEqual("Customer Support", result.UpdatedByName);
                Assert.AreEqual("Customer Support", result.CreatedByName);
                Assert.AreEqual(false, result.IsDateless);
                Assert.AreEqual(new DateTime(2016, 5, 22, 16, 30, 0, DateTimeKind.Utc).ToUniversalTime(), result.DueDate.Value.ToUniversalTime());
                Assert.AreEqual("lead", result.Type);
                Assert.AreEqual("user_K1WHnUaeXo6Kh5HbHkLTk7jG00VXmpqJzVtwrCpPTOP", result.UpdatedBy);
                Assert.AreEqual("orga_9A2oIFReE6EbRh2NDYoz9cFiFp7ephrSlazMpQNwjxS", result.OrganizationId);
                Assert.AreEqual("Customer Support", result.AssignedToName);
                Assert.AreEqual(new DateTime(2016, 5, 22, 16, 30, 0, DateTimeKind.Utc).ToUniversalTime(), result.Date.Value.ToUniversalTime());
                Assert.AreEqual("lead_54ZcJyA95l9vbdRGHBoAN2zDAo9qVJ6gKwy9AoWxn6E", result.LeadId);
                Assert.AreEqual("user_K1WHnUaeXo6Kh5HbHkLTk7jG00VXmpqJzVtwrCpPTOP", result.AssignedTo);
                Assert.AreEqual(new DateTime(2016, 5, 22, 18, 12, 43, DateTimeKind.Utc).AddMilliseconds(570).ToUniversalTime(), result.DateCreated.Value.ToUniversalTime());
                Assert.AreEqual(false, result.IsComplete);
                Assert.AreEqual("inbox", result.View);
            }
        }
 public void TestIntegrationReadmeScanWithQueryExample()
 {
     using (var context = new CloseIoDotNetContext(ApiKey))
     {
         var fieldsToSearch = (new Lead()).EntityFields.Where(entry => entry.SerializedName.Equals("contacts"));
         var searchQuery    = "phone_number:414-326-4100";
         var result         = context.Scan <Lead>(searchQuery, fieldsToSearch).SelectMany(entry => entry.Contacts).Select(entry => entry.Name);
         Assert.IsTrue(result.Contains("Brandon Sigesmund"));
     }
 }