Beispiel #1
0
        public async Task DefaultIfEmptyWithInt64SourceWithDefaultValueIsEquivalentToDefaultIfEmptyTest()
        {
            // Arrange

            // Arrange 'queryAdapter' parameter
            var queryAdapter = await GetQueryAdapterAsync(DisallowAll);

            // Arrange 'source' parameter
            var source = GetQueryable <long>();

            // Arrange 'asyncSource' parameter
            var asyncSource = queryAdapter.GetAsyncQueryable <long>();

            // Arrange 'defaultValue' parameter
            var defaultValue = 5;

            // Arrange 'expectedResult' parameter
            var expectedResult = Enumerable.DefaultIfEmpty <long>(source, defaultValue);

            // Act
            var result = await AsyncQueryable.DefaultIfEmpty <long>(asyncSource, defaultValue).ToListAsync().ConfigureAwait(false);

            // Assert
            Assert.Equal(expectedResult, result);
        }
Beispiel #2
0
 /// <summary>
 /// Returns all the fields contained within the specified select.
 /// </summary>
 /// <param name="select"></param>
 /// <returns></returns>
 public static IEnumerable <QueryComposerFieldDTO> FlattenSelectToFields(this QueryComposerSelectDTO select)
 {
     foreach (var field in Enumerable.DefaultIfEmpty(select.Fields).Where(f => f != null))
     {
         yield return(field);
     }
 }
Beispiel #3
0
        public void NotEmpty()
        {
            IReadOnlyCollection <int> notEmpty = new[] { 1 };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.DefaultIfEmpty(notEmpty),
                FastLinq.DefaultIfEmpty(notEmpty),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
Beispiel #4
0
        public void EmptyObject()
        {
            IReadOnlyList <object> empty = new object[] { };

            ListCompareTestUtil.ValidateEqual(
                Enumerable.DefaultIfEmpty(empty),
                FastLinq.DefaultIfEmpty(empty),
                itemNotInTheCollection: 0,
                enforceWritable: false);
        }
Beispiel #5
0
        public void EmptyValueType()
        {
            IReadOnlyCollection <int> empty = new int[] { };

            CollectionCompareTestUtil.ValidateEqual(
                Enumerable.DefaultIfEmpty(empty),
                FastLinq.DefaultIfEmpty(empty),
                itemNotInTheCollection: 1,
                enforceWritable: false);
        }
        /// <summary>
        /// Splits the specified message into a series of tweets.
        /// </summary>
        /// <param name="message">The message to be split.</param>
        /// <returns>A series of tweets to be posted to Twitter, in the order in which they should be posted.</returns>
        /// <exception cref="NotImplementedException"></exception>
        public IEnumerable <ITweet> Split(string message)
        {
            //create a string arring
            string[] words = message.Split(' ');
            //call a function to split words uisng MaxtTweetLength
            List <string> splettedMessageTweets = TwitterSplit(words, _MaxTweetLength);
            //call a function to format messages
            List <ITweet> tweets = FinalMessage(splettedMessageTweets);

            return(Enumerable.DefaultIfEmpty <ITweet>(tweets));
        }
Beispiel #7
0
        public void Collection_System()
        {
            var _ = Enumerable.DefaultIfEmpty(this.collection);

            if (this.EnumerateAfterwards)
            {
                foreach (var item in _)
                {
                    ;
                }
            }
        }
Beispiel #8
0
        public void Array_System()
        {
            var _ = Enumerable.DefaultIfEmpty(this.array);

            if (this.EnumerateAfterwards)
            {
                foreach (var item in _)
                {
                    ;
                }
            }
        }
Beispiel #9
0
        public void IList_System()
        {
            var _ = Enumerable.DefaultIfEmpty(this.ilist);

            if (this.EnumerateAfterwards)
            {
                foreach (var item in _)
                {
                    ;
                }
            }
        }
 public void GetSupportedMethods()
 {
     Assert.That(
         DefaultIfEmptyExpressionNode.GetSupportedMethods(),
         Is.EquivalentTo(
             new[]
     {
         GetGenericMethodDefinition(() => Queryable.DefaultIfEmpty <object> (null)),
         GetGenericMethodDefinition(() => Queryable.DefaultIfEmpty <object> (null, null)),
         GetGenericMethodDefinition(() => Enumerable.DefaultIfEmpty <object> (null)),
         GetGenericMethodDefinition(() => Enumerable.DefaultIfEmpty <object> (null, null)),
     }));
 }
Beispiel #11
0
 public static IEnumerable <KeyValuePair <string, WitIntentActivityHandler> > EnumerateHandlers(object dialog)
 {
     MethodInfo[] methodInfoArray = dialog.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
     for (int index = 0; index < methodInfoArray.Length; ++index)
     {
         MethodInfo               method        = methodInfoArray[index];
         WitIntentAttribute[]     intents       = Enumerable.ToArray(CustomAttributeExtensions.GetCustomAttributes <WitIntentAttribute>(method, true));
         WitIntentActivityHandler intentHandler = null;
         try
         {
             intentHandler = (WitIntentActivityHandler)Delegate.CreateDelegate(typeof(WitIntentActivityHandler), dialog, method, false);
         }
         catch (ArgumentException ex)
         {
         }
         if (intentHandler == null)
         {
             try
             {
                 WitIntentHandler handler = (WitIntentHandler)Delegate.CreateDelegate(typeof(WitIntentHandler), dialog, method, false);
                 if (handler != null)
                 {
                     intentHandler = (context, message, result) => handler(context, result);
                 }
             }
             catch (ArgumentException ex)
             {
             }
         }
         if (intentHandler != null)
         {
             foreach (string key in Enumerable.DefaultIfEmpty(Enumerable.Select(intents, i => i.IntentName), method.Name))
             {
                 if (string.IsNullOrWhiteSpace(key))
                 {
                     string str = string.Empty;
                 }
                 yield return(new KeyValuePair <string, WitIntentActivityHandler>(key, intentHandler));
             }
         }
         else if (intents.Length != 0)
         {
             throw new InvalidIntentHandlerException(string.Join(";", Enumerable.Select(intents, i => i.IntentName)), method);
         }
         intents       = null;
         intentHandler = null;
         method        = null;
     }
     methodInfoArray = null;
 }
Beispiel #12
0
        public void LinqQueryWithStaticCallOnEnumerableIsTranslatedToExtensionMethod()
        {
            var indexDefinition = new IndexDefinition <Page>
            {
                Map = pages => from p in pages
                      from coAuthor in Enumerable.DefaultIfEmpty(p.CoAuthors)
                      select new
                {
                    p.Id,
                    CoAuthorUserID = coAuthor != null ? coAuthor.UserId : -1
                }
            }.ToIndexDefinition(new DocumentConvention());
            var expectedMapTranslation =
                @"docs.Pages
	.SelectMany(p => p.CoAuthors.DefaultIfEmpty(), (p, coAuthor) => new {Id = p.Id, CoAuthorUserID = coAuthor != null ? coAuthor.UserId : -1})"    ;

            Assert.Equal(expectedMapTranslation, indexDefinition.Map);
        }
Beispiel #13
0
        /// <summary>
        /// Returns all terms contained within the specified criteria and all it's sub-criteria.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public static IEnumerable <DTO.QueryComposer.QueryComposerTermDTO> FlattenCriteriaToTerms(this DTO.QueryComposer.QueryComposerCriteriaDTO criteria)
        {
            if (criteria.Criteria != null)
            {
                foreach (var subCriteria in criteria.Criteria)
                {
                    foreach (var t in FlattenCriteriaToTerms(subCriteria).Where(t => t != null))
                    {
                        yield return(t);
                    }
                }
            }

            foreach (var term in Enumerable.DefaultIfEmpty(criteria.Terms).Where(t => t != null))
            {
                yield return(term);
            }
        }
Beispiel #14
0
        static void Main(string[] args)
        {
            Console.WriteLine("Linq Basics");

            // Generating
            var input = "1,2-3,4,5,6-10";
            // output -> 1,2,3,4,5,6,7,8,9,10
            var numbers = input.Split(",")
                          .Select(x => new { First = int.Parse(x.Split("-").First()), Last = int.Parse(x.Split("-").Last()) });

            var range = Enumerable.Range(1, 100).ToList();

            var repeat = Enumerable.Repeat(1, 5).ToList();

            var defaultEmpty = Enumerable.DefaultIfEmpty(range);

            var emptyEnumerable = Enumerable.Empty <int>();

            // Basics
            var select = input.Split(",")
                         .Select(x => new { First = int.Parse(x.Split("-").First()), Last = int.Parse(x.Split("-").Last()) });

            var deferredExecution = select.ToList();

            var nestedList = select.Select(x => Enumerable.Range(x.First, x.Last).ToList()).ToList();

            // flatten any collection
            var selectMany = nestedList.SelectMany(x => x)
                             .Distinct()
                             .OrderByDescending(x => x)
                             .ToList();

            // Filtering
            var where = selectMany.Where(x => x > 5).ToList();

            // Aggregation
            var sum       = selectMany.Sum();
            var average   = selectMany.Average();
            var aggregate = selectMany.Aggregate((x1, x2) => x1 + x2);
            var max       = selectMany.Max();
            var min       = selectMany.Min();

            // Groups
            var group = select.GroupBy(x => x.First).ToList();

            foreach (var item in group)
            {
                Console.WriteLine(item);
            }

            // Element Operations
            var first          = selectMany.First();
            var firstOrDefault = selectMany.FirstOrDefault();
            var last           = selectMany.Last();
            var lastOrDefault  = selectMany.LastOrDefault();
            //var single = selectMany.Single();
            //var singleOrDefault = selectMany.SingleOrDefault();

            // Set Operations
            var distinct = selectMany.Distinct();
            var intersection = new List <int> {
                1, 2, 3
            }.Intersect(new List <int> {
                3, 4, 5
            });
            var union = new List <int> {
                1, 2, 3
            }.Union(new List <int> {
                3, 4, 5
            });
            var except = new List <int> {
                1, 2, 3
            }.Except(new List <int> {
                3, 4, 5
            });

            // Quantify Data
            var any      = select.Any(x => x.First > 0);
            var all      = select.All(x => x.First > 0);
            var contains = selectMany.Contains(4);
            var count    = selectMany.Count();

            // Partition
            var skip = selectMany.Skip(3);
            var take = selectMany.Take(5);

            // Combine
            var zip = Enumerable.Range(1, 8).Zip(Enumerable.Range('a', 8));

            // MoreLinq for additional extensions

            Console.ReadKey();
        }
Beispiel #15
0
 public static IEnumerable <TSource> DefaultIfEmpty <TSource>(this Arr <TSource> source, TSource defaultValue) =>
 Enumerable.DefaultIfEmpty(source.Value, defaultValue);
Beispiel #16
0
 public IEnumerable <Operation> GetOperations()
 {
     return(Enumerable.DefaultIfEmpty(Enumerable.Empty <Operation>(), this));
 }
Beispiel #17
0
 public dynamic DefaultIfEmpty(object defaultValue = null)
 {
     return(Enumerable.DefaultIfEmpty(this, defaultValue ?? DynamicNullObject.Null));
 }
        public async Task <IPagedList <Slider> > GetAllSlidersAsync(
            string name            = null,
            int storeId            = 0,
            int pageIndex          = 0,
            int pageSize           = int.MaxValue,
            bool showHidden        = false,
            bool?overridePublished = null)
        {
            var query = _sliderRepository.Table;

            if (!showHidden)
            {
                query = query.Where(s => s.Published);
            }

            if (!string.IsNullOrWhiteSpace(name))
            {
                query = query.Where(s => s.Name.Contains(name));
            }

            query = query.OrderBy(p => p.DisplayOrder).ThenBy(p => p.Id);

            if ((storeId > 0 && !_catalogSettings.IgnoreStoreLimitations) || (!showHidden && !_catalogSettings.IgnoreAcl))
            {
                if (!showHidden && !_catalogSettings.IgnoreAcl)
                {
                    //ACL (access control list)
                    var allowedCustomerRolesIds = await _customerService.GetCustomerRoleIdsAsync(await _workContext.GetCurrentCustomerAsync());

                    query = from c in query
                            join acl in _aclRepository.Table
                            on new
                    {
                        c1 = c.Id,
                        c2 = nameof(Slider)
                    }
                    equals
                    new
                    {
                        c1 = acl.EntityId,
                        c2 = acl.EntityName
                    } into c_acl
                    from acl in Enumerable.DefaultIfEmpty <AclRecord>(c_acl)
                    where !c.SubjectToAcl || allowedCustomerRolesIds.Contains((int)acl.CustomerRoleId)
                    select c;
                }

                if (storeId > 0 && !_catalogSettings.IgnoreStoreLimitations)
                {
                    //Store mapping
                    query = from c in query
                            join sm in _storeMappingRepository.Table
                            on new
                    {
                        c1 = c.Id,
                        c2 = nameof(Slider)
                    }
                    equals
                    new
                    {
                        c1 = sm.EntityId,
                        c2 = sm.EntityName
                    } into c_sm
                    from sm in Enumerable.DefaultIfEmpty <StoreMapping>(c_sm)
                    where !c.LimitedToStores || storeId == sm.StoreId
                    select c;
                }
            }

            return(await query.ToPagedListAsync(pageIndex, pageSize));
        }
Beispiel #19
0
 public static IEnumerable <TSource> DefaultIfEmpty <TSource>(this Set <TSource> source, TSource defaultValue) =>
 Enumerable.DefaultIfEmpty(source.AsEnumerable(), defaultValue);
Beispiel #20
0
        public static IEnumerable <MethodInfo> GetSupportedMethods()
        {
            yield return(MethodHelper.GetMethodDefinition(() => Enumerable.DefaultIfEmpty <object>(null)));

            yield return(MethodHelper.GetMethodDefinition(() => Queryable.DefaultIfEmpty <object>(null)));
        }
Beispiel #21
0
        public static void Init()
        {
            _map = new Dictionary <MethodInfo, MethodInfo>();
            _enumerableMethods = new HashSet <MethodInfo>();

            //Some dummy objects of specific types. They help us to denote a specific overload of Queryable and Enumerable methods,
            // when we call 'Add'. The 'Add' method accepts two expressions as parameters, and it extracts the matching Queryable/Enumerable
            // methods from these expressions, and add the pair to the Map dictionary.
            // We use dummy classes TSource, TKey, etc - defined below.
            IQueryable <TSource>         qS    = null;
            IOrderedQueryable <TSource>  qSord = null;
            IEnumerable <TSource>        eS    = null;
            IOrderedEnumerable <TSource> eSord = null;
            TSource         objS     = null;
            TKey            objK     = null;
            TKeyComparer    objKComp = null;
            TSourceComparer objSComp = null;
            TElement        objEl    = null;

            //Aggregate
            Add(() => Queryable.Aggregate(qS, (s, ss) => objS), () => Enumerable.Aggregate(eS, (s, ss) => objS));
            Add(() => Queryable.Aggregate(qS, objEl, (el, s) => objEl), () => Enumerable.Aggregate(eS, objEl, (el, s) => objEl));
            Add(() => Queryable.Aggregate(qS, objEl, (el, s) => objEl, x => 0), () => Enumerable.Aggregate(eS, objEl, (el, s) => objEl, x => 0));
            //All, Any
            Add(() => Queryable.All(qS, s => true), () => Enumerable.All(eS, s => true));
            Add(() => Queryable.Any(qS), () => Enumerable.Any(eS));
            Add(() => Queryable.Any(qS, s => true), () => Enumerable.Any(eS, s => true));

            // Average
            Add(() => Queryable.Average(QueryOf <decimal>()), () => Enumerable.Average(QueryOf <decimal>()));
            Add(() => Queryable.Average(QueryOf <decimal?>()), () => Enumerable.Average(QueryOf <decimal?>()));
            Add(() => Queryable.Average(QueryOf <double>()), () => Enumerable.Average(QueryOf <double>()));
            Add(() => Queryable.Average(QueryOf <double?>()), () => Enumerable.Average(QueryOf <double?>()));
            Add(() => Queryable.Average(QueryOf <float>()), () => Enumerable.Average(QueryOf <float>()));
            Add(() => Queryable.Average(QueryOf <float?>()), () => Enumerable.Average(QueryOf <float?>()));
            Add(() => Queryable.Average(QueryOf <int>()), () => Enumerable.Average(QueryOf <int>()));
            Add(() => Queryable.Average(QueryOf <int?>()), () => Enumerable.Average(QueryOf <int?>()));
            Add(() => Queryable.Average(QueryOf <long>()), () => Enumerable.Average(QueryOf <long>()));
            Add(() => Queryable.Average(QueryOf <long?>()), () => Enumerable.Average(QueryOf <long?>()));
            Add(() => Queryable.Average(qS, x => (decimal)0), () => Enumerable.Average(eS, x => (decimal)0));
            Add(() => Queryable.Average(qS, x => (decimal?)0), () => Enumerable.Average(eS, x => (decimal?)0));
            Add(() => Queryable.Average(qS, x => (double)0), () => Enumerable.Average(eS, x => (double)0));
            Add(() => Queryable.Average(qS, x => (double?)0), () => Enumerable.Average(eS, x => (double?)0));
            Add(() => Queryable.Average(qS, x => (float)0), () => Enumerable.Average(eS, x => (float)0));
            Add(() => Queryable.Average(qS, x => (float?)0), () => Enumerable.Average(eS, x => (float?)0));
            Add(() => Queryable.Average(qS, x => (int)0), () => Enumerable.Average(eS, x => (int)0));
            Add(() => Queryable.Average(qS, x => (int?)0), () => Enumerable.Average(eS, x => (int?)0));
            Add(() => Queryable.Average(qS, x => (long)0), () => Enumerable.Average(eS, x => (long)0));
            Add(() => Queryable.Average(qS, x => (long?)0), () => Enumerable.Average(eS, x => (long?)0));

            //Cast
            Add(() => Queryable.Cast <TElement>(qS), () => Enumerable.Cast <TElement>(eS));
            // Concat
            Add(() => Queryable.Concat(qS, eS), () => Enumerable.Concat(eS, eS));
            //Contains
            Add(() => Queryable.Contains(qS, objS), () => Enumerable.Contains(eS, objS));
            Add(() => Queryable.Contains(qS, objS, objSComp), () => Enumerable.Contains(eS, objS, objSComp));
            //Count
            Add(() => Queryable.Count(qS), () => Enumerable.Count(eS));
            Add(() => Queryable.Count(qS, s => true), () => Enumerable.Count(eS, s => true));
            //DefaultIfEmpty
            Add(() => Queryable.DefaultIfEmpty(qS), () => Enumerable.DefaultIfEmpty(eS));
            Add(() => Queryable.DefaultIfEmpty(qS, objS), () => Enumerable.DefaultIfEmpty(eS, objS));
            //Distinct
            Add(() => Queryable.Distinct(qS), () => Enumerable.Distinct(eS));
            Add(() => Queryable.Distinct(qS, objSComp), () => Enumerable.Distinct(eS, objSComp));
            // ElementAt
            Add(() => Queryable.ElementAt(qS, 0), () => Enumerable.ElementAt(eS, 0));
            Add(() => Queryable.ElementAtOrDefault(qS, 0), () => Enumerable.ElementAtOrDefault(eS, 0));
            // Except
            Add(() => Queryable.Except(qS, qS), () => Enumerable.Except(eS, eS));
            Add(() => Queryable.Except(qS, qS, objSComp), () => Enumerable.Except(eS, eS, objSComp));
            // First
            Add(() => Queryable.First(qS), () => Enumerable.First(eS));
            Add(() => Queryable.First(qS, s => true), () => Enumerable.First(eS, s => true));
            Add(() => Queryable.FirstOrDefault(qS), () => Enumerable.FirstOrDefault(eS));
            Add(() => Queryable.FirstOrDefault(qS, s => true), () => Enumerable.FirstOrDefault(eS, s => true));
            // GroupBy
            Add(() => Queryable.GroupBy(qS, s => objK), () => Enumerable.GroupBy(eS, s => objK));
            Add(() => Queryable.GroupBy(qS, s => objK, (s, ss) => 0), () => Enumerable.GroupBy(eS, s => objK, (s, ss) => 0));
            Add(() => Queryable.GroupBy(qS, s => objK, (s) => 0), () => Enumerable.GroupBy(eS, s => objK, (s) => 0));
            Add(() => Queryable.GroupBy(qS, s => objS, objSComp), () => Enumerable.GroupBy(eS, s => s, objSComp));
            Add(() => Queryable.GroupBy(qS, s => objS, (s, ss) => 0, objSComp), () => Enumerable.GroupBy(eS, s => objS, (s, ss) => 0, objSComp));
            Add(() => Queryable.GroupBy(qS, s => objS, s => objK, (s, ss) => 0), () => Enumerable.GroupBy(eS, s => objS, s => objK, (s, ss) => 0));
            Add(() => Queryable.GroupBy(qS, s => objK, s => objEl, objKComp), () => Enumerable.GroupBy(eS, s => objK, s => objEl, objKComp));
            Add(() => Queryable.GroupBy(qS, s => objS, s => objK, (s, ss) => 0, objSComp), () => Enumerable.GroupBy(eS, s => objS, s => objK, (s, ss) => 0, objSComp));
            //GroupJoin
            IEnumerable <TSource2> eInner = null;

            Add(() => Queryable.GroupJoin(qS, eInner, s => objK, s => objK, (s, ss) => objEl),
                () => Enumerable.GroupJoin(eS, eInner, s => objK, s => objK, (s, ss) => objEl));
            Add(() => Queryable.GroupJoin(qS, eInner, s => objK, s => objK, (s, ss) => objEl, objKComp),
                () => Enumerable.GroupJoin(eS, eInner, s => objK, s => objK, (s, ss) => objEl, objKComp));
            //Intersect
            Add(() => Queryable.Intersect(qS, eS), () => Enumerable.Intersect(eS, eS));
            Add(() => Queryable.Intersect(qS, eS, objSComp), () => Enumerable.Intersect(eS, eS, objSComp));

            // Join
            Add(() => Queryable.Join(qS, eInner, s => objK, s => objK, (s, ss) => objEl), () => Enumerable.Join(eS, eInner, s => objK, s => objK, (s, ss) => objEl));
            Add(() => Queryable.Join(qS, eInner, s => objK, s => objK, (s, ss) => objEl, objKComp), () => Enumerable.Join(eS, eInner, s => objK, s => objK, (s, ss) => objEl, objKComp));
            // Last
            Add(() => Queryable.Last(qS), () => Enumerable.Last(eS));
            Add(() => Queryable.Last(qS, s => true), () => Enumerable.Last(eS, s => true));
            Add(() => Queryable.LastOrDefault(qS), () => Enumerable.LastOrDefault(eS));
            Add(() => Queryable.LastOrDefault(qS, s => true), () => Enumerable.LastOrDefault(eS, s => true));
            //LongCount
            Add(() => Queryable.LongCount(qS), () => Enumerable.LongCount(eS));
            Add(() => Queryable.LongCount(qS, s => true), () => Enumerable.LongCount(eS, s => true));
            // Max, Min
            Add(() => Queryable.Max(qS), () => Enumerable.Max(eS));
            Add(() => Queryable.Max(qS, s => objEl), () => Enumerable.Max(eS, s => objEl));     //Enumerable has many Max versions - make sure we pick generic one here
            Add(() => Queryable.Min(qS), () => Enumerable.Min(eS));
            Add(() => Queryable.Min(qS, s => objEl), () => Enumerable.Min(eS, s => objEl));     //Enumerable has many Min versions - make sure we pick generic one here
            // OfType
            Add(() => Queryable.OfType <TElement>(qS), () => Enumerable.OfType <TElement>(eS)); //have to specify type arg explicitly
            // OrderBy
            Add(() => Queryable.OrderBy(qS, (s) => objK), () => Enumerable.OrderBy(eS, (s) => objK));
            Add(() => Queryable.OrderBy(qS, (s) => objK, objKComp), () => Enumerable.OrderBy(eS, (s) => objK, objKComp));
            Add(() => Queryable.OrderByDescending(qS, (s) => true), () => Enumerable.OrderByDescending(eS, (s) => true));
            Add(() => Queryable.OrderByDescending(qS, (s) => objK, objKComp), () => Enumerable.OrderByDescending(eS, (s) => objK, objKComp));
            // Reverse
            Add(() => Queryable.Reverse(qS), () => Enumerable.Reverse(eS));
            //Select
            Add(() => Queryable.Select(qS, (s) => true), () => Enumerable.Select(eS, (s) => true));
            Add(() => Queryable.Select(qS, (s, i) => true), () => Enumerable.Select(eS, (s, i) => true));
            //SelectMany
            IEnumerable <TElement> objListOfEl = null;

            Add(() => Queryable.SelectMany(qS, (s) => objListOfEl), () => Enumerable.SelectMany(eS, (s) => objListOfEl));
            Add(() => Queryable.SelectMany(qS, (s, i) => objListOfEl), () => Enumerable.SelectMany(eS, (s, i) => objListOfEl));
            Add(() => Queryable.SelectMany(qS, s => objListOfEl, (s, ss) => objEl), () => Enumerable.SelectMany(eS, s => objListOfEl, (s, ss) => objEl));
            Add(() => Queryable.SelectMany(qS, (s, i) => objListOfEl, (s, ss) => objEl), () => Enumerable.SelectMany(eS, (s, i) => objListOfEl, (s, ss) => objEl));
            // SequenceEqual
            Add(() => Queryable.SequenceEqual(qS, qS), () => Enumerable.SequenceEqual(eS, eS));
            Add(() => Queryable.SequenceEqual(qS, qS, objSComp), () => Enumerable.SequenceEqual(eS, eS, objSComp));
            // Single
            Add(() => Queryable.Single(qS), () => Enumerable.Single(eS));
            Add(() => Queryable.Single(qS, s => true), () => Enumerable.Single(eS, s => true));
            Add(() => Queryable.SingleOrDefault(qS), () => Enumerable.SingleOrDefault(eS));
            Add(() => Queryable.SingleOrDefault(qS, s => true), () => Enumerable.SingleOrDefault(eS, s => true));
            // Skip, SkipWhile
            Add(() => Queryable.Skip(qS, 1), () => Enumerable.Skip(eS, 1));
            Add(() => Queryable.SkipWhile(qS, s => true), () => Enumerable.SkipWhile(eS, s => true));
            Add(() => Queryable.SkipWhile(qS, (s, i) => true), () => Enumerable.SkipWhile(eS, (s, i) => true));
            // Sum
            Add(() => Queryable.Sum(QueryOf <decimal>()), () => Enumerable.Sum(QueryOf <decimal>()));
            Add(() => Queryable.Sum(QueryOf <decimal?>()), () => Enumerable.Sum(QueryOf <decimal?>()));
            Add(() => Queryable.Sum(QueryOf <double>()), () => Enumerable.Sum(QueryOf <double>()));
            Add(() => Queryable.Sum(QueryOf <double?>()), () => Enumerable.Sum(QueryOf <double?>()));
            Add(() => Queryable.Sum(QueryOf <float>()), () => Enumerable.Sum(QueryOf <float>()));
            Add(() => Queryable.Sum(QueryOf <float?>()), () => Enumerable.Sum(QueryOf <float?>()));
            Add(() => Queryable.Sum(QueryOf <int>()), () => Enumerable.Sum(QueryOf <int>()));
            Add(() => Queryable.Sum(QueryOf <int?>()), () => Enumerable.Sum(QueryOf <int?>()));
            Add(() => Queryable.Sum(QueryOf <long>()), () => Enumerable.Sum(QueryOf <long>()));
            Add(() => Queryable.Sum(QueryOf <long?>()), () => Enumerable.Sum(QueryOf <long?>()));
            Add(() => Queryable.Sum(qS, x => (decimal)0), () => Enumerable.Sum(eS, x => (decimal)0));
            Add(() => Queryable.Sum(qS, x => (decimal?)0), () => Enumerable.Sum(eS, x => (decimal?)0));
            Add(() => Queryable.Sum(qS, x => (double)0), () => Enumerable.Sum(eS, x => (double)0));
            Add(() => Queryable.Sum(qS, x => (double?)0), () => Enumerable.Sum(eS, x => (double?)0));
            Add(() => Queryable.Sum(qS, x => (float)0), () => Enumerable.Sum(eS, x => (float)0));
            Add(() => Queryable.Sum(qS, x => (float?)0), () => Enumerable.Sum(eS, x => (float?)0));
            Add(() => Queryable.Sum(qS, x => (int)0), () => Enumerable.Sum(eS, x => (int)0));
            Add(() => Queryable.Sum(qS, x => (int?)0), () => Enumerable.Sum(eS, x => (int?)0));
            Add(() => Queryable.Sum(qS, x => (long)0), () => Enumerable.Sum(eS, x => (long)0));
            Add(() => Queryable.Sum(qS, x => (long?)0), () => Enumerable.Sum(eS, x => (long?)0));

            // Take, TakeWhile
            Add(() => Queryable.Take(qS, 1), () => Enumerable.Take(eS, 1));
            Add(() => Queryable.TakeWhile(qS, s => true), () => Enumerable.TakeWhile(eS, s => true));
            Add(() => Queryable.TakeWhile(qS, (s, i) => true), () => Enumerable.TakeWhile(eS, (s, i) => true));

            // ThenBy, ThenByDescending
            Add(() => Queryable.ThenBy(qSord, (s) => objK), () => Enumerable.ThenBy(eSord, (s) => objK));
            Add(() => Queryable.ThenBy(qSord, (s) => objK, objKComp), () => Enumerable.ThenBy(eSord, (s) => objK, objKComp));
            Add(() => Queryable.ThenByDescending(qSord, (s) => objK), () => Enumerable.ThenByDescending(eSord, (s) => objK));
            Add(() => Queryable.ThenByDescending(qSord, (s) => objK, objKComp), () => Enumerable.ThenByDescending(eSord, (s) => objK, objKComp));
            // Union
            Add(() => Queryable.Union(qS, qS), () => Enumerable.Union(eS, eS));
            Add(() => Queryable.Union(qS, qS, objSComp), () => Enumerable.Union(eS, eS, objSComp));
            // Where
            Add(() => Queryable.Where(qS, (s) => true), () => Enumerable.Where(eS, (s) => true));
            Add(() => Queryable.Where(qS, (s, i) => true), () => Enumerable.Where(eS, (s, i) => true));
            // Zip
            Add(() => Queryable.Zip(qS, eInner, (s, ss) => objEl), () => Enumerable.Zip(eS, eInner, (s, ss) => objEl));
        }
 public static IEnumerable <TSource> DefaultIfEmpty <TSource>(this IEnumerable <TSource> source)
 => Enumerable.DefaultIfEmpty(source);