public void ProjectionNull()
        {
            IReadOnlyList <int>     input      = new[] { 1, 2, 3 };
            Func <int, int, string> projection = null;

            new Action(
                () => FastLinq.Select(input, projection))
            .Should()
            .Throw <ArgumentNullException>();
        }
        public void FastLinq_SelectAField_AndEnumerate()
        {
            var _ = FastLinq.Select(this.stringList, str => str.Length);

            int i = 0;

            foreach (var item in _)
            {
                i++;
            }
        }
        public void InputNull()
        {
            IReadOnlyList <int>     input      = null;
            Func <int, int, string> projection =
                (i, _) => i.ToString();

            new Action(
                () => FastLinq.Select(input, projection))
            .Should()
            .Throw <ArgumentNullException>();
        }
Beispiel #4
0
        public void IsLazy()
        {
            bool any    = false;
            var  result = FastLinq.ToLazyList(
                // Need an IList for the Select
                FastLinq.Select(
                    new[] { 0 },
                    _ => any = true));

            Assert.IsFalse(any, "ToLazyList should be lazy");
        }
Beispiel #5
0
        public void Array_FastLinq()
        {
            var _ = FastLinq.Select(this.array, SelectMethod);

            if (this.EnumerateAfterwards)
            {
                foreach (var __ in _)
                {
                    ;
                }
            }
        }
Beispiel #6
0
        public void IList_FastLinq()
        {
            var _ = FastLinq.Select(this.ilist, SelectMethod);

            if (this.EnumerateAfterwards)
            {
                foreach (var __ in _)
                {
                    ;
                }
            }
        }
        public void InputEmpty()
        {
            IReadOnlyList <int>     input      = new int[] { };
            Func <int, int, string> projection =
                (i, _) => i.ToString();

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Select(input, projection),
                FastLinq.Select(input, projection),
                itemNotInTheCollection: "",
                enforceWritable: false);
        }
        public void SelectProducesNulls()
        {
            IReadOnlyList <int>     input      = new[] { 1, 2, 3 };
            Func <int, int, string> projection =
                (i, _) => null;

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Select(input, projection),
                FastLinq.Select(input, projection),
                itemNotInTheCollection: "",
                enforceWritable: false);
        }
        public void NominalCase()
        {
            IReadOnlyList <int>     input      = new[] { 1, 2, 3 };
            Func <int, int, string> projection =
                (item, index) => item.ToString() + index.ToString();

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Select(input, projection),
                FastLinq.Select(input, projection),
                itemNotInTheCollection: "",
                enforceWritable: false);
        }
        public void Setup()
        {
            switch (this.ItemType)
            {
            case UnderlyingItemType.Array:
                this.underlying = Enumerable.Range(0, this.SizeOfInput).ToArray();
                break;

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

            default:
                throw new ArgumentOutOfRangeException();
            }

            this.SelectList = FastLinq.Select(
                this.underlying,
                i => i);
        }
 public void FastLinq_SelectAField_ToList()
 {
     List <int> _ = FastLinq.ToList(
         FastLinq.Select(this.stringList, str => str.Length));
 }
 public void FastLinq_SelectAField_Lazy()
 {
     var _ = FastLinq.Select(this.stringList, str => str.Length);
 }