public void ContainsEqualCountTest() { var query = source.AsQueryable(); var targetQuery = new List <string> { "9", "8", "7", "6", "5", "4", "3", "2" }.AsQueryable(); Assert.True(QueryableJudgment.ContainsEqualCount(query, targetQuery)); Assert.True(QueryableJudgment.ContainsEqualCount <string>(null, null)); Assert.False(QueryableJudgment.ContainsEqualCount(query, null)); Assert.False(QueryableJudgment.ContainsEqualCount(null, targetQuery)); var wrongQuery = new List <string> { "1" }.AsQueryable(); Assert.False(QueryableJudgment.ContainsEqualCount(query, wrongQuery)); }
/// <summary> /// 检查两个集合是否拥有相等数量的成员 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="this"></param> /// <param name="that"></param> /// <returns></returns> public static bool ContainsEqualCount <T>(this IQueryable <T> @this, IQueryable <T> @that) => QueryableJudgment.ContainsEqualCount(@this, @that);