Пример #1
0
        public void ShouldGetElementByValidIndex(int[] arr, int index, int value)
        {
            OneWayList list          = new OneWayList(arr);
            var        expectedValue = list.GetElementByIndex(index);

            Assert.Equal(expectedValue, value);
        }
Пример #2
0
        public void ListShouldBeConvertedToArray(int[] input)
        {
            OneWayList list  = new OneWayList(input);
            var        array = list.ConvertToArray();

            Assert.Equal(input, array);
        }
Пример #3
0
        public void ListShouldBeReversed(int[] input, int[] expected)
        {
            OneWayList list = new OneWayList(input);

            list.Reverse();
            var array = list.ToArray();

            Assert.Equal(expected, array);
        }
Пример #4
0
        public void ShouldSetElementByUsingIndexing(int [] input, int index, int value, int [] expected)
        {
            OneWayList list = new OneWayList(input);

            list[index] = value;
            var array = list.ToArray();

            Assert.Equal(expected, array);
        }
Пример #5
0
        public void ShouldAddElementAtListAtSomePosition(int[] input, int index, int value, int[] expected)
        {
            OneWayList list = new OneWayList(input);

            list.AddAt(value, index);
            var array = list.ToArray();

            Assert.Equal(expected, array);
        }
Пример #6
0
        public void ShouldRemoveElementAtList(int[] input, int value, int[] expected)
        {
            OneWayList list = new OneWayList(input);

            list.Remove(value);
            var array = list.ToArray();

            Assert.Equal(expected, array);
        }
        public void ShouldRemoveElementAtListAtSomePosition(int[] input, int index, int[] expected)
        {
            OneWayList <int> list = new OneWayList <int>(input);

            list.RemoveAt(index);
            var array = list.ToArray();

            Assert.Equal(expected, array);
        }
        public void ListShouldBeSorted(int[] input, int[] expected)
        {
            OneWayList <int> list = new OneWayList <int>(input);

            list.Sort();
            var array = list.ToArray();

            Assert.Equal(expected, array);
        }
            public bool MoveNext()
            {
                if (_current == null)
                {
                    if (_head == null)
                    {
                        return(false);
                    }

                    _current = _head;
                    return(true);
                }
                else
                {
                    if (_current.Next == null)
                    {
                        return(false);
                    }

                    _current = _current.Next;
                    return(true);
                }
            }
 public void Reset()
 {
     _current = null;
 }
 public OneWayListEnumerator(OneWayList <TValue> .OneWayListNode <TValue> head)
 {
     _head = head;
 }