public void NotThrowExceptionWhenIsEmpty() { // throw Exception on 5th element IEnumerable <int> source = new ThrowExceptionEnumerable <int>(0, 1, 2, 3); bool isEmpty = source.IsEmpty(); }
public void NotThrowExceptionUntilIterateIt1() { IEnumerable <IEnumerable <int> > source = new ThrowExceptionEnumerable <IEnumerable <int> >(new[] { 0, 1, 2 }); foreach (int e in source.Flatten().Take(3)) { } }
public void NotThrowExceptionUntilIterateIt0() { IEnumerable <IEnumerable <int> > source = new ThrowExceptionEnumerable <IEnumerable <int> >(); foreach (int e in source.Flatten().Take(0)) { } }
public void NotThrowExceptionImpl() { IEnumerable <IReadOnlyList <int> > actual = new ThrowExceptionEnumerable <int>(0, 1, 2, 3, 4).Buffer(2).Take(2); foreach (IReadOnlyList <int> e in actual) { } }
public void ThrowExceptionSecondLonger() { IEnumerable <int> first = new[] { 0, 1, 2, 3 }; IEnumerable <string> second = new ThrowExceptionEnumerable <string>("a", "b", "c", "d", "e"); foreach ((int fst, string snd) in first.Zip(second)) { } }
public void ThrowExceptionFirstLonger() { IEnumerable <int> first = new ThrowExceptionEnumerable <int>(0, 1, 2, 3); IEnumerable <string> second = new[] { "a", "b", "c" }; foreach ((int fst, string snd) in first.Zip(second)) { } }
public void ThrowExceptionWhenIsEmpty() { // throw Exception on 1st element IEnumerable <int> source = new ThrowExceptionEnumerable <int>(); Assert.Throws <Exception>(() => { bool isEmpty = source.IsEmpty(); }); }
public void ThrowExceptionWhenGetEnumeratorExpected1() { IEnumerable <IEnumerable <int> > source = new ThrowExceptionEnumerable <IEnumerable <int> >(new[] { 0, 1, 2 }); Assert.Throws <Exception>(() => { foreach (int e in source.Flatten()) { } }); }
public void ThrowExceptionOverlap() { IEnumerable <IReadOnlyList <int> > actual = new ThrowExceptionEnumerable <int>(0, 1, 2, 3, 4).Buffer(2, 3); Assert.Throws <Exception>(() => { foreach (IReadOnlyList <int> e in actual) { } }); }
public void ThrowExceptionSecondShorter() { IEnumerable <int> first = new[] { 0, 1, 2, 3 }; IEnumerable <string> second = new ThrowExceptionEnumerable <string>("a", "b", "c"); Assert.Throws <Exception>(() => { foreach ((int fst, string snd) in first.Zip(second)) { } }); }
public void ThrowExceptionFirstShorter() { IEnumerable <int> first = new ThrowExceptionEnumerable <int>(0, 1, 2, 3); IEnumerable <string> second = new[] { "a", "b", "c", "d", "e" }; Assert.Throws <Exception>(() => { foreach ((int fst, string snd) in first.Zip(second)) { } }); }