I have this method:
public static IEnumerable<T> Jumping<T>( this IEnumerable<T> sequence, int step)
{
if(sequence==null)
throw new ArgumentNullException();
if(step<0)
throw new ArgumentOutOfRangeException();
var s = sequence.GetEnumerator();
for (int i = 0; i <= step; i++)
{
if (!s.MoveNext())
{
s.Reset();
s.MoveNext();
}
if (i == step)
{
i = 0;
yield return s.Current;
}
}
}
The request is to create a NUnit test with an infinite sequence, how can I do it ?
Aucun commentaire:
Enregistrer un commentaire