コード例 #1
0
        public void GetEnumeratorT_IfTheSkiplistIsEmpty_ShouldReturnNothing
            (Skiplist <int> sut)
        {
            // Fixture setup

            // Exercise system
            var result = sut.GetEnumerator().MoveNext();

            // Verify outcome
            Assert.False(result);

            // Teardown
        }
コード例 #2
0
        public void GetEnumerator_OnANonemptySkiplist_ShouldReturnAllKeys
            (Skiplist <int> sut, List <int> keys)
        {
            // Fixture setup
            var expectedResult = keys.OrderBy(x => x).ToList();

            // Exercise system
            var result = sut.GetEnumerator();

            // Verify outcome
            var i = 0;

            while (result.MoveNext())
            {
                Assert.Equal(expectedResult[i], result.Current);
                i++;
            }
            Assert.Equal(i, keys.Count);
            Assert.False(result.MoveNext());

            // Teardown
        }