コード例 #1
0
    public void TestAddUniqueToList() {
      ParseObject obj = new ParseObject("Corgi");
      obj.AddUniqueToList("emptyList", "gogo");
      obj["existingList"] = new List<string>() { "gogo" };

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

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

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

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