Пример #1
0
        public void SeqIteratorMovedToEmptyHasNoCurrent()
        {
            Cons          c = new Cons(1, new Cons(2, null));
            SeqEnumerator s = new SeqEnumerator(c);

            s.MoveNext();
            s.MoveNext();
            s.MoveNext();
            object o = s.Current;
        }
Пример #2
0
        public void SeqIteratorIterates()
        {
            Cons          c = new Cons(1, new Cons(2, null));
            SeqEnumerator s = new SeqEnumerator(c);

            Expect(s.MoveNext());
            Expect(s.Current, EqualTo(1));
            Expect(s.MoveNext());
            Expect(s.Current, EqualTo(2));
            Expect(s.Current, EqualTo(2));
            Expect(s.MoveNext(), False);
        }
Пример #3
0
        public void SeqIteratorIterates()
        {
            Cons          c = new Cons(1, new Cons(2, null));
            SeqEnumerator s = new SeqEnumerator(c);

            Expect(s.MoveNext());
            Expect(s.Current).To.Equal(1);
            Expect(s.MoveNext());
            Expect(s.Current).To.Equal(2);
            Expect(s.Current).To.Equal(2);
            Expect(s.MoveNext()).To.Be.False();
        }
Пример #4
0
        public void SeqIteratorResetAtBeginningWorks()
        {
            Cons          c = new Cons(1, new Cons(2, null));
            SeqEnumerator s = new SeqEnumerator(c);

            s.Reset();

            Expect(s.MoveNext());
            Expect(s.Current, EqualTo(1));
            Expect(s.MoveNext());
            Expect(s.Current, EqualTo(2));
            Expect(s.Current, EqualTo(2));
            Expect(s.MoveNext(), False);
        }
Пример #5
0
        public void SeqIteratorMovedToEmptyHasNoCurrent()
        {
            Cons          c = new Cons(1, new Cons(2, null));
            SeqEnumerator s = new SeqEnumerator(c);

            s.MoveNext();
            s.MoveNext();
            s.MoveNext();

#pragma warning disable 219
            // Have to assign to access
            object o = s.Current;
#pragma warning restore 219
        }
Пример #6
0
        public void SeqIteratorResetAtBeginningWorks()
        {
            Cons          c = new Cons(1, new Cons(2, null));
            SeqEnumerator s = new SeqEnumerator(c);

            s.Reset();

            Expect(s.MoveNext());
            Expect(s.Current).To.Equal(1);
            Expect(s.MoveNext());
            Expect(s.Current).To.Equal(2);
            Expect(s.Current).To.Equal(2);
            Expect(s.MoveNext()).To.Be.False();
        }
Пример #7
0
        public void SeqIteratorOnEmptySeqGoesNowhere()
        {
            SeqEnumerator s = new SeqEnumerator(null);

            Expect(s.MoveNext(), False);
        }