Skip to content

Commit bb6d25a

Browse files
github-actions[bot]bahusoid
authored andcommitted
Generate async files
1 parent c68f07a commit bb6d25a

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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 NHibernate.Linq;
13+
using NUnit.Framework;
14+
15+
namespace NHibernate.Test.NHSpecificTest.GH3288
16+
{
17+
using System.Threading.Tasks;
18+
[TestFixture]
19+
public class FetchAndCollectionJoinFixtureAsync : BugTestCase
20+
{
21+
protected override void OnSetUp()
22+
{
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+
43+
transaction.Commit();
44+
}
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));
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)