Пример #1
0
		public void RemoveAt()
		{
			LinkedList ll = new LinkedList();
			ll.Add("item1");
			ll.Add("item2");
			ll.Add("item3");
			ll.RemoveAt(1);
			Assert.IsTrue(ll.Count == 2, "Expected 2 items not " + ll.Count);
			Assert.IsTrue(ll[0].Equals("item1"), "Expected first element to be \"item1\" not " + ll[0]);
			Assert.IsTrue(ll[1].Equals("item3"), "Expected second element to be \"item3\" not " + ll[1]);
		}
Пример #2
0
        public void RemoveAt()
        {
            LinkedList ll = new LinkedList();

            ll.Add("item1");
            ll.Add("item2");
            ll.Add("item3");
            ll.RemoveAt(1);
            Assert.IsTrue(ll.Count == 2, "Expected 2 items not " + ll.Count);
            Assert.IsTrue(ll[0].Equals("item1"), "Expected first element to be \"item1\" not " + ll[0]);
            Assert.IsTrue(ll[1].Equals("item3"), "Expected second element to be \"item3\" not " + ll[1]);
        }
Пример #3
0
        public void EnumeratorModification()
        {
            LinkedList ll = new LinkedList();

            ll.Add("item1");
            ll.Add("item2");
            ll.Add("item3");
            IEnumerator ienum = ll.GetEnumerator();

            Assert.IsTrue(ienum.MoveNext());
            ll.RemoveAt(0);
            Assert.Throws <InvalidOperationException>(() => ienum.MoveNext());
        }
Пример #4
0
        public void EnumeratorModification()
        {
            LinkedList ll = new LinkedList();

            ll.Add("item1");
            ll.Add("item2");
            ll.Add("item3");
            IEnumerator ienum = ll.GetEnumerator();

            Assert.IsTrue(ienum.MoveNext());
            ll.RemoveAt(0);
            ienum.MoveNext();
            Assert.Fail("Expected enumerator to fail with InvalidOperationException");
        }
Пример #5
0
		public void RemoveAtOnEmptyLinkedList()
		{
			LinkedList ll = new LinkedList();
			Assert.Throws<ArgumentOutOfRangeException>(() => ll.RemoveAt(0));
		}
Пример #6
0
		public void EnumeratorModification()
		{
			LinkedList ll = new LinkedList();
			ll.Add("item1");
			ll.Add("item2");
			ll.Add("item3");
			IEnumerator ienum = ll.GetEnumerator();
			Assert.IsTrue(ienum.MoveNext());
			ll.RemoveAt(0);
            Assert.Throws<InvalidOperationException>(() => ienum.MoveNext());
		}
Пример #7
0
        public void RemoveAtOnEmptyLinkedList()
        {
            LinkedList ll = new LinkedList();

            ll.RemoveAt(0);
        }
Пример #8
0
        public void RemoveAtOnEmptyLinkedList()
        {
            LinkedList ll = new LinkedList();

            Assert.Throws <ArgumentOutOfRangeException>(() => ll.RemoveAt(0));
        }
Пример #9
0
		public void RemoveAtOnEmptyLinkedList()
		{
			LinkedList ll = new LinkedList();
			ll.RemoveAt(0);
		}
Пример #10
0
		public void EnumeratorModification()
		{
			LinkedList ll = new LinkedList();
			ll.Add("item1");
			ll.Add("item2");
			ll.Add("item3");
			IEnumerator ienum = ll.GetEnumerator();
			Assert.IsTrue(ienum.MoveNext());
			ll.RemoveAt(0);
			ienum.MoveNext();
			Assert.Fail("Expected enumerator to fail with InvalidOperationException");
		}