Пример #1
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.DefaultIfEmpty(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupByDefault.DefaultIfEmpty(groupByDefault.First()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // groupBySpecific
            {
                try { groupBySpecific.DefaultIfEmpty(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { groupBySpecific.DefaultIfEmpty(groupBySpecific.First()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // lookupDefault
            {
                try { lookupDefault.DefaultIfEmpty(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupDefault.DefaultIfEmpty(lookupDefault.First()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // lookupSpecific
            {
                try { lookupSpecific.DefaultIfEmpty(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { lookupSpecific.DefaultIfEmpty(lookupDefault.First()); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // range
            {
                try { range.DefaultIfEmpty(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { range.DefaultIfEmpty(4); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // repeat
            {
                try { repeat.DefaultIfEmpty(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { repeat.DefaultIfEmpty(4); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // reverseRange
            {
                try { reverseRange.DefaultIfEmpty(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { reverseRange.DefaultIfEmpty(4); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemDefault
            {
                try { oneItemDefault.DefaultIfEmpty(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefault.DefaultIfEmpty(4); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemSpecific
            {
                try { oneItemSpecific.DefaultIfEmpty(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecific.DefaultIfEmpty(4); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemDefaultOrdered
            {
                try { oneItemDefaultOrdered.DefaultIfEmpty(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemDefaultOrdered.DefaultIfEmpty(4); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }

            // oneItemSpecificOrdered
            {
                try { oneItemSpecificOrdered.DefaultIfEmpty(); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
                try { oneItemSpecificOrdered.DefaultIfEmpty(4); Assert.Fail(); } catch (ArgumentException exc) { Assert.AreEqual("source", exc.ParamName); }
            }
        }