I am Moqing my Route Parts from a
rps = new List... (3 Route Parts)
and Moqing GetEnumerator() for my Route as below
route.Setup(ro => ro.GetEnumerator()).Returns(rps.GetEnumerator());
but the Moq fails in the following code with "Sequence contains no elements" on the call to Last()
o.Route.Any(rp => rp.IsNonTowLocation &&
rp != o.Route.First() &&
rp != o.Route.Last())
Looking at First() Last() in the immediate windows I find the values change if I execute First() Last() multiple times. Its as if the MoveNext() gets called but not Reset() and the Enumerable it totally confused. Has anyone experienced this with Moq and found a solution?