Skip to content

Commit 7b35e7a

Browse files
committed
More tests
1 parent 234486d commit 7b35e7a

File tree

1 file changed

+68
-38
lines changed

1 file changed

+68
-38
lines changed

Orm/Xtensive.Orm.Tests/Linq/CompiledQueriesClosureCachingTest.cs

Lines changed: 68 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ protected override DomainConfiguration BuildConfiguration()
173173
protected override void CheckRequirements() => Require.ProviderIsNot(StorageProvider.Sqlite);
174174

175175
[Test]
176-
public void CachingClosureWithBoolean()
176+
public void BooleanTest()
177177
{
178178
var countBefore = Domain.QueryCache.Count;
179179

@@ -189,7 +189,7 @@ public void CachingClosureWithBoolean()
189189
}
190190

191191
[Test]
192-
public async Task CachingClosureWithBooleanAsync()
192+
public async Task BooleanTestAsync()
193193
{
194194
var countBefore = Domain.QueryCache.Count;
195195

@@ -205,7 +205,7 @@ public async Task CachingClosureWithBooleanAsync()
205205
}
206206

207207
[Test]
208-
public void CachingClosureWithByte()
208+
public void ByteTest()
209209
{
210210
var countBefore = Domain.QueryCache.Count;
211211

@@ -221,7 +221,7 @@ public void CachingClosureWithByte()
221221
}
222222

223223
[Test]
224-
public async Task CachingClosureWithByteAsync()
224+
public async Task ByteTestAsync()
225225
{
226226
var countBefore = Domain.QueryCache.Count;
227227

@@ -237,7 +237,7 @@ public async Task CachingClosureWithByteAsync()
237237
}
238238

239239
[Test]
240-
public void CachingClosureWithSByte()
240+
public void SByteTest()
241241
{
242242
var countBefore = Domain.QueryCache.Count;
243243

@@ -253,7 +253,7 @@ public void CachingClosureWithSByte()
253253
}
254254

255255
[Test]
256-
public async Task CachingClosureWithSByteAsync()
256+
public async Task SByteTestAsync()
257257
{
258258
var countBefore = Domain.QueryCache.Count;
259259

@@ -269,7 +269,7 @@ public async Task CachingClosureWithSByteAsync()
269269
}
270270

271271
[Test]
272-
public void CachingClosureWithInt16()
272+
public void Int16Test()
273273
{
274274
var countBefore = Domain.QueryCache.Count;
275275

@@ -285,7 +285,7 @@ public void CachingClosureWithInt16()
285285
}
286286

287287
[Test]
288-
public async Task CachingClosureWithInt16Async()
288+
public async Task Int16TestAsync()
289289
{
290290
var countBefore = Domain.QueryCache.Count;
291291

@@ -301,7 +301,7 @@ public async Task CachingClosureWithInt16Async()
301301
}
302302

303303
[Test]
304-
public void CachingClosureWithUInt16()
304+
public void UInt16Test()
305305
{
306306
var countBefore = Domain.QueryCache.Count;
307307

@@ -317,7 +317,7 @@ public void CachingClosureWithUInt16()
317317
}
318318

319319
[Test]
320-
public async Task CachingClosureWithUInt16Async()
320+
public async Task UInt16TestAsync()
321321
{
322322
var countBefore = Domain.QueryCache.Count;
323323

@@ -333,7 +333,7 @@ public async Task CachingClosureWithUInt16Async()
333333
}
334334

335335
[Test]
336-
public void CachingClosureWithInt32()
336+
public void Int32Test()
337337
{
338338
var countBefore = Domain.QueryCache.Count;
339339

@@ -349,7 +349,7 @@ public void CachingClosureWithInt32()
349349
}
350350

351351
[Test]
352-
public async Task CachingClosureWithInt32Async()
352+
public async Task Int32TestAsync()
353353
{
354354
var countBefore = Domain.QueryCache.Count;
355355

@@ -365,7 +365,7 @@ public async Task CachingClosureWithInt32Async()
365365
}
366366

367367
[Test]
368-
public void CachingClosureWithUInt32()
368+
public void UInt32Test()
369369
{
370370
var countBefore = Domain.QueryCache.Count;
371371

@@ -381,7 +381,7 @@ public void CachingClosureWithUInt32()
381381
}
382382

383383
[Test]
384-
public async Task CachingClosureWithUInt32Async()
384+
public async Task UInt32TestAsync()
385385
{
386386
var countBefore = Domain.QueryCache.Count;
387387

@@ -397,7 +397,7 @@ public async Task CachingClosureWithUInt32Async()
397397
}
398398

399399
[Test]
400-
public void CachingClosureWithInt64()
400+
public void Int64Test()
401401
{
402402
var countBefore = Domain.QueryCache.Count;
403403

@@ -413,7 +413,7 @@ public void CachingClosureWithInt64()
413413
}
414414

415415
[Test]
416-
public async Task CachingClosureWithInt64Async()
416+
public async Task Int64TestAsync()
417417
{
418418
var countBefore = Domain.QueryCache.Count;
419419

@@ -429,7 +429,7 @@ public async Task CachingClosureWithInt64Async()
429429
}
430430

431431
[Test]
432-
public void CachingClosureWithUInt64()
432+
public void UInt64Test()
433433
{
434434
var countBefore = Domain.QueryCache.Count;
435435

@@ -445,7 +445,7 @@ public void CachingClosureWithUInt64()
445445
}
446446

447447
[Test]
448-
public async Task CachingClosureWithUInt64Async()
448+
public async Task UInt64TestAsync()
449449
{
450450
var countBefore = Domain.QueryCache.Count;
451451

@@ -461,7 +461,7 @@ public async Task CachingClosureWithUInt64Async()
461461
}
462462

463463
[Test]
464-
public void CachingClosureWithSingle()
464+
public void SingleTest()
465465
{
466466
var countBefore = Domain.QueryCache.Count;
467467

@@ -477,7 +477,7 @@ public void CachingClosureWithSingle()
477477
}
478478

479479
[Test]
480-
public async Task CachingClosureWithSingleAsync()
480+
public async Task SingleTestAsync()
481481
{
482482
var countBefore = Domain.QueryCache.Count;
483483

@@ -493,7 +493,7 @@ public async Task CachingClosureWithSingleAsync()
493493
}
494494

495495
[Test]
496-
public void CachingClosureWithDouble()
496+
public void DoubleTest()
497497
{
498498
var countBefore = Domain.QueryCache.Count;
499499

@@ -509,7 +509,7 @@ public void CachingClosureWithDouble()
509509
}
510510

511511
[Test]
512-
public async Task CachingClosureWithDoubleAsync()
512+
public async Task DoubleTestAsync()
513513
{
514514
var countBefore = Domain.QueryCache.Count;
515515

@@ -525,7 +525,7 @@ public async Task CachingClosureWithDoubleAsync()
525525
}
526526

527527
[Test]
528-
public void CachingClosureWithDecimal()
528+
public void DecimalTest()
529529
{
530530
var countBefore = Domain.QueryCache.Count;
531531

@@ -541,7 +541,7 @@ public void CachingClosureWithDecimal()
541541
}
542542

543543
[Test]
544-
public async Task CachingClosureWithDecimalAsync()
544+
public async Task DecimalTestAsync()
545545
{
546546
var countBefore = Domain.QueryCache.Count;
547547

@@ -557,7 +557,7 @@ public async Task CachingClosureWithDecimalAsync()
557557
}
558558

559559
[Test]
560-
public void CachingClosureWithChar()
560+
public void CharTest()
561561
{
562562
var countBefore = Domain.QueryCache.Count;
563563

@@ -573,7 +573,7 @@ public void CachingClosureWithChar()
573573
}
574574

575575
[Test]
576-
public async Task CachingClosureWithCharAsync()
576+
public async Task CharTestAsync()
577577
{
578578
var countBefore = Domain.QueryCache.Count;
579579

@@ -589,7 +589,7 @@ public async Task CachingClosureWithCharAsync()
589589
}
590590

591591
[Test]
592-
public void CachingClosureWithString()
592+
public void StringTest()
593593
{
594594
var countBefore = Domain.QueryCache.Count;
595595

@@ -601,7 +601,7 @@ public void CachingClosureWithString()
601601
}
602602

603603
[Test]
604-
public async Task CachingClosureWithStringAsync()
604+
public async Task StringTestAsync()
605605
{
606606
var countBefore = Domain.QueryCache.Count;
607607

@@ -613,7 +613,7 @@ public async Task CachingClosureWithStringAsync()
613613
}
614614

615615
[Test]
616-
public void CachingClosureWithDateTime()
616+
public void DateTimeTest()
617617
{
618618
var countBefore = Domain.QueryCache.Count;
619619

@@ -629,7 +629,7 @@ public void CachingClosureWithDateTime()
629629
}
630630

631631
[Test]
632-
public async Task CachingClosureWithDateTimeAsync()
632+
public async Task DateTimeAsync()
633633
{
634634
var countBefore = Domain.QueryCache.Count;
635635

@@ -645,7 +645,7 @@ public async Task CachingClosureWithDateTimeAsync()
645645
}
646646

647647
[Test]
648-
public void CachingClosureWithTimeSpan()
648+
public void TimeSpanTest()
649649
{
650650
var countBefore = Domain.QueryCache.Count;
651651

@@ -661,7 +661,7 @@ public void CachingClosureWithTimeSpan()
661661
}
662662

663663
[Test]
664-
public async Task CachingClosureWithTimeSpanAsync()
664+
public async Task TimeSpanTestAsync()
665665
{
666666
var countBefore = Domain.QueryCache.Count;
667667

@@ -677,7 +677,7 @@ public async Task CachingClosureWithTimeSpanAsync()
677677
}
678678

679679
[Test]
680-
public void CachingClosureWithGuid()
680+
public void GuidTest()
681681
{
682682
var countBefore = Domain.QueryCache.Count;
683683

@@ -693,7 +693,7 @@ public void CachingClosureWithGuid()
693693
}
694694

695695
[Test]
696-
public async Task CachingClosureWithGuidAsync()
696+
public async Task GuidTestAsync()
697697
{
698698
var countBefore = Domain.QueryCache.Count;
699699

@@ -709,7 +709,7 @@ public async Task CachingClosureWithGuidAsync()
709709
}
710710

711711
[Test]
712-
public void CachingClosureWithDateTimeOffset()
712+
public void DateTimeOffsetTest()
713713
{
714714
Require.AllFeaturesSupported(Providers.ProviderFeatures.DateTimeOffset);
715715

@@ -727,7 +727,7 @@ public void CachingClosureWithDateTimeOffset()
727727
}
728728

729729
[Test]
730-
public async Task CachingClosureWithDateTimeOffsetAsync()
730+
public async Task DateTimeOffsetTestAsync()
731731
{
732732
Require.AllFeaturesSupported(Providers.ProviderFeatures.DateTimeOffset);
733733

@@ -746,7 +746,7 @@ public async Task CachingClosureWithDateTimeOffsetAsync()
746746

747747

748748
[Test]
749-
public void CachingClosureWithPgSqlTypes()
749+
public void PgSqlTypesTest()
750750
{
751751
Require.ProviderIs(StorageProvider.PostgreSql);
752752

@@ -764,7 +764,7 @@ public void CachingClosureWithPgSqlTypes()
764764
}
765765

766766
[Test]
767-
public async Task CachingClosureWithPgSqlTypesAsync()
767+
public async Task PgSqlTypesTestAsync()
768768
{
769769
Require.ProviderIs(StorageProvider.PostgreSql);
770770

@@ -781,6 +781,30 @@ public async Task CachingClosureWithPgSqlTypesAsync()
781781
Assert.That(Domain.QueryCache.Count, Is.EqualTo(countBefore + 2));
782782
}
783783

784+
[Test]
785+
public void ValueTupleTest()
786+
{
787+
var countBefore = Domain.QueryCache.Count;
788+
789+
using var session = Domain.OpenSession();
790+
using var tx = session.OpenTransaction();
791+
Query(session, (1, 1.2f));
792+
793+
Assert.That(Domain.QueryCache.Count, Is.EqualTo(countBefore + 1));
794+
}
795+
796+
[Test]
797+
public async Task ValueTupleTestAsync()
798+
{
799+
var countBefore = Domain.QueryCache.Count;
800+
801+
await using var session = await Domain.OpenSessionAsync();
802+
await using var tx = await session.OpenTransactionAsync();
803+
await QueryAsync(session, (1, 1.2f));
804+
805+
Assert.That(Domain.QueryCache.Count, Is.EqualTo(countBefore + 1));
806+
}
807+
784808
#region General types
785809

786810
private void Query(Session session, bool value) =>
@@ -981,6 +1005,12 @@ private void Query(Session session, Guid? value) =>
9811005
private async Task QueryAsync(Session session, Guid? value) =>
9821006
_ = await session.Query.ExecuteAsync(q => q.All<AllTypesNeverCreatedEntity>().Where(e => e.FNGuid == value));
9831007

1008+
private void Query(Session session, (int value1, float value2) value) =>
1009+
_ = session.Query.Execute(q => q.All<AllTypesNeverCreatedEntity>().Where(e => e.FInt == value.value1 || e.FFloat == value.value2));
1010+
1011+
private async Task QueryAsync(Session session, (int value1, float value2) value) =>
1012+
_ = await session.Query.ExecuteAsync(q => q.All<AllTypesNeverCreatedEntity>().Where(e => e.FInt == value.value1 || e.FFloat == value.value2));
1013+
9841014
#endregion
9851015

9861016
#region Provider-specific types

0 commit comments

Comments
 (0)