Beispiel #1
0
        public void NullInput2()
        {
            IReadOnlyList <int> list = null;

            new Action(
                () => FastLinq.Cast <int, object>(list))
            .Should()
            .Throw <ArgumentNullException>();
        }
Beispiel #2
0
 public void Nominal()
 {
     int[] list = new[] { 1, 2, 3 };
     ListCompareTestUtil.ValidateEqual(
         Enumerable.Cast <object>(list),
         FastLinq.Cast <object>(list),
         itemNotInTheCollection: null,
         enforceWritable: false);
 }
Beispiel #3
0
        public void NullInput()
        {
            IList list = null;

            new Action(
                () => FastLinq.Cast <string>(list))
            .Should()
            .Throw <ArgumentNullException>();
        }
Beispiel #4
0
        public void CannotCast()
        {
            IList list = new[] { 1, 2, 3 };

            new Action(
                // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
                () => FastLinq.Cast <string>(list).ToArray())
            .Should()
            .Throw <InvalidCastException>();
        }
Beispiel #5
0
        public void Nominal2()
        {
            IReadOnlyList <int> list = new[] { 1, 2, 3 };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Cast <object>(list),
                FastLinq.Cast <int, object>(list),
                itemNotInTheCollection: (object)0,
                enforceWritable: false);
        }
Beispiel #6
0
        public void Array_FastLinq1()
        {
            var _ = FastLinq.Cast <object>(this.array);

            if (EnumerateAfterwards)
            {
                foreach (var __ in _)
                {
                    ;
                }
            }
        }
Beispiel #7
0
        public void List_FastLinq1()
        {
            var _ = FastLinq.Cast <object>(this.list);

            if (EnumerateAfterwards)
            {
                foreach (var __ in _)
                {
                    ;
                }
            }
        }
Beispiel #8
0
        public void Collection_FastLinq1()
        {
            var _ = FastLinq.Cast <object>((ICollection)this.list);

            if (EnumerateAfterwards)
            {
                foreach (var __ in _)
                {
                    ;
                }
            }
        }
Beispiel #9
0
        public void IList_FastLinq2()
        {
            var _ = FastLinq.Cast <int, object>(this.ilist);

            if (EnumerateAfterwards)
            {
                foreach (var __ in _)
                {
                    ;
                }
            }
        }
Beispiel #10
0
        public void Collection_FastLinq2()
        {
            var _ = FastLinq.Cast <int, object>(this.collection);

            if (EnumerateAfterwards)
            {
                foreach (var __ in _)
                {
                    ;
                }
            }
        }
Beispiel #11
0
        public void Setup()
        {
            switch (this.ItemType)
            {
            case UnderlyingItemType.Array:
                this.underlying = Enumerable.Range(0, this.SizeOfInput).Select(i => i.ToString()).ToArray();
                break;

            case UnderlyingItemType.List:
                this.underlying = Enumerable.Range(0, this.SizeOfInput).Select(i => i.ToString()).ToList();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            this.CastList = FastLinq.Cast <object>(
                this.underlying);
        }