|
12 | 12 | using NHibernate.Linq; |
13 | 13 | using NUnit.Framework; |
14 | 14 |
|
15 | | -namespace NHibernate.Test.NHSpecificTest.GH3288; |
16 | | -using System.Threading.Tasks; |
17 | | - |
18 | | -[TestFixture] |
19 | | -public class FetchAndCollectionJoinFixtureAsync : BugTestCase |
| 15 | +namespace NHibernate.Test.NHSpecificTest.GH3288 |
20 | 16 | { |
21 | | - protected override void OnSetUp() |
| 17 | + using System.Threading.Tasks; |
| 18 | + [TestFixture] |
| 19 | + public class FetchAndCollectionJoinFixtureAsync : BugTestCase |
22 | 20 | { |
23 | | - using var session = OpenSession(); |
24 | | - using var transaction = session.BeginTransaction(); |
25 | | - var middleEntity = new MiddleEntity(); |
26 | | - middleEntity.Components.Add(new Component { MiddleEntity = middleEntity, Value = 1 }); |
27 | | - var te = new TopEntity |
| 21 | + protected override void OnSetUp() |
28 | 22 | { |
29 | | - MiddleEntity = middleEntity |
30 | | - }; |
31 | | - session.Save(middleEntity); |
32 | | - session.Save(te); |
33 | | - |
34 | | - transaction.Commit(); |
35 | | - } |
36 | | - |
37 | | - protected override void OnTearDown() |
38 | | - { |
39 | | - using var session = OpenSession(); |
40 | | - using var transaction = session.BeginTransaction(); |
41 | | - session.Delete("from System.Object"); |
| 23 | + using var session = OpenSession(); |
| 24 | + using var transaction = session.BeginTransaction(); |
| 25 | + var middleEntity = new MiddleEntity(); |
| 26 | + middleEntity.Components.Add(new Component { MiddleEntity = middleEntity, Value = 1 }); |
| 27 | + var te = new TopEntity |
| 28 | + { |
| 29 | + MiddleEntity = middleEntity |
| 30 | + }; |
| 31 | + session.Save(middleEntity); |
| 32 | + session.Save(te); |
| 33 | + |
| 34 | + transaction.Commit(); |
| 35 | + } |
| 36 | + |
| 37 | + protected override void OnTearDown() |
| 38 | + { |
| 39 | + using var session = OpenSession(); |
| 40 | + using var transaction = session.BeginTransaction(); |
| 41 | + session.Delete("from System.Object"); |
42 | 42 |
|
43 | | - transaction.Commit(); |
44 | | - } |
| 43 | + transaction.Commit(); |
| 44 | + } |
45 | 45 |
|
46 | | - [Test] |
47 | | - public async Task ReuseEntityJoinWithCollectionJoinAsync() |
48 | | - { |
49 | | - using var session = OpenSession(); |
50 | | - |
51 | | - var entities = await (session.Query<TopEntity>() |
52 | | - .Fetch(e => e.MiddleEntity) |
53 | | - .Where(e => e.MiddleEntity.Components.Any(e => e.Value != 0)) |
54 | | - .ToListAsync()); |
55 | | - Assert.That(entities.Count, Is.EqualTo(1)); |
| 46 | + [Test] |
| 47 | + public async Task ReuseEntityJoinWithCollectionJoinAsync() |
| 48 | + { |
| 49 | + using var session = OpenSession(); |
| 50 | + |
| 51 | + var entities = await (session.Query<TopEntity>() |
| 52 | + .Fetch(e => e.MiddleEntity) |
| 53 | + .Where(e => e.MiddleEntity.Components.Any(e => e.Value != 0)) |
| 54 | + .ToListAsync()); |
| 55 | + Assert.That(entities.Count, Is.EqualTo(1)); |
| 56 | + } |
56 | 57 | } |
57 | 58 | } |
0 commit comments