Exemplo n.º 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 LookupDefaultEnumerable <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.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                emptyOrdered.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                groupByDefault.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                groupBySpecific.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                lookupDefault.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                lookupSpecific.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                range.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                repeat.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                reverseRange.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                oneItemDefault.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                oneItemSpecific.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                oneItemDefaultOrdered.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }

            try
            {
                oneItemSpecificOrdered.Cast <object>();
                Assert.Fail();
            }
            catch (ArgumentException exc)
            {
                Assert.AreEqual("source", exc.ParamName);
            }
        }