@@ -2877,6 +2877,92 @@ public void SearchTagFieldAndTextListContainsWithEscapes()
2877
2877
"100" ) ;
2878
2878
}
2879
2879
2880
+ [ Fact ]
2881
+ public void ChainTwoBooleans ( )
2882
+ {
2883
+ int count ;
2884
+ _substitute . ClearSubstitute ( ) ;
2885
+ _substitute . Execute ( Arg . Any < string > ( ) , Arg . Any < object [ ] > ( ) ) . Returns ( _mockReply ) ;
2886
+ IRedisCollection < ObjectWithStringLikeValueTypes > collection = new RedisCollection < ObjectWithStringLikeValueTypes > ( _substitute ) ;
2887
+ collection = collection . Where ( x => x . Boolean ) ;
2888
+ collection = collection . Where ( ( x => x . Boolean ) ) ;
2889
+ count = collection . Count ( ) ;
2890
+ _substitute . Received ( ) . Execute ( "FT.SEARCH" , "objectwithstringlikevaluetypes-idx" , "(@Boolean:{true} @Boolean:{true})" , "LIMIT" , "0" , "0" ) ;
2891
+ Assert . Equal ( 1 , count ) ;
2892
+
2893
+ collection = new RedisCollection < ObjectWithStringLikeValueTypes > ( _substitute ) ;
2894
+ collection = collection . Where ( x => x . Boolean || x . Boolean ) ;
2895
+ count = collection . Count ( ) ;
2896
+ _substitute . Received ( ) . Execute ( "FT.SEARCH" , "objectwithstringlikevaluetypes-idx" , "(@Boolean:{true} | @Boolean:{true})" , "LIMIT" , "0" , "0" ) ;
2897
+ Assert . Equal ( 1 , count ) ;
2898
+
2899
+ collection = new RedisCollection < ObjectWithStringLikeValueTypes > ( _substitute ) ;
2900
+ collection = collection . Where ( x => ! x . Boolean || x . Boolean ) ;
2901
+ count = collection . Count ( ) ;
2902
+ _substitute . Received ( ) . Execute ( "FT.SEARCH" , "objectwithstringlikevaluetypes-idx" , "(@Boolean:{false} | @Boolean:{true})" , "LIMIT" , "0" , "0" ) ;
2903
+ Assert . Equal ( 1 , count ) ;
2904
+
2905
+ collection = new RedisCollection < ObjectWithStringLikeValueTypes > ( _substitute ) ;
2906
+ collection = collection . Where ( x => ! x . Boolean ) ;
2907
+ collection = collection . Where ( ( x => ! x . Boolean ) ) ;
2908
+ count = collection . Count ( ) ;
2909
+ _substitute . Received ( ) . Execute ( "FT.SEARCH" , "objectwithstringlikevaluetypes-idx" , "(@Boolean:{false} @Boolean:{false})" , "LIMIT" , "0" , "0" ) ;
2910
+ Assert . Equal ( 1 , count ) ;
2911
+
2912
+ collection = new RedisCollection < ObjectWithStringLikeValueTypes > ( _substitute ) ;
2913
+ collection = collection . Where ( x => x . Boolean ) ;
2914
+ collection = collection . Where ( ( x => ! x . Boolean ) ) ;
2915
+ count = collection . Count ( ) ;
2916
+ _substitute . Received ( ) . Execute ( "FT.SEARCH" , "objectwithstringlikevaluetypes-idx" , "(@Boolean:{true} @Boolean:{false})" , "LIMIT" , "0" , "0" ) ;
2917
+ Assert . Equal ( 1 , count ) ;
2918
+
2919
+ collection = new RedisCollection < ObjectWithStringLikeValueTypes > ( _substitute ) ;
2920
+ collection = collection . Where ( x => ! x . Boolean ) ;
2921
+ collection = collection . Where ( ( x => x . Boolean ) ) ;
2922
+ count = collection . Count ( ) ;
2923
+ _substitute . Received ( ) . Execute ( "FT.SEARCH" , "objectwithstringlikevaluetypes-idx" , "(@Boolean:{false} @Boolean:{true})" , "LIMIT" , "0" , "0" ) ;
2924
+ Assert . Equal ( 1 , count ) ;
2925
+
2926
+ collection = new RedisCollection < ObjectWithStringLikeValueTypes > ( _substitute ) ;
2927
+ collection = collection . Where ( x => ! x . Boolean ) ;
2928
+ collection = collection . Where ( ( x => x . Boolean ) ) ;
2929
+ collection = collection . Where ( ( x => x . Boolean ) ) ;
2930
+ count = collection . Count ( ) ;
2931
+ _substitute . Received ( ) . Execute ( "FT.SEARCH" , "objectwithstringlikevaluetypes-idx" , "((@Boolean:{false} @Boolean:{true}) @Boolean:{true})" , "LIMIT" , "0" , "0" ) ;
2932
+ Assert . Equal ( 1 , count ) ;
2933
+
2934
+ collection = new RedisCollection < ObjectWithStringLikeValueTypes > ( _substitute ) ;
2935
+ collection = collection . Where ( x => ! x . Boolean ) ;
2936
+ collection = collection . Where ( ( x => x . Boolean ) ) ;
2937
+ collection = collection . Where ( ( x => ! x . Boolean ) ) ;
2938
+ count = collection . Count ( ) ;
2939
+ _substitute . Received ( ) . Execute ( "FT.SEARCH" , "objectwithstringlikevaluetypes-idx" , "((@Boolean:{false} @Boolean:{true}) @Boolean:{false})" , "LIMIT" , "0" , "0" ) ;
2940
+ Assert . Equal ( 1 , count ) ;
2941
+
2942
+ collection = new RedisCollection < ObjectWithStringLikeValueTypes > ( _substitute ) ;
2943
+ collection = collection . Where ( x => ! x . Boolean || x . Boolean || ! x . Boolean ) ;
2944
+ count = collection . Count ( ) ;
2945
+ _substitute . Received ( ) . Execute ( "FT.SEARCH" , "objectwithstringlikevaluetypes-idx" , "((@Boolean:{false} | @Boolean:{true}) | @Boolean:{false})" , "LIMIT" , "0" , "0" ) ;
2946
+ Assert . Equal ( 1 , count ) ;
2947
+ }
2948
+
2949
+ [ Fact ]
2950
+ public void SearchWithEmptyCount ( )
2951
+ {
2952
+ _substitute . ClearSubstitute ( ) ;
2953
+ _substitute . Execute ( Arg . Any < string > ( ) , Arg . Any < object [ ] > ( ) ) . Returns ( _mockReply ) ;
2954
+ var collection = new RedisCollection < ObjectWithStringLikeValueTypes > ( _substitute ) ;
2955
+ var count = collection . Count ( x => x . Boolean && x . AnEnum == AnEnum . three && x . Boolean == false ) ;
2956
+ _substitute . Received ( ) . Execute (
2957
+ "FT.SEARCH" ,
2958
+ "objectwithstringlikevaluetypes-idx" ,
2959
+ "((@Boolean:{true} (@AnEnum:{three})) (@Boolean:{False}))" ,
2960
+ "LIMIT" ,
2961
+ "0" ,
2962
+ "0" ) ;
2963
+ Assert . Equal ( 1 , count ) ;
2964
+ }
2965
+
2880
2966
[ Fact ]
2881
2967
public void SearchWithEmptyAny ( )
2882
2968
{
0 commit comments