@@ -896,97 +896,6 @@ public void ExpressionTests_Indexer_Issue57()
896
896
Assert . Equal ( expected , result ) ;
897
897
}
898
898
899
- [ Fact ]
900
- public void ExpressionTests_Integer ( )
901
- {
902
- // Arrange
903
- var qry = new [ ] { 1 , 2 , 3 , 4 , 5 , 6 } . AsQueryable ( ) ;
904
-
905
- // Act
906
- var resultLessThan = qry . Where ( "it < 4" ) ;
907
- var resultLessThanEqual = qry . Where ( "it <= 4" ) ;
908
-
909
- var resultGreaterThan = qry . Where ( "4 > it" ) ;
910
- var resultGreaterThanEqual = qry . Where ( "4 >= it" ) ;
911
-
912
- var resultEqualItLeft = qry . Where ( "it = 5" ) ;
913
- var resultEqualItRight = qry . Where ( "5 = it" ) ;
914
-
915
- var resultEqualIntParamLeft = qry . Where ( "@0 = it" , 5 ) ;
916
- var resultEqualIntParamRight = qry . Where ( "it = @0" , 5 ) ;
917
-
918
- // Assert
919
- Check . That ( resultLessThan . ToArray ( ) ) . ContainsExactly ( 1 , 2 , 3 ) ;
920
- Check . That ( resultLessThanEqual . ToArray ( ) ) . ContainsExactly ( 1 , 2 , 3 , 4 ) ;
921
- Check . That ( resultGreaterThan . ToArray ( ) ) . ContainsExactly ( 1 , 2 , 3 ) ;
922
- Check . That ( resultGreaterThanEqual . ToArray ( ) ) . ContainsExactly ( 1 , 2 , 3 , 4 ) ;
923
-
924
- Check . That ( resultEqualItLeft . Single ( ) ) . Equals ( 5 ) ;
925
- Check . That ( resultEqualItRight . Single ( ) ) . Equals ( 5 ) ;
926
-
927
- Check . That ( resultEqualIntParamLeft . Single ( ) ) . Equals ( 5 ) ;
928
- Check . That ( resultEqualIntParamRight . Single ( ) ) . Equals ( 5 ) ;
929
- }
930
-
931
- [ Fact ]
932
- public void ExpressionTests_IntegerQualifiers ( )
933
- {
934
- //Arrange
935
- var valuesL = new [ ] { 1L , 2L , 3L } . AsQueryable ( ) ;
936
- var resultValuesL = new [ ] { 2L , 3L } . AsQueryable ( ) ;
937
-
938
- var valuesU = new [ ] { 1U , 2U , 3U } . AsQueryable ( ) ;
939
- var resultValuesU = new [ ] { 2U , 3U } . AsQueryable ( ) ;
940
-
941
- var valuesUL = new [ ] { 1UL , 2UL , 3UL } . AsQueryable ( ) ;
942
- var resultValuesUL = new [ ] { 2UL , 3UL } . AsQueryable ( ) ;
943
-
944
- //Act
945
- var resultL = valuesL . Where ( "it in (2L, 3L)" ) ;
946
- var resultU = valuesU . Where ( "it in (2U, 3U)" ) ;
947
- var resultUL = valuesUL . Where ( "it in (2UL, 3UL)" ) ;
948
-
949
- //Assert
950
- Assert . Equal ( resultValuesL . ToArray ( ) , resultL . ToArray ( ) ) ;
951
- Assert . Equal ( resultValuesU . ToArray ( ) , resultU . ToArray ( ) ) ;
952
- Assert . Equal ( resultValuesUL . ToArray ( ) , resultUL . ToArray ( ) ) ;
953
- }
954
-
955
- [ Fact ]
956
- public void ExpressionTests_IntegerQualifiers_Negative ( )
957
- {
958
- //Arrange
959
- var valuesL = new [ ] { - 1L , - 2L , - 3L } . AsQueryable ( ) ;
960
- var resultValuesL = new [ ] { - 2L , - 3L } . AsQueryable ( ) ;
961
-
962
- //Act
963
- var resultL = valuesL . Where ( "it <= -2L" ) ;
964
- var resultIn = valuesL . Where ( "it in (-2L, -3L)" ) ;
965
-
966
- //Assert
967
- Assert . Equal ( resultValuesL . ToArray ( ) , resultL ) ;
968
- Assert . Equal ( resultValuesL . ToArray ( ) , resultIn ) ;
969
- }
970
-
971
- [ Fact ]
972
- public void ExpressionTests_IntegerQualifiers_Exceptions ( )
973
- {
974
- //Arrange
975
- var values = new [ ] { 1L , 2L , 3L } . AsQueryable ( ) ;
976
-
977
- //Assert
978
- Assert . Throws < ParseException > ( ( ) => values . Where ( "it in (2LL)" ) ) ;
979
- Assert . Throws < ParseException > ( ( ) => values . Where ( "it in (2UU)" ) ) ;
980
- Assert . Throws < ParseException > ( ( ) => values . Where ( "it in (2LU)" ) ) ;
981
- Assert . Throws < ParseException > ( ( ) => values . Where ( "it in (2B)" ) ) ;
982
-
983
- Assert . Throws < ParseException > ( ( ) => values . Where ( "it < -2LL" ) ) ;
984
- Assert . Throws < ParseException > ( ( ) => values . Where ( "it < -2UL" ) ) ;
985
- Assert . Throws < ParseException > ( ( ) => values . Where ( "it < -2UU" ) ) ;
986
- Assert . Throws < ParseException > ( ( ) => values . Where ( "it < -2LU" ) ) ;
987
- Assert . Throws < ParseException > ( ( ) => values . Where ( "it < -2B" ) ) ;
988
- }
989
-
990
899
[ Fact ]
991
900
public void ExpressionTests_LogicalAndOr ( )
992
901
{
@@ -1429,6 +1338,112 @@ public void ExpressionTests_Sum2()
1429
1338
Assert . Equal ( 6.0f , result2 ) ;
1430
1339
}
1431
1340
1341
+
1342
+ [ Fact ]
1343
+ public void ExpressionTests_Type_Integer ( )
1344
+ {
1345
+ // Arrange
1346
+ var qry = new [ ] { 1 , 2 , 3 , 4 , 5 , 6 } . AsQueryable ( ) ;
1347
+
1348
+ // Act
1349
+ var resultLessThan = qry . Where ( "it < 4" ) ;
1350
+ var resultLessThanEqual = qry . Where ( "it <= 4" ) ;
1351
+
1352
+ var resultGreaterThan = qry . Where ( "4 > it" ) ;
1353
+ var resultGreaterThanEqual = qry . Where ( "4 >= it" ) ;
1354
+
1355
+ var resultEqualItLeft = qry . Where ( "it = 5" ) ;
1356
+ var resultEqualItRight = qry . Where ( "5 = it" ) ;
1357
+
1358
+ var resultEqualIntParamLeft = qry . Where ( "@0 = it" , 5 ) ;
1359
+ var resultEqualIntParamRight = qry . Where ( "it = @0" , 5 ) ;
1360
+
1361
+ // Assert
1362
+ Check . That ( resultLessThan . ToArray ( ) ) . ContainsExactly ( 1 , 2 , 3 ) ;
1363
+ Check . That ( resultLessThanEqual . ToArray ( ) ) . ContainsExactly ( 1 , 2 , 3 , 4 ) ;
1364
+ Check . That ( resultGreaterThan . ToArray ( ) ) . ContainsExactly ( 1 , 2 , 3 ) ;
1365
+ Check . That ( resultGreaterThanEqual . ToArray ( ) ) . ContainsExactly ( 1 , 2 , 3 , 4 ) ;
1366
+
1367
+ Check . That ( resultEqualItLeft . Single ( ) ) . Equals ( 5 ) ;
1368
+ Check . That ( resultEqualItRight . Single ( ) ) . Equals ( 5 ) ;
1369
+
1370
+ Check . That ( resultEqualIntParamLeft . Single ( ) ) . Equals ( 5 ) ;
1371
+ Check . That ( resultEqualIntParamRight . Single ( ) ) . Equals ( 5 ) ;
1372
+ }
1373
+
1374
+ [ Fact ]
1375
+ public void ExpressionTests_Type_Integer_Qualifiers ( )
1376
+ {
1377
+ //Arrange
1378
+ var valuesL = new [ ] { 1L , 2L , 3L } . AsQueryable ( ) ;
1379
+ var resultValuesL = new [ ] { 2L , 3L } . AsQueryable ( ) ;
1380
+
1381
+ var valuesU = new [ ] { 1U , 2U , 3U } . AsQueryable ( ) ;
1382
+ var resultValuesU = new [ ] { 2U , 3U } . AsQueryable ( ) ;
1383
+
1384
+ var valuesUL = new [ ] { 1UL , 2UL , 3UL } . AsQueryable ( ) ;
1385
+ var resultValuesUL = new [ ] { 2UL , 3UL } . AsQueryable ( ) ;
1386
+
1387
+ //Act
1388
+ var resultL = valuesL . Where ( "it in (2L, 3L)" ) ;
1389
+ var resultU = valuesU . Where ( "it in (2U, 3U)" ) ;
1390
+ var resultUL = valuesUL . Where ( "it in (2UL, 3UL)" ) ;
1391
+
1392
+ //Assert
1393
+ Assert . Equal ( resultValuesL . ToArray ( ) , resultL . ToArray ( ) ) ;
1394
+ Assert . Equal ( resultValuesU . ToArray ( ) , resultU . ToArray ( ) ) ;
1395
+ Assert . Equal ( resultValuesUL . ToArray ( ) , resultUL . ToArray ( ) ) ;
1396
+ }
1397
+
1398
+ [ Fact ]
1399
+ public void ExpressionTests_Type_Integer_Qualifiers_Negative ( )
1400
+ {
1401
+ //Arrange
1402
+ var valuesL = new [ ] { - 1L , - 2L , - 3L } . AsQueryable ( ) ;
1403
+ var resultValuesL = new [ ] { - 2L , - 3L } . AsQueryable ( ) ;
1404
+
1405
+ //Act
1406
+ var resultL = valuesL . Where ( "it <= -2L" ) ;
1407
+ var resultIn = valuesL . Where ( "it in (-2L, -3L)" ) ;
1408
+
1409
+ //Assert
1410
+ Assert . Equal ( resultValuesL . ToArray ( ) , resultL ) ;
1411
+ Assert . Equal ( resultValuesL . ToArray ( ) , resultIn ) ;
1412
+ }
1413
+
1414
+ [ Fact ]
1415
+ public void ExpressionTests_Type_Integer_Qualifiers_Exceptions ( )
1416
+ {
1417
+ //Arrange
1418
+ var values = new [ ] { 1L , 2L , 3L } . AsQueryable ( ) ;
1419
+
1420
+ //Assert
1421
+ Assert . Throws < ParseException > ( ( ) => values . Where ( "it in (2LL)" ) ) ;
1422
+ Assert . Throws < ParseException > ( ( ) => values . Where ( "it in (2UU)" ) ) ;
1423
+ Assert . Throws < ParseException > ( ( ) => values . Where ( "it in (2LU)" ) ) ;
1424
+ Assert . Throws < ParseException > ( ( ) => values . Where ( "it in (2B)" ) ) ;
1425
+
1426
+ Assert . Throws < ParseException > ( ( ) => values . Where ( "it < -2LL" ) ) ;
1427
+ Assert . Throws < ParseException > ( ( ) => values . Where ( "it < -2UL" ) ) ;
1428
+ Assert . Throws < ParseException > ( ( ) => values . Where ( "it < -2UU" ) ) ;
1429
+ Assert . Throws < ParseException > ( ( ) => values . Where ( "it < -2LU" ) ) ;
1430
+ Assert . Throws < ParseException > ( ( ) => values . Where ( "it < -2B" ) ) ;
1431
+ }
1432
+
1433
+ [ Fact ]
1434
+ public void ExpressionTests_Type_Short ( )
1435
+ {
1436
+ // Arrange
1437
+ var qry = new short [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 } . AsQueryable ( ) ;
1438
+
1439
+ // Act
1440
+ var result = qry . Where ( "it in (1,2)" ) ;
1441
+ var resultExpected = qry . Where ( x => x == 1 || x == 2 ) ;
1442
+
1443
+ // Assert
1444
+ Check . That ( resultExpected . ToArray ( ) ) . ContainsExactly ( result . ToDynamicArray < short > ( ) ) ;
1445
+ }
1446
+
1432
1447
[ Fact ]
1433
1448
public void ExpressionTests_Uri ( )
1434
1449
{
0 commit comments