コード例 #1
0
 public void EmptyList()
 {
     CollectionCompareTestUtil.ValidateEqual(
         new int[] { },
         new List <int> {
     },
         itemNotInTheCollection: 0,
         enforceWritable: true);
 }
コード例 #2
0
 public void OneItemArray()
 {
     CollectionCompareTestUtil.ValidateEqual(
         new[] { 1 },
         new[] { 1 },
         itemNotInTheCollection: 0,
         // arrays are readonly
         enforceWritable: false);
 }
コード例 #3
0
        public void NotEmpty()
        {
            IReadOnlyCollection <int> notEmpty = new[] { 1 };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.DefaultIfEmpty(notEmpty),
                FastLinq.DefaultIfEmpty(notEmpty),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
コード例 #4
0
        public void Duplicates()
        {
            IReadOnlyCollection <int> input = new[] { 1, 1, 2 };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.Reverse(input),
                FastLinq.Reverse(input),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
コード例 #5
0
        public void NominalCase()
        {
            var input = new[] { 1, 2, 3 };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.ToArray(input),
                FastLinq.ToArray(input),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
コード例 #6
0
 public void OneItemList()
 {
     CollectionCompareTestUtil.ValidateEqual(
         new[] { 1 },
         new List <int> {
         1
     },
         itemNotInTheCollection: 0,
         enforceWritable: true);
 }
コード例 #7
0
        public void SkipNegative()
        {
            IReadOnlyCollection <int> collection = new[] { 1, 2, 3 };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.Skip(collection, -1),
                FastLinq.Skip(collection, -1),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
コード例 #8
0
        public void TakeNone()
        {
            IReadOnlyCollection <int> collection = new[] { 1, 2, 3 };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.Take(collection, 0),
                FastLinq.Take(collection, 0),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
コード例 #9
0
        public void NoItems()
        {
            IReadOnlyCollection <int> collection = new int[] { };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.ToArray(collection),
                FastLinq.ToArray <int>(collection),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
コード例 #10
0
        public void EmptyValueType()
        {
            IReadOnlyCollection <int> empty = new int[] { };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.DefaultIfEmpty(empty),
                FastLinq.DefaultIfEmpty(empty),
                itemNotInTheCollection: 1,
                enforceWritable: false);
        }
コード例 #11
0
        public void BothEmpty()
        {
            var first  = new int[] { };
            var second = new int[] { };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.Zip(first, second, (i, j) => i + j),
                FastLinq.Zip(first, second, (i, j) => i + j),
                itemNotInTheCollection: 1,
                enforceWritable: false);
        }
コード例 #12
0
        public void SecondLarger()
        {
            var first  = new int[] { 1, 2, 3 };
            var second = new int[] { 4, 5, 6, 7, 8, 9 };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.Zip(first, second, (i, j) => i + j),
                FastLinq.Zip(first, second, (i, j) => i + j),
                itemNotInTheCollection: 1,
                enforceWritable: false);
        }
コード例 #13
0
        public void BothEmpty()
        {
            IReadOnlyCollection <int> first  = new int[] { };
            IReadOnlyCollection <int> second = new int[] { };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.Concat(first, second),
                FastLinq.Concat(first, second),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
コード例 #14
0
        public void NominalCase()
        {
            IReadOnlyCollection <int> first  = new[] { 1, 2, 3 };
            IReadOnlyCollection <int> second = new[] { 4, 5, 6 };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.Concat(first, second),
                FastLinq.Concat(first, second),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
コード例 #15
0
        public void NominalCase()
        {
            IReadOnlyCollection <int> input      = new[] { 1, 2, 3 };
            Func <int, int, string>   projection =
                (item, index) => item.ToString() + index.ToString();

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.Select(input, projection),
                FastLinq.Select(input, projection),
                itemNotInTheCollection: "",
                enforceWritable: false);
        }
コード例 #16
0
        public void InputEmpty()
        {
            IReadOnlyCollection <int> input      = new int[] { };
            Func <int, int, string>   projection =
                (i, _) => i.ToString();

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.Select(input, projection),
                FastLinq.Select(input, projection),
                itemNotInTheCollection: "",
                enforceWritable: false);
        }
コード例 #17
0
        public void SelectProducesNulls()
        {
            IReadOnlyCollection <int> input      = new[] { 1, 2, 3 };
            Func <int, int, string>   projection =
                (i, _) => null;

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.Select(input, projection),
                FastLinq.Select(input, projection),
                itemNotInTheCollection: "",
                enforceWritable: false);
        }