コード例 #1
0
        public void ShouldGetElementByValidIndex(int[] arr, int index, int value)
        {
            TwoWayList <int> list = new TwoWayList <int>(arr);
            var expectedValue     = list.GetElementByIndex(index);

            Assert.Equal(expectedValue, value);
        }
コード例 #2
0
        public void ShouldGetElementByUsingIndexing(int[] input, int index, int value)
        {
            TwoWayList <int> list = new TwoWayList <int>(input);
            var expectedValue     = list[index];

            Assert.Equal(expectedValue, value);
        }
コード例 #3
0
        public void ListShouldBeConvertedToArray(int[] input)
        {
            TwoWayList <int> list = new TwoWayList <int>(input);
            var array             = list.ConvertToArray();

            Assert.Equal(input, array);
        }
コード例 #4
0
        public void ShouldSetElementByUsingIndexing(int[] input, int index, int value, int[] expected)
        {
            TwoWayList <int> list = new TwoWayList <int>(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)
        {
            TwoWayList <int> list = new TwoWayList <int>(input);

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

            Assert.Equal(expected, array);
        }
コード例 #6
0
        public void ShouldRemoveElementAtList(int[] input, int value, int[] expected)
        {
            TwoWayList <int> list = new TwoWayList <int>(input);

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

            Assert.Equal(expected, array);
        }
コード例 #7
0
        public void ListShouldBeSorted(int[] input, int[] expected)
        {
            TwoWayList <int> list = new TwoWayList <int>(input);

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

            Assert.Equal(expected, array);
        }
コード例 #8
0
            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);
                }
            }
コード例 #9
0
 public void Reset()
 {
     _current = null;
 }
コード例 #10
0
 public TwoWayListEnumerator(TwoWayList <TValue> .TwoWayListNode <TValue> head)
 {
     _head = head;
 }