示例#1
0
        public void Malformed_Weird()
        {
            var empty                  = new EmptyEnumerable <int>();
            var emptyOrdered           = new EmptyOrderedEnumerable <int>();
            var groupByDefault         = new GroupByDefaultEnumerable <int, int, int, EmptyEnumerable <int>, EmptyEnumerator <int> >();
            var groupBySpecific        = new GroupBySpecificEnumerable <int, int, int, EmptyEnumerable <int>, EmptyEnumerator <int> >();
            var lookupDefault          = new LookupDefaultEnumerable <int, int>();
            var lookupSpecific         = new LookupSpecificEnumerable <int, int>();
            var range                  = new RangeEnumerable();
            var repeat                 = new RepeatEnumerable <int>();
            var reverseRange           = new ReverseRangeEnumerable();
            var oneItemDefault         = new OneItemDefaultEnumerable <int>();
            var oneItemSpecific        = new OneItemSpecificEnumerable <int>();
            var oneItemDefaultOrdered  = new OneItemDefaultOrderedEnumerable <int>();
            var oneItemSpecificOrdered = new OneItemSpecificOrderedEnumerable <int>();

            try { empty.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { emptyOrdered.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { groupByDefault.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { groupBySpecific.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { lookupDefault.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { lookupSpecific.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { range.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { repeat.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { reverseRange.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { oneItemDefault.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { oneItemSpecific.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { oneItemDefaultOrdered.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            try { oneItemSpecificOrdered.Reverse(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
        }
示例#2
0
        public void Malformed_Weird()
        {
            var groupByDefault         = new GroupByDefaultEnumerable <int, int, int, EmptyEnumerable <int>, EmptyEnumerator <int> >();
            var groupBySpecific        = new GroupBySpecificEnumerable <int, int, int, EmptyEnumerable <int>, EmptyEnumerator <int> >();
            var lookupDefault          = new LookupDefaultEnumerable <int, int>();
            var lookupSpecific         = new LookupSpecificEnumerable <int, int>();
            var range                  = new RangeEnumerable();
            var repeat                 = new RepeatEnumerable <int>();
            var reverseRange           = new ReverseRangeEnumerable();
            var oneItemDefault         = new OneItemDefaultEnumerable <int>();
            var oneItemSpecific        = new OneItemSpecificEnumerable <int>();
            var oneItemDefaultOrdered  = new OneItemDefaultOrderedEnumerable <int>();
            var oneItemSpecificOrdered = new OneItemSpecificOrderedEnumerable <int>();

            // groupByDefault
            {
                try { groupByDefault.OrderBy(x => x.Key); Assert.Fail(); }catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupByDefault.OrderBy(x => x.Key, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupByDefault.OrderByDescending(x => x.Key); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupByDefault.OrderByDescending(x => x.Key, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // groupBySpecific
            {
                try { groupBySpecific.OrderBy(x => x.Key); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupBySpecific.OrderBy(x => x.Key, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupBySpecific.OrderByDescending(x => x.Key); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupBySpecific.OrderByDescending(x => x.Key, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // lookupDefault
            {
                try { lookupDefault.OrderBy(x => x.Key); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupDefault.OrderBy(x => x.Key, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupDefault.OrderByDescending(x => x.Key); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupDefault.OrderByDescending(x => x.Key, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // lookupSpecific
            {
                try { lookupSpecific.OrderBy(x => x.Key); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupSpecific.OrderBy(x => x.Key, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupSpecific.OrderByDescending(x => x.Key); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupSpecific.OrderByDescending(x => x.Key, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // range
            {
                try { range.OrderBy(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { range.OrderBy(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { range.OrderByDescending(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { range.OrderByDescending(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // repeat
            {
                try { repeat.OrderBy(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { repeat.OrderBy(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { repeat.OrderByDescending(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { repeat.OrderByDescending(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // reverseRange
            {
                try { reverseRange.OrderBy(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { reverseRange.OrderBy(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { reverseRange.OrderByDescending(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { reverseRange.OrderByDescending(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemDefault
            {
                try { oneItemDefault.OrderBy(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefault.OrderBy(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefault.OrderByDescending(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefault.OrderByDescending(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemSpecific
            {
                try { oneItemSpecific.OrderBy(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecific.OrderBy(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecific.OrderByDescending(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecific.OrderByDescending(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemDefaultOrdered
            {
                try { oneItemDefaultOrdered.OrderBy(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefaultOrdered.OrderBy(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefaultOrdered.OrderByDescending(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefaultOrdered.OrderByDescending(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemSpecificOrdered
            {
                try { oneItemSpecificOrdered.OrderBy(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecificOrdered.OrderBy(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecificOrdered.OrderByDescending(x => x); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecificOrdered.OrderByDescending(x => x, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }
        }
示例#3
0
        public void Malformed_Weird()
        {
            var empty                  = new EmptyEnumerable <int>();
            var emptyOrdered           = new EmptyOrderedEnumerable <int>();
            var groupByDefault         = new GroupByDefaultEnumerable <int, int, int, EmptyEnumerable <int>, EmptyEnumerator <int> >();
            var groupBySpecific        = new GroupBySpecificEnumerable <int, int, int, EmptyEnumerable <int>, EmptyEnumerator <int> >();
            var lookupDefault          = new LookupDefaultEnumerable <int, int>();
            var lookupSpecific         = new LookupSpecificEnumerable <int, int>();
            var range                  = new RangeEnumerable();
            var repeat                 = new RepeatEnumerable <int>();
            var reverseRange           = new ReverseRangeEnumerable();
            var oneItemDefault         = new OneItemDefaultEnumerable <int>();
            var oneItemSpecific        = new OneItemSpecificEnumerable <int>();
            var oneItemDefaultOrdered  = new OneItemDefaultOrderedEnumerable <int>();
            var oneItemSpecificOrdered = new OneItemSpecificOrderedEnumerable <int>();

            // empty
            {
                try { empty.Contains(1); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { empty.Contains(1, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // emptyOrdered
            {
                try { emptyOrdered.Contains(1); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { emptyOrdered.Contains(1, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // groupByDefault
            {
                try { groupByDefault.Contains(new GroupingEnumerable <int, int>()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupByDefault.Contains(new GroupingEnumerable <int, int>(), null); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // groupBySpecific
            {
                try { groupBySpecific.Contains(new GroupingEnumerable <int, int>()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupBySpecific.Contains(new GroupingEnumerable <int, int>(), null); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // lookupDefault
            {
                try { lookupDefault.Contains(new GroupingEnumerable <int, int>()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupDefault.Contains(new GroupingEnumerable <int, int>(), null); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // lookupSpecific
            {
                try { lookupSpecific.Contains(new GroupingEnumerable <int, int>()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupSpecific.Contains(new GroupingEnumerable <int, int>(), null); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // range
            {
                try { range.Contains(1); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { range.Contains(1, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // repeat
            {
                try { repeat.Contains(1); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { repeat.Contains(1, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // reverseRange
            {
                try { reverseRange.Contains(1); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { reverseRange.Contains(1, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemDefault
            {
                try { oneItemDefault.Contains(1); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefault.Contains(1, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemSpecific
            {
                try { oneItemSpecific.Contains(1); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecific.Contains(1, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemDefaultOrdered
            {
                try { oneItemDefaultOrdered.Contains(1); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefaultOrdered.Contains(1, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemSpecificOrdered
            {
                try { oneItemSpecificOrdered.Contains(1); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecificOrdered.Contains(1, new _IntComparer()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }
        }
示例#4
0
        public void Malformed_Weird()
        {
            var groupByDefault         = new GroupByDefaultEnumerable <int, int, int, EmptyEnumerable <int>, EmptyEnumerator <int> >();
            var groupBySpecific        = new GroupBySpecificEnumerable <int, int, int, EmptyEnumerable <int>, EmptyEnumerator <int> >();
            var lookupDefault          = new LookupDefaultEnumerable <int, int>();
            var lookupSpecific         = new LookupSpecificEnumerable <int, int>();
            var range                  = new RangeEnumerable();
            var repeat                 = new RepeatEnumerable <int>();
            var reverseRange           = new ReverseRangeEnumerable();
            var oneItemDefault         = new OneItemDefaultEnumerable <int>();
            var oneItemSpecific        = new OneItemSpecificEnumerable <int>();
            var oneItemDefaultOrdered  = new OneItemDefaultOrderedEnumerable <int>();
            var oneItemSpecificOrdered = new OneItemSpecificOrderedEnumerable <int>();

            // groupByDefault
            {
                try { groupByDefault.Take(0); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupByDefault.TakeWhile(x => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupByDefault.TakeWhile((x, ix) => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // groupBySpecific
            {
                try { groupBySpecific.Take(0); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupBySpecific.TakeWhile(x => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupBySpecific.TakeWhile((x, ix) => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // lookupDefault
            {
                try { lookupDefault.Take(0); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupDefault.TakeWhile(x => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupDefault.TakeWhile((x, ix) => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // lookupSpecific
            {
                try { lookupSpecific.Take(0); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupSpecific.TakeWhile(x => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupSpecific.TakeWhile((x, ix) => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // range
            {
                try { range.Take(0); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { range.TakeWhile(x => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { range.TakeWhile((x, ix) => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // repeat
            {
                try { repeat.Take(0); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { repeat.TakeWhile(x => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { repeat.TakeWhile((x, ix) => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // reverseRange
            {
                try { reverseRange.Take(0); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { reverseRange.TakeWhile(x => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { reverseRange.TakeWhile((x, ix) => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemDefault
            {
                try { oneItemDefault.Take(0); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefault.TakeWhile(x => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefault.TakeWhile((x, ix) => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemSpecific
            {
                try { oneItemSpecific.Take(0); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecific.TakeWhile(x => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecific.TakeWhile((x, ix) => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemDefaultOrdered
            {
                try { oneItemDefaultOrdered.Take(0); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefaultOrdered.TakeWhile(x => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefaultOrdered.TakeWhile((x, ix) => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemSpecificOrdered
            {
                try { oneItemSpecificOrdered.Take(0); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecificOrdered.TakeWhile(x => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecificOrdered.TakeWhile((x, ix) => true); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }
        }
示例#5
0
        public void Malformed_Weird()
        {
            var empty                  = new EmptyEnumerable <int>();
            var emptyOrdered           = new EmptyOrderedEnumerable <int>();
            var groupByDefault         = new GroupByDefaultEnumerable <int, int, int, EmptyEnumerable <int>, EmptyEnumerator <int> >();
            var groupBySpecific        = new GroupBySpecificEnumerable <int, int, int, EmptyEnumerable <int>, EmptyEnumerator <int> >();
            var lookupDefault          = new LookupDefaultEnumerable <int, int>();
            var lookupSpecific         = new LookupSpecificEnumerable <int, int>();
            var range                  = new RangeEnumerable();
            var repeat                 = new RepeatEnumerable <int>();
            var reverseRange           = new ReverseRangeEnumerable();
            var oneItemDefault         = new OneItemDefaultEnumerable <int>();
            var oneItemSpecific        = new OneItemSpecificEnumerable <int>();
            var oneItemDefaultOrdered  = new OneItemDefaultOrderedEnumerable <int>();
            var oneItemSpecificOrdered = new OneItemSpecificOrderedEnumerable <int>();

            // empty
            {
                var boxed = (BoxedEnumerable <int>)empty;
                try { boxed.ToList(); Assert.Fail(); }catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // emptyOrdered
            {
                var boxed = (BoxedEnumerable <int>)emptyOrdered;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // groupByDefault
            {
                var boxed = (BoxedEnumerable <GroupingEnumerable <int, int> >)groupByDefault;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // groupBySpecific
            {
                var boxed = (BoxedEnumerable <GroupingEnumerable <int, int> >)groupBySpecific;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // lookupDefault
            {
                var boxed = (BoxedEnumerable <GroupingEnumerable <int, int> >)lookupDefault;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // lookupDefault
            {
                var boxed = (BoxedEnumerable <GroupingEnumerable <int, int> >)lookupSpecific;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // range
            {
                var boxed = (BoxedEnumerable <int>)range;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // repeat
            {
                var boxed = (BoxedEnumerable <int>)repeat;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // reverseRange
            {
                var boxed = (BoxedEnumerable <int>)reverseRange;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemDefault
            {
                var boxed = (BoxedEnumerable <int>)oneItemDefault;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemSpecific
            {
                var boxed = (BoxedEnumerable <int>)oneItemSpecific;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemDefaultOrdered
            {
                var boxed = (BoxedEnumerable <int>)oneItemDefaultOrdered;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemSpecificOrdered
            {
                var boxed = (BoxedEnumerable <int>)oneItemSpecificOrdered;
                try { boxed.ToList(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }
        }