From 69d14422a599c4c8a7a8340e67110f9a6a7e48e8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Mar 2023 15:32:24 +0000 Subject: [PATCH] Generate async files --- .../NH750/ManyToManyNotFoundIgnoreFixture.cs | 6 -- .../ManyToManyThrowsForNotFoundFixture.cs | 85 +++++++++++++++++++ 2 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 src/NHibernate.Test/Async/NHSpecificTest/NH750/ManyToManyThrowsForNotFoundFixture.cs diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH750/ManyToManyNotFoundIgnoreFixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH750/ManyToManyNotFoundIgnoreFixture.cs index f77f468d024..2ab73df8d3a 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/NH750/ManyToManyNotFoundIgnoreFixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH750/ManyToManyNotFoundIgnoreFixture.cs @@ -62,12 +62,6 @@ protected override void OnTearDown() } } - protected override void Configure(Configuration configuration) - { - configuration.SetProperty(Cfg.Environment.UseSecondLevelCache, "false"); - base.Configure(configuration); - } - [Test] public async Task DeviceOfDriveAsync() { diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH750/ManyToManyThrowsForNotFoundFixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH750/ManyToManyThrowsForNotFoundFixture.cs new file mode 100644 index 00000000000..59b6a0044bf --- /dev/null +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH750/ManyToManyThrowsForNotFoundFixture.cs @@ -0,0 +1,85 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Linq; +using NHibernate.Criterion; +using NHibernate.Linq; +using NHibernate.Transform; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH750 +{ + using System.Threading.Tasks; + [TestFixture] + public class ManyToManyThrowsForNotFoundFixtureAsync : BugTestCase + { + private int _id; + + protected override void OnSetUp() + { + using (var s = Sfi.OpenSession()) + using (var t = s.BeginTransaction()) + { + Device dv = new Device("Device"); + Drive dr = new Drive("Drive"); + s.Save(dr); + dv.DrivesNotIgnored.Add(dr); + + _id = (int) s.Save(dv); + s.Flush(); + + s.Clear(); + s.Delete(dr); + t.Commit(); + } + } + + protected override void OnTearDown() + { + using (var s = OpenSession()) + using (var t = s.BeginTransaction()) + { + s.Delete("from Device"); + s.Delete("from Drive"); + t.Commit(); + } + } + + [Test] + public async Task LazyLoadAsync() + { + using var s = OpenSession(); + var device = await (s.GetAsync(_id)); + Assert.ThrowsAsync(() => NHibernateUtil.InitializeAsync(device.DrivesNotIgnored)); + } + + [Test] + public void QueryOverFetchAsync() + { + using var s = OpenSession(); + var queryOver = s.QueryOver() + .Fetch(SelectMode.Fetch, x => x.DrivesNotIgnored) + .Where(Restrictions.IdEq(_id)) + .TransformUsing(Transformers.DistinctRootEntity); + Assert.ThrowsAsync(async () => await (NHibernateUtil.InitializeAsync(await (queryOver.SingleOrDefaultAsync())))); + } + + [Test] + public void LinqFetchAsync() + { + using var s = OpenSession(); + var query = s.Query() + + .Fetch(x => x.DrivesNotIgnored) + .Where(x => x.Id == _id); + Assert.ThrowsAsync(async () => await (NHibernateUtil.InitializeAsync(await (query.SingleOrDefaultAsync())))); + } + } +}