Exemple #1
0
        internal static void AssertDeferredThrowsExceptionOnIteration <T>(Func <IEnumerable <int>, IEnumerable <T> > deferredFunction)
        {
            ThrowingEnumerable source = new ThrowingEnumerable();
            var result = deferredFunction(source);

            using (var iterator = result.GetEnumerator())
            {
                Assert.Throws <InvalidOperationException>(() => iterator.MoveNext());
            }
        }
 public void ExecutionIsDeferred()
 {
     ThrowingEnumerable.AssertDeferredThrowsExceptionOnIteration(src => src.Where(x => x > 0));
 }
Exemple #3
0
 public void ExecutionIsDeferred()
 {
     ThrowingEnumerable.AssertDeferredThrowsExceptionOnIteration(src => src.Select(x => x.ToString()));
 }