Skip to content

Commit b63f573

Browse files
Generate async files
1 parent 8bf5da4 commit b63f573

File tree

1 file changed

+27
-20
lines changed
  • src/NHibernate.Test/Async/NHSpecificTest/GH3306NullableEntityCorrelatedSubquery

1 file changed

+27
-20
lines changed

src/NHibernate.Test/Async/NHSpecificTest/GH3306NullableEntityCorrelatedSubquery/Fixture.cs

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,40 +23,47 @@ public class FixtureAsync : BugTestCase
2323

2424
protected override void OnSetUp()
2525
{
26-
using var session = OpenSession();
27-
using var tx = session.BeginTransaction();
28-
var joe = new Customer {Name = NAME_JOE};
29-
session.Save(joe);
26+
using (var session = OpenSession())
27+
using (var tx = session.BeginTransaction())
28+
{
29+
var joe = new Customer { Name = NAME_JOE };
30+
session.Save(joe);
3031

31-
var allen = new Customer {Name = NAME_ALLEN};
32-
session.Save(allen);
32+
var allen = new Customer { Name = NAME_ALLEN };
33+
session.Save(allen);
3334

34-
var joeInvoice0 = new Invoice {Customer = joe, Number = 0};
35-
session.Save(joeInvoice0);
35+
var joeInvoice0 = new Invoice { Customer = joe, Number = 0 };
36+
session.Save(joeInvoice0);
3637

37-
var allenInvoice1 = new Invoice {Customer = allen, Number = 1};
38-
session.Save(allenInvoice1);
38+
var allenInvoice1 = new Invoice { Customer = allen, Number = 1 };
39+
session.Save(allenInvoice1);
3940

40-
tx.Commit();
41+
tx.Commit();
42+
}
4143
}
4244

4345
protected override void OnTearDown()
4446
{
45-
using var session = OpenSession();
46-
using var tx = session.BeginTransaction();
47-
session.Delete("from Invoice");
48-
session.Delete("from Customer");
49-
tx.Commit();
47+
using (var session = OpenSession())
48+
using (var tx = session.BeginTransaction())
49+
{
50+
session.Delete("from Invoice");
51+
session.Delete("from Customer");
52+
tx.Commit();
53+
}
5054
}
5155

5256
[Test]
5357
public async Task NullableEntityInCorrelatedSubqueryAsync()
5458
{
55-
using var s = OpenSession();
56-
var customers = s.Query<Customer>().Where(c => c.Name == NAME_JOE);
57-
var results = await (s.Query<Invoice>().Where(i => customers.Any(c => c.Invoices.Any(ci => ci.Customer == i.Customer))).ToListAsync());
59+
using (var s = OpenSession())
60+
{
61+
var customers = s.Query<Customer>().Where(c => c.Name == NAME_JOE);
62+
var results = await (s.Query<Invoice>()
63+
.Where(i => customers.Any(c => c.Invoices.Any(ci => ci.Customer == i.Customer))).ToListAsync());
5864

59-
Assert.That(results.Count, Is.EqualTo(1));
65+
Assert.That(results.Count, Is.EqualTo(1));
66+
}
6067
}
6168
}
6269
}

0 commit comments

Comments
 (0)