Esempio n. 1
0
        public void ReverseIndexIterator_HasMore_HashSet_IsNull_IsFalse_ExpectFalse()
        {
            //---------------------------Arrange--------------------------
            var hashSet = new HashSet <int>();

            hashSet.Add(1);
            hashSet.Add(2);
            hashSet.Add(3);
            var indexList = new IndexList(hashSet, 0)
            {
                MinValue = 1, MaxValue = 4
            };

            var reverseIndexIterator = new ReverseIndexIterator(hashSet, 2)
            {
                IndexList = indexList
            };
            //---------------------------Act------------------------------
            var fetchNextIndex = reverseIndexIterator.HasMore();

            //---------------------------Assert---------------------------
            Assert.IsTrue(reverseIndexIterator.IsEmpty);
            Assert.AreEqual(1, reverseIndexIterator.IndexList.Count());
            Assert.IsFalse(fetchNextIndex);
            Assert.AreEqual(1, reverseIndexIterator.IndexList.Count());
            Assert.AreEqual(4, reverseIndexIterator.MaxIndex());
            Assert.IsFalse(reverseIndexIterator.HasMore());
        }
Esempio n. 2
0
        public void ReverseIndexIterator_IndexList_AreEqual_ExpectTrue()
        {
            //---------------------------Arrange--------------------------
            var hashSet   = new HashSet <int>();
            var indexList = new IndexList(new HashSet <int>(), 0)
            {
                MinValue = 1, MaxValue = 4
            };

            var reverseIndexIterator = new ReverseIndexIterator(hashSet, 2)
            {
                IndexList = indexList
            };
            //---------------------------Act------------------------------
            var fetchNextIndex = reverseIndexIterator.FetchNextIndex();

            //---------------------------Assert---------------------------
            Assert.IsFalse(reverseIndexIterator.IsEmpty);
            Assert.AreEqual(4, reverseIndexIterator.IndexList.Count());
            Assert.AreEqual(1, fetchNextIndex);
            Assert.AreEqual(4, reverseIndexIterator.IndexList.Count());
            Assert.AreEqual(4, reverseIndexIterator.MaxIndex());
            Assert.IsFalse(reverseIndexIterator.HasMore());
        }