Example #1
0
        public void AddItemsToNullPropertyTest()
        {
            APObject obj = new APObject("object");

            obj.AddItems("field1", 5, 6);
            Assert.IsTrue(obj.GetList <string>("field1").Count() == 2);
        }
Example #2
0
        public void ItemAddTestWithoutDuplication()
        {
            APObject obj = new APObject("object");

            obj.SetList <int>("field1", new[] { 1, 2, 3, 4, 5, 6 });
            var field1 = obj.GetList <int>("field1");

            Assert.IsTrue(field1.Count() == 6);
            obj.AddItems("field1", false, 5, 6);
            field1 = obj.GetList <int>("field1");
            Assert.IsTrue(field1.Count() == 6);
        }
Example #3
0
        public void InvalidAddItemsTest()
        {
            var obj = new APObject("object");

            obj["age"] = 10;
            try
            {
                obj.AddItems("age", 2, 3);
                Assert.Fail("Add item to integer property should have failed.");
            }
            catch (ArgumentException)
            {
            }
        }
Example #4
0
        public void ItemAddTest()
        {
            APObject obj = new APObject("object");

            obj.SetList <int>("field1", new[] { 1, 2, 3, 4, 5, 6 });
            var field1 = obj.GetList <int>("field1");

            Assert.IsFalse(field1.Contains(10));
            Assert.IsFalse(field1.Contains(11));
            obj.AddItems("field1", 10, 11);
            field1 = obj.GetList <int>("field1");
            Assert.IsTrue(field1.Contains(10));
            Assert.IsTrue(field1.Contains(11));
        }