You return the very same enumerator instance upon each call to GetEnumerator
. When it enumerates once, it is done, EF doesn't call its Reset
method, rather it asks for a new enumerator.
But you return the one that just has yielded all elements and yields no more.
Instead, return a function that returns the enumerator, that will return a new enumerator each time you ask for it.
q.Setup(m => m.GetEnumerator()).Returns( () => queryableData.GetEnumerator() );
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…