@@ -48,8 +48,8 @@ public async Task LikeFunctionWithEscapeCharacterAsync()
48
48
await ( session . FlushAsync ( ) ) ;
49
49
50
50
var query = await ( ( from e in db . Employees
51
- where NHibernate . Linq . SqlMethods . Like ( e . FirstName , employeeNameEscaped , escapeChar )
52
- select e ) . ToListAsync ( ) ) ;
51
+ where NHibernate . Linq . SqlMethods . Like ( e . FirstName , employeeNameEscaped , escapeChar )
52
+ select e ) . ToListAsync ( ) ) ;
53
53
54
54
Assert . That ( query . Count , Is . EqualTo ( 1 ) ) ;
55
55
Assert . That ( query [ 0 ] . FirstName , Is . EqualTo ( employeeName ) ) ;
@@ -93,8 +93,8 @@ where NHibernate.Test.Linq.FunctionTestsAsync.SqlMethods.Like(e.FirstName, "Ma%e
93
93
public async Task SubstringFunction2Async ( )
94
94
{
95
95
var query = await ( ( from e in db . Employees
96
- where e . FirstName . Substring ( 0 , 2 ) == "An"
97
- select e ) . ToListAsync ( ) ) ;
96
+ where e . FirstName . Substring ( 0 , 2 ) == "An"
97
+ select e ) . ToListAsync ( ) ) ;
98
98
99
99
Assert . That ( query . Count , Is . EqualTo ( 2 ) ) ;
100
100
}
@@ -103,8 +103,8 @@ where e.FirstName.Substring(0, 2) == "An"
103
103
public async Task SubstringFunction1Async ( )
104
104
{
105
105
var query = await ( ( from e in db . Employees
106
- where e . FirstName . Substring ( 3 ) == "rew"
107
- select e ) . ToListAsync ( ) ) ;
106
+ where e . FirstName . Substring ( 3 ) == "rew"
107
+ select e ) . ToListAsync ( ) ) ;
108
108
109
109
Assert . That ( query . Count , Is . EqualTo ( 1 ) ) ;
110
110
Assert . That ( query [ 0 ] . FirstName , Is . EqualTo ( "Andrew" ) ) ;
@@ -142,21 +142,21 @@ public async Task ReplaceFunctionAsync()
142
142
var query = from e in db . Employees
143
143
where e . FirstName . StartsWith ( "An" )
144
144
select new
145
- {
146
- Before = e . FirstName ,
147
- // This one call the standard string.Replace, not the extension. The linq registry handles it.
148
- AfterMethod = e . FirstName . Replace ( "An" , "Zan" ) ,
149
- AfterExtension = ExtensionMethods . Replace ( e . FirstName , "An" , "Zan" ) ,
150
- AfterNamedExtension = e . FirstName . ReplaceExtension ( "An" , "Zan" ) ,
151
- AfterEvaluableExtension = e . FirstName . ReplaceWithEvaluation ( "An" , "Zan" ) ,
152
- AfterEvaluable2Extension = e . FirstName . ReplaceWithEvaluation2 ( "An" , "Zan" ) ,
145
+ {
146
+ Before = e . FirstName ,
147
+ // This one call the standard string.Replace, not the extension. The linq registry handles it.
148
+ AfterMethod = e . FirstName . Replace ( "An" , "Zan" ) ,
149
+ AfterExtension = ExtensionMethods . Replace ( e . FirstName , "An" , "Zan" ) ,
150
+ AfterNamedExtension = e . FirstName . ReplaceExtension ( "An" , "Zan" ) ,
151
+ AfterEvaluableExtension = e . FirstName . ReplaceWithEvaluation ( "An" , "Zan" ) ,
152
+ AfterEvaluable2Extension = e . FirstName . ReplaceWithEvaluation2 ( "An" , "Zan" ) ,
153
153
BeforeConst = suppliedName ,
154
- // This one call the standard string.Replace, not the extension. The linq registry handles it.
155
- AfterMethodConst = suppliedName . Replace ( "An" , "Zan" ) ,
156
- AfterExtensionConst = ExtensionMethods . Replace ( suppliedName , "An" , "Zan" ) ,
157
- AfterNamedExtensionConst = suppliedName . ReplaceExtension ( "An" , "Zan" ) ,
158
- AfterEvaluableExtensionConst = suppliedName . ReplaceWithEvaluation ( "An" , "Zan" ) ,
159
- AfterEvaluable2ExtensionConst = suppliedName . ReplaceWithEvaluation2 ( "An" , "Zan" )
154
+ // This one call the standard string.Replace, not the extension. The linq registry handles it.
155
+ AfterMethodConst = suppliedName . Replace ( "An" , "Zan" ) ,
156
+ AfterExtensionConst = ExtensionMethods . Replace ( suppliedName , "An" , "Zan" ) ,
157
+ AfterNamedExtensionConst = suppliedName . ReplaceExtension ( "An" , "Zan" ) ,
158
+ AfterEvaluableExtensionConst = suppliedName . ReplaceWithEvaluation ( "An" , "Zan" ) ,
159
+ AfterEvaluable2ExtensionConst = suppliedName . ReplaceWithEvaluation2 ( "An" , "Zan" )
160
160
} ;
161
161
var results = await ( query . ToListAsync ( ) ) ;
162
162
var s = await ( ObjectDumper . WriteAsync ( results ) ) ;
@@ -183,12 +183,12 @@ where e.FirstName.StartsWith("An")
183
183
// Should cause ReplaceWithEvaluation to fail
184
184
suppliedName = null ;
185
185
var failingQuery = from e in db . Employees
186
- where e . FirstName . StartsWith ( "An" )
187
- select new
188
- {
189
- Before = e . FirstName ,
190
- AfterEvaluableExtensionConst = suppliedName . ReplaceWithEvaluation ( "An" , "Zan" )
191
- } ;
186
+ where e . FirstName . StartsWith ( "An" )
187
+ select new
188
+ {
189
+ Before = e . FirstName ,
190
+ AfterEvaluableExtensionConst = suppliedName . ReplaceWithEvaluation ( "An" , "Zan" )
191
+ } ;
192
192
Assert . That ( ( ) => failingQuery . ToListAsync ( ) , Throws . InstanceOf < HibernateException > ( ) . And . InnerException . InstanceOf < ArgumentNullException > ( ) ) ;
193
193
}
194
194
@@ -260,7 +260,7 @@ where lowerName.Contains("a")
260
260
public async Task TwoFunctionExpressionAsync ( )
261
261
{
262
262
var query = from e in db . Employees
263
- where e . FirstName . IndexOf ( "A" ) == e . BirthDate . Value . Month
263
+ where e . FirstName . IndexOf ( "A" ) == e . BirthDate . Value . Month
264
264
select e . FirstName ;
265
265
266
266
await ( ObjectDumper . WriteAsync ( query ) ) ;
@@ -297,9 +297,9 @@ public async Task TrimAsync()
297
297
{
298
298
using ( session . BeginTransaction ( ) )
299
299
{
300
- AnotherEntity ae1 = new AnotherEntity { Input = " hi " } ;
301
- AnotherEntity ae2 = new AnotherEntity { Input = "hi" } ;
302
- AnotherEntity ae3 = new AnotherEntity { Input = "heh" } ;
300
+ AnotherEntity ae1 = new AnotherEntity { Input = " hi " } ;
301
+ AnotherEntity ae2 = new AnotherEntity { Input = "hi" } ;
302
+ AnotherEntity ae3 = new AnotherEntity { Input = "heh" } ;
303
303
await ( session . SaveAsync ( ae1 ) ) ;
304
304
await ( session . SaveAsync ( ae2 ) ) ;
305
305
await ( session . SaveAsync ( ae3 ) ) ;
@@ -315,7 +315,7 @@ public async Task TrimAsync()
315
315
316
316
// Check when passed as array
317
317
// (the single character parameter is a new overload in .netcoreapp2.0, but not net461 or .netstandard2.0).
318
- Assert . AreEqual ( 1 , await ( session . Query < AnotherEntity > ( ) . CountAsync ( e => e . Input . Trim ( new [ ] { 'h' } ) == "e" ) ) ) ;
318
+ Assert . AreEqual ( 1 , await ( session . Query < AnotherEntity > ( ) . CountAsync ( e => e . Input . Trim ( new [ ] { 'h' } ) == "e" ) ) ) ;
319
319
Assert . AreEqual ( 1 , await ( session . Query < AnotherEntity > ( ) . CountAsync ( e => e . Input . TrimStart ( new [ ] { 'h' } ) == "eh" ) ) ) ;
320
320
Assert . AreEqual ( 1 , await ( session . Query < AnotherEntity > ( ) . CountAsync ( e => e . Input . TrimEnd ( new [ ] { 'h' } ) == "he" ) ) ) ;
321
321
@@ -328,9 +328,9 @@ public async Task TrimInitialWhitespaceAsync()
328
328
{
329
329
using ( session . BeginTransaction ( ) )
330
330
{
331
- await ( session . SaveAsync ( new AnotherEntity { Input = " hi" } ) ) ;
332
- await ( session . SaveAsync ( new AnotherEntity { Input = "hi" } ) ) ;
333
- await ( session . SaveAsync ( new AnotherEntity { Input = "heh" } ) ) ;
331
+ await ( session . SaveAsync ( new AnotherEntity { Input = " hi" } ) ) ;
332
+ await ( session . SaveAsync ( new AnotherEntity { Input = "hi" } ) ) ;
333
+ await ( session . SaveAsync ( new AnotherEntity { Input = "heh" } ) ) ;
334
334
await ( session . FlushAsync ( ) ) ;
335
335
336
336
Assert . That ( await ( session . Query < AnotherEntity > ( ) . CountAsync ( e => e . Input . TrimStart ( ) == "hi" ) ) , Is . EqualTo ( 2 ) ) ;
@@ -373,7 +373,7 @@ public async Task WhereBoolConstantEqualAsync()
373
373
var query = from item in db . Role
374
374
where item . IsActive . Equals ( true )
375
375
select item ;
376
-
376
+
377
377
await ( ObjectDumper . WriteAsync ( query ) ) ;
378
378
}
379
379
@@ -383,7 +383,7 @@ public async Task WhereBoolConditionEqualsAsync()
383
383
var query = from item in db . Role
384
384
where item . IsActive . Equals ( item . Name != null )
385
385
select item ;
386
-
386
+
387
387
await ( ObjectDumper . WriteAsync ( query ) ) ;
388
388
}
389
389
@@ -393,7 +393,7 @@ public async Task WhereBoolParameterEqualAsync()
393
393
var query = from item in db . Role
394
394
where item . IsActive . Equals ( 1 == 1 )
395
395
select item ;
396
-
396
+
397
397
await ( ObjectDumper . WriteAsync ( query ) ) ;
398
398
}
399
399
@@ -413,8 +413,8 @@ where item.IsActive.Equals(f())
413
413
public async Task WhereLongEqualAsync ( )
414
414
{
415
415
var query = from item in db . PatientRecords
416
- where item . Id . Equals ( - 1 )
417
- select item ;
416
+ where item . Id . Equals ( - 1 )
417
+ select item ;
418
418
419
419
await ( ObjectDumper . WriteAsync ( query ) ) ;
420
420
}
@@ -428,7 +428,7 @@ where item.RegisteredAt.Equals(DateTime.Today)
428
428
429
429
await ( ObjectDumper . WriteAsync ( query ) ) ;
430
430
}
431
-
431
+
432
432
[ Test ]
433
433
public async Task WhereGuidEqualAsync ( )
434
434
{
@@ -437,7 +437,7 @@ where item.Reference.Equals(Guid.Empty)
437
437
select item ;
438
438
439
439
await ( ObjectDumper . WriteAsync ( query ) ) ;
440
- }
440
+ }
441
441
442
442
[ Test ]
443
443
public async Task WhereDoubleEqualAsync ( )
@@ -447,7 +447,7 @@ where item.BodyWeight.Equals(-1)
447
447
select item ;
448
448
449
449
await ( ObjectDumper . WriteAsync ( query ) ) ;
450
- }
450
+ }
451
451
452
452
[ Test ]
453
453
public async Task WhereDecimalEqualAsync ( )
@@ -467,14 +467,20 @@ where item.Gender.Equals(Gender.Female)
467
467
select item ;
468
468
469
469
await ( ObjectDumper . WriteAsync ( query ) ) ;
470
+
471
+ query = from item in db . PatientRecords
472
+ where item . Gender . Equals ( item . Gender )
473
+ select item ;
474
+
475
+ await ( ObjectDumper . WriteAsync ( query ) ) ;
470
476
}
471
477
472
478
[ Test ]
473
479
public async Task WhereEquatableEqualAsync ( )
474
480
{
475
481
var query = from item in db . Shippers
476
- where ( ( IEquatable < Guid > ) item . Reference ) . Equals ( Guid . Empty )
477
- select item ;
482
+ where ( ( IEquatable < Guid > ) item . Reference ) . Equals ( Guid . Empty )
483
+ select item ;
478
484
479
485
await ( ObjectDumper . WriteAsync ( query ) ) ;
480
486
}
0 commit comments