Пример #1
0
        public void NotThrowExceptionWhenIsEmpty()
        {
            // throw Exception on 5th element
            IEnumerable <int> source = new ThrowExceptionEnumerable <int>(0, 1, 2, 3);

            bool isEmpty = source.IsEmpty();
        }
Пример #2
0
        public void NotThrowExceptionUntilIterateIt1()
        {
            IEnumerable <IEnumerable <int> > source = new ThrowExceptionEnumerable <IEnumerable <int> >(new[] { 0, 1, 2 });

            foreach (int e in source.Flatten().Take(3))
            {
            }
        }
Пример #3
0
        public void NotThrowExceptionUntilIterateIt0()
        {
            IEnumerable <IEnumerable <int> > source = new ThrowExceptionEnumerable <IEnumerable <int> >();

            foreach (int e in source.Flatten().Take(0))
            {
            }
        }
Пример #4
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)
            {
            }
        }
Пример #5
0
        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))
            {
            }
        }
Пример #6
0
        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))
            {
            }
        }
Пример #7
0
        public void ThrowExceptionWhenIsEmpty()
        {
            // throw Exception on 1st element
            IEnumerable <int> source = new ThrowExceptionEnumerable <int>();

            Assert.Throws <Exception>(() =>
            {
                bool isEmpty = source.IsEmpty();
            });
        }
Пример #8
0
        public void ThrowExceptionWhenGetEnumeratorExpected1()
        {
            IEnumerable <IEnumerable <int> > source = new ThrowExceptionEnumerable <IEnumerable <int> >(new[] { 0, 1, 2 });

            Assert.Throws <Exception>(() =>
            {
                foreach (int e in source.Flatten())
                {
                }
            });
        }
Пример #9
0
        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)
                {
                }
            });
        }
Пример #10
0
        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))
                {
                }
            });
        }
Пример #11
0
        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))
                {
                }
            });
        }