一個NUnit測試我有這樣的方法:上創建無限序列
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;
}
}
}
請求是創建具有無限序列的NUnit測試,我該怎麼辦呢?
不知道你期望從無限序列測試(序列的創建將明顯重複的東西像http://stackoverflow.com/questions/9399717/linq-statement-for-an-infinite-sequence-of-逐次半部)。我假設你知道https://en.wikipedia.org/wiki/Halting_problem ... –