예제 #1
0
 public void EmptyArraySegment()
 {
     ListCompareTestUtil.ValidateEqual(
         new int[] { },
         new ArraySegment <int>(new int[] { }),
         itemNotInTheCollection: 0,
         enforceWritable: false);
 }
예제 #2
0
 public void EmptyList()
 {
     ListCompareTestUtil.ValidateEqual(
         new int[] { },
         new List <int> {
     },
         itemNotInTheCollection: 0,
         enforceWritable: true);
 }
예제 #3
0
 public void EmptyArray()
 {
     ListCompareTestUtil.ValidateEqual(
         new int[] { },
         new int[] { },
         itemNotInTheCollection: 0,
         // arrays are readonly
         enforceWritable: false);
 }
예제 #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);
 }
예제 #5
0
 public void OneItemList()
 {
     ListCompareTestUtil.ValidateEqual(
         new[] { 1 },
         new List <int> {
         1
     },
         itemNotInTheCollection: 0,
         enforceWritable: true);
 }
예제 #6
0
        public void EmptyValueType()
        {
            IReadOnlyList <int> empty = new int[] { };

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

            ListCompareTestUtil.ValidateEqual(
                Enumerable.DefaultIfEmpty(notEmpty),
                FastLinq.DefaultIfEmpty(notEmpty),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
예제 #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);
        }
예제 #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);
        }
예제 #10
0
        public void NoItems()
        {
            IReadOnlyList <int> list = new int[] { };

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

            ListCompareTestUtil.ValidateEqual(
                Enumerable.Reverse(input),
                FastLinq.Reverse(input),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }