示例#1
0
        public void TestAddToList()
        {
            AVObject obj = new AVObject("Corgi");

            obj.AddToList("emptyList", "gogo");
            obj["existingList"] = new List <string>()
            {
                "rich"
            };

            Assert.True(obj.ContainsKey("emptyList"));
            Assert.AreEqual(1, obj.Get <List <object> >("emptyList").Count);

            obj.AddToList("existingList", "gogo");
            Assert.True(obj.ContainsKey("existingList"));
            Assert.AreEqual(2, obj.Get <List <object> >("existingList").Count);

            obj.AddToList("existingList", 1);
            Assert.AreEqual(3, obj.Get <List <object> >("existingList").Count);

            obj.AddRangeToList("newRange", new List <string>()
            {
                "anti", "mage"
            });
            Assert.AreEqual(2, obj.Get <List <object> >("newRange").Count);
        }
        public void TestAddToList()
        {
            AVObject obj = new AVObject("Corgi");
            obj.AddToList("emptyList", "gogo");
            obj["existingList"] = new List<string>() { "rich" };

            Assert.True(obj.ContainsKey("emptyList"));
            Assert.AreEqual(1, obj.Get<List<object>>("emptyList").Count);

            obj.AddToList("existingList", "gogo");
            Assert.True(obj.ContainsKey("existingList"));
            Assert.AreEqual(2, obj.Get<List<object>>("existingList").Count);

            obj.AddToList("existingList", 1);
            Assert.AreEqual(3, obj.Get<List<object>>("existingList").Count);

            obj.AddRangeToList("newRange", new List<string>() { "anti", "mage" });
            Assert.AreEqual(2, obj.Get<List<object>>("newRange").Count);
        }