public async Task UpdateObjectWithNoUpdateAsyncTest()
        {
            var stopWatch = new System.Diagnostics.Stopwatch();

            // Create the object
            dynamic obj = new APObject("object");
            decimal pi  = 22.0m / 7.0m;

            obj.intfield     = 1;
            obj.decimalfield = pi;

            var saved = await ObjectHelper.CreateNewAsync(obj as APObject);

            var firstUpdateTime = saved.LastUpdatedAt;

            stopWatch.Start();

            //Dummy update, shouldn't make any api call, assuming api call takes atleast 50 ms
            await saved.SaveAsync();

            stopWatch.Stop();

            Assert.IsTrue(stopWatch.ElapsedMilliseconds < 50);
            Console.WriteLine(stopWatch.ElapsedMilliseconds);

            //Cleanup
            await APObjects.DeleteAsync(saved.Type, saved.Id);
        }
        public async Task DeleteObjectAsyncTest()
        {
            // Create the object
            var saved = await ObjectHelper.CreateNewAsync();

            // Delete the object
            await APObjects.DeleteAsync("object", saved.Id);

            // Try and get and confirm that the object is deleted.
            try
            {
                var copy = await APObjects.GetAsync("object", saved.Id);

                Assert.Fail("Operation should have faulted since the object has been deleted.");
            }
            catch (AppacitiveApiException)
            {
            }
        }
        public async Task UpdateObjectAttributeAsyncTest()
        {
            string attrToRemove = "one";
            string attrPersist  = "two";
            string attrToAdd    = "three";

            // Create the object
            dynamic obj = new APObject("object");
            decimal pi  = 22.0m / 7.0m;

            obj.intfield     = 1;
            obj.decimalfield = pi;

            //Add Attributes
            obj.SetAttribute(attrToRemove, attrToRemove);
            obj.SetAttribute(attrPersist, attrPersist);

            var saved = await ObjectHelper.CreateNewAsync(obj as APObject);

            // Get the newly created object
            var afterFirstUpdate = await APObjects.GetAsync("object", saved.Id);

            Assert.IsNotNull(afterFirstUpdate);
            Assert.IsTrue(afterFirstUpdate.Attributes.Count(tag => string.Equals(tag.Key, attrPersist, StringComparison.OrdinalIgnoreCase)) == 1);
            Assert.IsTrue(afterFirstUpdate.Attributes.Count(tag => string.Equals(tag.Key, attrToRemove, StringComparison.OrdinalIgnoreCase)) == 1);
            Assert.IsTrue(afterFirstUpdate.Attributes.Count() == 2);

            //Add/Remove Attribute
            afterFirstUpdate.RemoveAttribute(attrToRemove);
            afterFirstUpdate.SetAttribute(attrToAdd, attrToAdd);
            await afterFirstUpdate.SaveAsync();

            var afterSecondUpdate = await APObjects.GetAsync("object", saved.Id);

            Assert.IsTrue(afterSecondUpdate.Attributes.Count(tag => string.Equals(tag.Key, attrPersist, StringComparison.OrdinalIgnoreCase)) == 1);
            Assert.IsTrue(afterSecondUpdate.Attributes.Count(tag => string.Equals(tag.Key, attrToAdd, StringComparison.OrdinalIgnoreCase)) == 1);
            Assert.IsTrue(afterSecondUpdate.Attributes.Count() == 2);

            //Cleanup
            await APObjects.DeleteAsync(afterSecondUpdate.Type, afterSecondUpdate.Id);
        }