示例#1
0
        public void GivenAnEmptyList_WhenCallAddMultipleTimes_ThenCallGetWithIndexReturnCorrectItemAndMaintainOriginalCount()
        {
            GenDLList <int> l = new GenDLList <int>();

            l.Add(1);
            l.Add(2);
            l.Add(3);
            l.Add(4);
            l.Add(5);
            Assert.Equal(5, l.Count);
            Assert.Equal(1, l.Get(0));
            Assert.Equal(2, l.Get(1));
            Assert.Equal(3, l.Get(2));
            Assert.Equal(4, l.Get(3));
            Assert.Equal(5, l.Get(4));
            Assert.Equal(5, l.Count);
        }
示例#2
0
        public void GivenAPopulatedList_WhenCallWithInvalidIndex_ThenThrowInvalidListIndexException()
        {
            GenDLList <int> l = new GenDLList <int>();

            l.Add(1);
            l.Add(2);
            l.Add(3);
            Assert.Throws <InvalidListIndexException>(() => l.Get(10));
        }
示例#3
0
        public void GivenAnEmptyList_WhenCallGet_ThenThrowEmptyListException()
        {
            GenDLList <int> l = new GenDLList <int>();

            Assert.Throws <EmptyListException>(() => l.Get());
        }