Example #1
0
        public void TestGeocodeGet()
        {
            var apObject = new APObject("object");

            apObject.Set("geofield", new Geocode(80.0m, 81.0m));
            var geo = apObject.Get <Geocode>("geofield");

            Assert.IsTrue(geo.ToString() == "80.0,81.0");
        }
Example #2
0
        public void TestGeocodeSet()
        {
            var apObject = new APObject("object");

            apObject.Set("geofield", new Geocode(80.0m, 81.0m));
            var value = apObject.Get <string>("geofield");

            Assert.IsTrue(value == "80.0,81.0");
        }
        public async Task AtomicCountersWithoutPreInitializationTest()
        {
            var obj = new APObject("object");
            await obj.SaveAsync();

            await obj.IncrementAsync("intfield", 10);

            await obj.DecrementAsync("intfield", 5);

            Assert.AreEqual(5, obj.Get <int>("intfield"));
        }
Example #4
0
        public void TryGetSetMultiValuedPropertyTest()
        {
            var apObject = new APObject("object");

            try
            {
                apObject.Set <int[]>("field1", new[] { 1, 3, 4, 5, 6 });
                Assert.Fail("Multivalue set should not be allowed on Object.Set<T>().");
            }
            catch (ArgumentException)
            {
            }

            try
            {
                var values = apObject.Get <int[]>("field1");
                Assert.Fail("Multivalue get should not be allowed on Object.Get<T>().");
            }
            catch (ArgumentException)
            {
            }
        }
 public async Task AtomicCountersWithoutPreInitializationTest()
 {
     var obj = new APObject("object");
     await obj.SaveAsync();
     await obj.IncrementAsync("intfield", 10);
     await obj.DecrementAsync("intfield", 5);
     Assert.AreEqual(5, obj.Get<int>("intfield"));
 }