@@ -36,8 +36,8 @@ public void LikeFunctionWithEscapeCharacter()
36
36
session . Flush ( ) ;
37
37
38
38
var query = ( from e in db . Employees
39
- where NHibernate . Linq . SqlMethods . Like ( e . FirstName , employeeNameEscaped , escapeChar )
40
- select e ) . ToList ( ) ;
39
+ where NHibernate . Linq . SqlMethods . Like ( e . FirstName , employeeNameEscaped , escapeChar )
40
+ select e ) . ToList ( ) ;
41
41
42
42
Assert . That ( query . Count , Is . EqualTo ( 1 ) ) ;
43
43
Assert . That ( query [ 0 ] . FirstName , Is . EqualTo ( employeeName ) ) ;
@@ -81,8 +81,8 @@ where NHibernate.Test.Linq.FunctionTests.SqlMethods.Like(e.FirstName, "Ma%et")
81
81
public void SubstringFunction2 ( )
82
82
{
83
83
var query = ( from e in db . Employees
84
- where e . FirstName . Substring ( 0 , 2 ) == "An"
85
- select e ) . ToList ( ) ;
84
+ where e . FirstName . Substring ( 0 , 2 ) == "An"
85
+ select e ) . ToList ( ) ;
86
86
87
87
Assert . That ( query . Count , Is . EqualTo ( 2 ) ) ;
88
88
}
@@ -91,8 +91,8 @@ where e.FirstName.Substring(0, 2) == "An"
91
91
public void SubstringFunction1 ( )
92
92
{
93
93
var query = ( from e in db . Employees
94
- where e . FirstName . Substring ( 3 ) == "rew"
95
- select e ) . ToList ( ) ;
94
+ where e . FirstName . Substring ( 3 ) == "rew"
95
+ select e ) . ToList ( ) ;
96
96
97
97
Assert . That ( query . Count , Is . EqualTo ( 1 ) ) ;
98
98
Assert . That ( query [ 0 ] . FirstName , Is . EqualTo ( "Andrew" ) ) ;
@@ -130,21 +130,21 @@ public void ReplaceFunction()
130
130
var query = from e in db . Employees
131
131
where e . FirstName . StartsWith ( "An" )
132
132
select new
133
- {
134
- Before = e . FirstName ,
135
- // This one call the standard string.Replace, not the extension. The linq registry handles it.
136
- AfterMethod = e . FirstName . Replace ( "An" , "Zan" ) ,
137
- AfterExtension = ExtensionMethods . Replace ( e . FirstName , "An" , "Zan" ) ,
138
- AfterNamedExtension = e . FirstName . ReplaceExtension ( "An" , "Zan" ) ,
139
- AfterEvaluableExtension = e . FirstName . ReplaceWithEvaluation ( "An" , "Zan" ) ,
140
- AfterEvaluable2Extension = e . FirstName . ReplaceWithEvaluation2 ( "An" , "Zan" ) ,
133
+ {
134
+ Before = e . FirstName ,
135
+ // This one call the standard string.Replace, not the extension. The linq registry handles it.
136
+ AfterMethod = e . FirstName . Replace ( "An" , "Zan" ) ,
137
+ AfterExtension = ExtensionMethods . Replace ( e . FirstName , "An" , "Zan" ) ,
138
+ AfterNamedExtension = e . FirstName . ReplaceExtension ( "An" , "Zan" ) ,
139
+ AfterEvaluableExtension = e . FirstName . ReplaceWithEvaluation ( "An" , "Zan" ) ,
140
+ AfterEvaluable2Extension = e . FirstName . ReplaceWithEvaluation2 ( "An" , "Zan" ) ,
141
141
BeforeConst = suppliedName ,
142
- // This one call the standard string.Replace, not the extension. The linq registry handles it.
143
- AfterMethodConst = suppliedName . Replace ( "An" , "Zan" ) ,
144
- AfterExtensionConst = ExtensionMethods . Replace ( suppliedName , "An" , "Zan" ) ,
145
- AfterNamedExtensionConst = suppliedName . ReplaceExtension ( "An" , "Zan" ) ,
146
- AfterEvaluableExtensionConst = suppliedName . ReplaceWithEvaluation ( "An" , "Zan" ) ,
147
- AfterEvaluable2ExtensionConst = suppliedName . ReplaceWithEvaluation2 ( "An" , "Zan" )
142
+ // This one call the standard string.Replace, not the extension. The linq registry handles it.
143
+ AfterMethodConst = suppliedName . Replace ( "An" , "Zan" ) ,
144
+ AfterExtensionConst = ExtensionMethods . Replace ( suppliedName , "An" , "Zan" ) ,
145
+ AfterNamedExtensionConst = suppliedName . ReplaceExtension ( "An" , "Zan" ) ,
146
+ AfterEvaluableExtensionConst = suppliedName . ReplaceWithEvaluation ( "An" , "Zan" ) ,
147
+ AfterEvaluable2ExtensionConst = suppliedName . ReplaceWithEvaluation2 ( "An" , "Zan" )
148
148
} ;
149
149
var results = query . ToList ( ) ;
150
150
var s = ObjectDumper . Write ( results ) ;
@@ -171,12 +171,12 @@ where e.FirstName.StartsWith("An")
171
171
// Should cause ReplaceWithEvaluation to fail
172
172
suppliedName = null ;
173
173
var failingQuery = from e in db . Employees
174
- where e . FirstName . StartsWith ( "An" )
175
- select new
176
- {
177
- Before = e . FirstName ,
178
- AfterEvaluableExtensionConst = suppliedName . ReplaceWithEvaluation ( "An" , "Zan" )
179
- } ;
174
+ where e . FirstName . StartsWith ( "An" )
175
+ select new
176
+ {
177
+ Before = e . FirstName ,
178
+ AfterEvaluableExtensionConst = suppliedName . ReplaceWithEvaluation ( "An" , "Zan" )
179
+ } ;
180
180
Assert . That ( ( ) => failingQuery . ToList ( ) , Throws . InstanceOf < HibernateException > ( ) . And . InnerException . InstanceOf < ArgumentNullException > ( ) ) ;
181
181
}
182
182
@@ -248,7 +248,7 @@ where lowerName.Contains("a")
248
248
public void TwoFunctionExpression ( )
249
249
{
250
250
var query = from e in db . Employees
251
- where e . FirstName . IndexOf ( "A" ) == e . BirthDate . Value . Month
251
+ where e . FirstName . IndexOf ( "A" ) == e . BirthDate . Value . Month
252
252
select e . FirstName ;
253
253
254
254
ObjectDumper . Write ( query ) ;
@@ -285,9 +285,9 @@ public void Trim()
285
285
{
286
286
using ( session . BeginTransaction ( ) )
287
287
{
288
- AnotherEntity ae1 = new AnotherEntity { Input = " hi " } ;
289
- AnotherEntity ae2 = new AnotherEntity { Input = "hi" } ;
290
- AnotherEntity ae3 = new AnotherEntity { Input = "heh" } ;
288
+ AnotherEntity ae1 = new AnotherEntity { Input = " hi " } ;
289
+ AnotherEntity ae2 = new AnotherEntity { Input = "hi" } ;
290
+ AnotherEntity ae3 = new AnotherEntity { Input = "heh" } ;
291
291
session . Save ( ae1 ) ;
292
292
session . Save ( ae2 ) ;
293
293
session . Save ( ae3 ) ;
@@ -303,7 +303,7 @@ public void Trim()
303
303
304
304
// Check when passed as array
305
305
// (the single character parameter is a new overload in .netcoreapp2.0, but not net461 or .netstandard2.0).
306
- Assert . AreEqual ( 1 , session . Query < AnotherEntity > ( ) . Count ( e => e . Input . Trim ( new [ ] { 'h' } ) == "e" ) ) ;
306
+ Assert . AreEqual ( 1 , session . Query < AnotherEntity > ( ) . Count ( e => e . Input . Trim ( new [ ] { 'h' } ) == "e" ) ) ;
307
307
Assert . AreEqual ( 1 , session . Query < AnotherEntity > ( ) . Count ( e => e . Input . TrimStart ( new [ ] { 'h' } ) == "eh" ) ) ;
308
308
Assert . AreEqual ( 1 , session . Query < AnotherEntity > ( ) . Count ( e => e . Input . TrimEnd ( new [ ] { 'h' } ) == "he" ) ) ;
309
309
@@ -316,9 +316,9 @@ public void TrimInitialWhitespace()
316
316
{
317
317
using ( session . BeginTransaction ( ) )
318
318
{
319
- session . Save ( new AnotherEntity { Input = " hi" } ) ;
320
- session . Save ( new AnotherEntity { Input = "hi" } ) ;
321
- session . Save ( new AnotherEntity { Input = "heh" } ) ;
319
+ session . Save ( new AnotherEntity { Input = " hi" } ) ;
320
+ session . Save ( new AnotherEntity { Input = "hi" } ) ;
321
+ session . Save ( new AnotherEntity { Input = "heh" } ) ;
322
322
session . Flush ( ) ;
323
323
324
324
Assert . That ( session . Query < AnotherEntity > ( ) . Count ( e => e . Input . TrimStart ( ) == "hi" ) , Is . EqualTo ( 2 ) ) ;
@@ -372,7 +372,7 @@ public void WhereBoolConstantEqual()
372
372
var query = from item in db . Role
373
373
where item . IsActive . Equals ( true )
374
374
select item ;
375
-
375
+
376
376
ObjectDumper . Write ( query ) ;
377
377
}
378
378
@@ -382,7 +382,7 @@ public void WhereBoolConditionEquals()
382
382
var query = from item in db . Role
383
383
where item . IsActive . Equals ( item . Name != null )
384
384
select item ;
385
-
385
+
386
386
ObjectDumper . Write ( query ) ;
387
387
}
388
388
@@ -392,7 +392,7 @@ public void WhereBoolParameterEqual()
392
392
var query = from item in db . Role
393
393
where item . IsActive . Equals ( 1 == 1 )
394
394
select item ;
395
-
395
+
396
396
ObjectDumper . Write ( query ) ;
397
397
}
398
398
@@ -412,8 +412,8 @@ where item.IsActive.Equals(f())
412
412
public void WhereLongEqual ( )
413
413
{
414
414
var query = from item in db . PatientRecords
415
- where item . Id . Equals ( - 1 )
416
- select item ;
415
+ where item . Id . Equals ( - 1 )
416
+ select item ;
417
417
418
418
ObjectDumper . Write ( query ) ;
419
419
}
@@ -427,7 +427,7 @@ where item.RegisteredAt.Equals(DateTime.Today)
427
427
428
428
ObjectDumper . Write ( query ) ;
429
429
}
430
-
430
+
431
431
[ Test ]
432
432
public void WhereGuidEqual ( )
433
433
{
@@ -436,7 +436,7 @@ where item.Reference.Equals(Guid.Empty)
436
436
select item ;
437
437
438
438
ObjectDumper . Write ( query ) ;
439
- }
439
+ }
440
440
441
441
[ Test ]
442
442
public void WhereDoubleEqual ( )
@@ -446,8 +446,8 @@ where item.BodyWeight.Equals(-1)
446
446
select item ;
447
447
448
448
ObjectDumper . Write ( query ) ;
449
- }
450
-
449
+ }
450
+
451
451
[ Test ]
452
452
[ Ignore ( "Not mapped entity" ) ]
453
453
public void WhereFloatEqual ( )
@@ -457,7 +457,7 @@ where item.Float.Equals(-1)
457
457
select item ;
458
458
459
459
ObjectDumper . Write ( query ) ;
460
- }
460
+ }
461
461
462
462
[ Test ]
463
463
[ Ignore ( "Not mapped entity" ) ]
@@ -522,8 +522,8 @@ public void WhereObjectEqual()
522
522
public void WhereEquatableEqual ( )
523
523
{
524
524
var query = from item in db . Shippers
525
- where ( ( IEquatable < Guid > ) item . Reference ) . Equals ( Guid . Empty )
526
- select item ;
525
+ where ( ( IEquatable < Guid > ) item . Reference ) . Equals ( Guid . Empty )
526
+ select item ;
527
527
528
528
ObjectDumper . Write ( query ) ;
529
529
}
0 commit comments