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; }
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); }
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(); }
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); }
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 }
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(); }
public void SeqIteratorOnEmptySeqGoesNowhere() { SeqEnumerator s = new SeqEnumerator(null); Expect(s.MoveNext(), False); }