public void ExceptionThrownFromSecondsEnumerator() { ThrowsOnMatchEnumerable <int> second = new ThrowsOnMatchEnumerable <int>(new int[] { 1, 3, 3 }, 2); IEnumerable <int> first = new int[] { 2, 4, 6 }; Func <int, int, int> func = (x, y) => x + y; IEnumerable <int> expected = new int[] { 3, 7, 9 }; Assert.Equal(expected, first.Zip(second, func)); second = new ThrowsOnMatchEnumerable <int>(new int[] { 1, 2, 3 }, 2); var zip = first.Zip(second, func); Assert.Throws <Exception>(() => zip.ToList()); }
public void ExceptionThrownFromSecondsEnumerator() { ThrowsOnMatchEnumerable<int> second = new ThrowsOnMatchEnumerable<int>(new int[] { 1, 3, 3 }, 2); IEnumerable<int> first = new int[] { 2, 4, 6 }; Func<int, int, int> func = (x, y) => x + y; IEnumerable<int> expected = new int[] { 3, 7, 9 }; Assert.Equal(expected, first.Zip(second, func)); second = new ThrowsOnMatchEnumerable<int>(new int[] { 1, 2, 3 }, 2); var zip = first.Zip(second, func); Assert.Throws<Exception>(() => zip.ToList()); }