Esempio n. 1
0
        AppendTwoElements_GetTailOfFirstElementInTwoElementsList_ReturnsArrayWithOneElementSecondInList()
        {
            DLList <T> list          = new DLList <T>();
            T          firsElement   = this.CreateDifferentValue();
            T          secondElement = this.CreateSampleValue();

            list.Append(firsElement);
            list.Append(secondElement);

            T[] resultTail   = list.GetTail(firsElement);
            T[] expectedTail = new T[] { secondElement };

            CollectionAssert.AreEqual(expectedTail, resultTail);
        }
Esempio n. 2
0
        public void GetHeadElementFromOneElementList_ReturnsElement()
        {
            T sampleValue = this.CreateSampleValue();

            DLList <T> list = new DLList <T>();

            list.Append(sampleValue);
            T headValue = list.GetHead();

            Assert.AreEqual(sampleValue, headValue);
        }
Esempio n. 3
0
        public void GetTailOfSingleElementList_ReturnsZeroLengthArray()
        {
            DLList <T> list        = new DLList <T>();
            T          sampleValue = this.CreateSampleValue();

            list.Append(sampleValue);

            T[] tailOfList = list.GetTail(sampleValue);
            int tailLength = tailOfList.Length;

            Assert.AreEqual(0, tailLength);
        }
Esempio n. 4
0
        public void AppendValueToEmptyList_ListDontContainsDifferentValue_ReturnsFalse()
        {
            T          value = this.CreateSampleValue();
            DLList <T> list  = new DLList <T>();

            list.Append(value);

            T    differentValue         = this.CreateDifferentValue();
            bool containsDifferentValue = list.Contains(differentValue);

            Assert.IsFalse(containsDifferentValue);
        }
Esempio n. 5
0
        public void AppendValueToEmptyList_ListContainsValue_ReturnsTrue()
        {
            T valueToAdd = this.CreateSampleValue();

            DLList <T> list = new DLList <T>();

            list.Append(valueToAdd);

            T    valueToSeek  = this.CreateSampleValue();
            bool listContains = list.Contains(valueToSeek);

            Assert.IsTrue(listContains);
        }