public void RemoveAllOccurencesOfItemTest() { APObject obj = new APObject("object"); obj.SetList <int>("field1", new[] { 1, 2, 3, 1, 2, 3 }); var removed = obj.RemoveItems("field1", 1, false); Assert.IsTrue(removed == true); var list = obj.GetList <int>("field1").ToList(); Assert.IsTrue(list.Count == 4); Assert.IsTrue(list.Count(x => x == 1) == 0); }
public void InvalidRemoveItemsTest() { var obj = new APObject("object"); obj["age"] = 10; try { obj.RemoveItems("age", 2); Assert.Fail("Add item to integer property should have failed."); } catch (ArgumentException) { } }