Exemplo n.º 1
0
        public void AddAtIndex_WhenValuePassed_AddThisValueOnTheGivenIndex(int value, int index, int[] doubleLinkedList, int[] expectedDoubleLinkedList)
        {
            DoubleLinkedList actual   = DoubleLinkedList.CreateDoubleLinkedList(doubleLinkedList);
            DoubleLinkedList expected = DoubleLinkedList.CreateDoubleLinkedList(expectedDoubleLinkedList);

            actual.AddAtIndex(value, index);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void AddAtIndex_WhenIndexOutOfRange_IndexOutOfRangeException(int[] inputArray, int value, int index)
        {
            DoubleLinkedList actual = new DoubleLinkedList(inputArray);

            try
            {
                actual.AddAtIndex(value, index);
            }
            catch
            {
                Assert.Pass();
            }
            Assert.Fail();
        }
Exemplo n.º 3
0
        public void AddAtIndex_WhenIndexIsLessThanZeroOrBiggerOrEqualsArrayLength_ThrowIndexOutOfRangeException(int value, int index, int[] doubleLinkedList)
        {
            DoubleLinkedList list = DoubleLinkedList.CreateDoubleLinkedList(doubleLinkedList);

            Assert.Throws <IndexOutOfRangeException>(() => { list.AddAtIndex(value, index); });
        }