Skip to content

Commit b3d03ef

Browse files
Generate async files
1 parent 11e8445 commit b3d03ef

File tree

1 file changed

+62
-0
lines changed
  • src/NHibernate.Test/Async/NHSpecificTest/GH3306NullableEntityCorrelatedSubquery

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by AsyncGenerator.
4+
//
5+
// Changes to this file may cause incorrect behavior and will be lost if
6+
// the code is regenerated.
7+
// </auto-generated>
8+
//------------------------------------------------------------------------------
9+
10+
11+
using System.Linq;
12+
using NUnit.Framework;
13+
using NHibernate.Linq;
14+
15+
namespace NHibernate.Test.NHSpecificTest.GH3306NullableEntityCorrelatedSubquery
16+
{
17+
using System.Threading.Tasks;
18+
[TestFixture]
19+
public class FixtureAsync : BugTestCase
20+
{
21+
private const string NAME_JOE = "Joe";
22+
private const string NAME_ALLEN = "Allen";
23+
24+
protected override void OnSetUp()
25+
{
26+
using var session = OpenSession();
27+
using var tx = session.BeginTransaction();
28+
var joe = new Customer {Name = NAME_JOE};
29+
session.Save(joe);
30+
31+
var allen = new Customer {Name = NAME_ALLEN};
32+
session.Save(allen);
33+
34+
var joeInvoice0 = new Invoice {Customer = joe, Number = 0};
35+
session.Save(joeInvoice0);
36+
37+
var allenInvoice1 = new Invoice {Customer = allen, Number = 1};
38+
session.Save(allenInvoice1);
39+
40+
tx.Commit();
41+
}
42+
43+
protected override void OnTearDown()
44+
{
45+
using var session = OpenSession();
46+
using var tx = session.BeginTransaction();
47+
session.Delete("from Invoice");
48+
session.Delete("from Customer");
49+
tx.Commit();
50+
}
51+
52+
[Test]
53+
public async Task NullableEntityInCorrelatedSubqueryAsync()
54+
{
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());
58+
59+
Assert.That(results.Count, Is.EqualTo(1));
60+
}
61+
}
62+
}

0 commit comments

Comments
 (0)