Esempio n. 1
0
 public void EmptyArraySegment()
 {
     ListCompareTestUtil.ValidateEqual(
         new int[] { },
         new ArraySegment <int>(new int[] { }),
         itemNotInTheCollection: 0,
         enforceWritable: false);
 }
Esempio n. 2
0
 public void EmptyList()
 {
     ListCompareTestUtil.ValidateEqual(
         new int[] { },
         new List <int> {
     },
         itemNotInTheCollection: 0,
         enforceWritable: true);
 }
Esempio n. 3
0
 public void EmptyArray()
 {
     ListCompareTestUtil.ValidateEqual(
         new int[] { },
         new int[] { },
         itemNotInTheCollection: 0,
         // arrays are readonly
         enforceWritable: false);
 }
Esempio n. 4
0
 public void Nominal()
 {
     int[] list = new[] { 1, 2, 3 };
     ListCompareTestUtil.ValidateEqual(
         Enumerable.Cast <object>(list),
         FastLinq.Cast <object>(list),
         itemNotInTheCollection: null,
         enforceWritable: false);
 }
Esempio n. 5
0
 public void OneItemList()
 {
     ListCompareTestUtil.ValidateEqual(
         new[] { 1 },
         new List <int> {
         1
     },
         itemNotInTheCollection: 0,
         enforceWritable: true);
 }
Esempio n. 6
0
        public void EmptyValueType()
        {
            IReadOnlyList <int> empty = new int[] { };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.DefaultIfEmpty(empty),
                FastLinq.DefaultIfEmpty(empty),
                itemNotInTheCollection: 1,
                enforceWritable: false);
        }
Esempio n. 7
0
        public void NotEmpty()
        {
            IReadOnlyList <int> notEmpty = new[] { 1 };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.DefaultIfEmpty(notEmpty),
                FastLinq.DefaultIfEmpty(notEmpty),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
Esempio n. 8
0
        public void TakeNone()
        {
            IReadOnlyList <int> list = new[] { 1, 2, 3 };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Take(list, 0),
                FastLinq.Take(list, 0),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
Esempio n. 9
0
        public void NominalCaseOther()
        {
            IReadOnlyList <int> list = new ArraySegment <int>(new int[] { 1, 2, 3 });

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Take(list, 1),
                FastLinq.Take(list, 1),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
Esempio n. 10
0
        public void NoItems()
        {
            IReadOnlyList <int> list = new int[] { };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.ToList(list),
                (IReadOnlyList <int>)FastLinq.ToLazyList(list),
                itemNotInTheCollection: 0,
                enforceWritable: true);
        }
Esempio n. 11
0
        public void Duplicates()
        {
            IReadOnlyList <int> input = new[] { 1, 1, 2 };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Reverse(input),
                FastLinq.Reverse(input),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
Esempio n. 12
0
        public void TakeNoneObjects()
        {
            IReadOnlyList <object> list = new object[] { "a", "b" };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Take(list, 0),
                FastLinq.Take(list, 0),
                itemNotInTheCollection: null,
                enforceWritable: false);
        }
Esempio n. 13
0
        public void SkipObjectsContainsNull()
        {
            IReadOnlyList <object> list = new object[] { null, "b" };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Skip(list, 0),
                FastLinq.Skip(list, 0),
                itemNotInTheCollection: "a",
                enforceWritable: false);
        }
Esempio n. 14
0
        public void SkipNegative()
        {
            IReadOnlyList <int> list = new[] { 1, 2, 3 };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Skip(list, -1),
                FastLinq.Skip(list, -1),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
Esempio n. 15
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);
        }
Esempio n. 16
0
        public void NominalCase()
        {
            var input = new[] { 1, 2, 3 };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.ToList(input),
                (IReadOnlyList <int>)FastLinq.ToLazyList(input),
                itemNotInTheCollection: 0,
                enforceWritable: true);
        }
Esempio n. 17
0
        public void EmptyBoth()
        {
            IReadOnlyList <int> first  = new int[] {  };
            IReadOnlyList <int> second = new int[] { };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Concat(first, second),
                FastLinq.Concat(first, second),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
        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);
        }
Esempio n. 20
0
        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);
        }
Esempio n. 21
0
        public void NominalCaseList()
        {
            IReadOnlyList <int> list = new List <int> {
                1, 2, 3
            };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Skip(list, 1),
                FastLinq.Skip(list, 1),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }