public void RemoveAtTest() { var count = _list1.Count; _list1.RemoveAt(0); Assert.AreEqual(count - 1, _list1.Count); Assert.AreEqual(50, _list1[0]); }
public void VersionCheck_RemoveAt() { var list = new HashList <int> { 5 }; IEnumerator enumerator = list.GetEnumerator(); list.RemoveAt(0); try { enumerator.MoveNext(); Assert.Fail("#1"); } catch (InvalidOperationException) { } try { enumerator.Reset(); Assert.Fail("#2"); } catch (InvalidOperationException) { } enumerator = list.GetEnumerator(); enumerator.MoveNext(); }
public void RemoveAt_Existing_Removes(int index) { var items = new List <Dummy> { new Dummy(), new Dummy(), new Dummy(), new Dummy(), new Dummy() }; var expected = items.ElementAt(index); hashList.AddRange(items); hashList.RemoveAt(index); Assert.AreNotEqual(expected, hashList[index]); }
/// <summary> /// Removes object from the display list. /// </summary> /// <param name="depth">The depth of object to remove.</param> public bool RemoveObject(ushort depth) { int n = _displayList.Count; for (int i = 0; i < n; ++i) { var obj = _displayList[i]; if (obj.Depth == depth) { obj.Depth = 0; _displayList.RemoveAt(i); Tags.Add(new SwfTagRemoveObject2(depth)); return(true); } } return(false); }