diff --git a/src/NHibernate.Test/Async/NHSpecificTest/GH1313/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/GH1313/Fixture.cs new file mode 100644 index 00000000000..1a5d5f38c88 --- /dev/null +++ b/src/NHibernate.Test/Async/NHSpecificTest/GH1313/Fixture.cs @@ -0,0 +1,61 @@ +//------------------------------------------------------------------------------ +// +// 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; +using System.Linq; +using NUnit.Framework; +using NHibernate.Linq; + +namespace NHibernate.Test.NHSpecificTest.GH1313 +{ + using System.Threading.Tasks; + [TestFixture] + public class FixtureAsync : BugTestCase + { + protected override void OnSetUp() + { + using var session = OpenSession(); + using var transaction = session.BeginTransaction(); + + var account = new Account { Id = 1, Name = "Account_1", OldAccountNumber = 1 }; + var order = new HoldClose + { + Account = account, + CloseDate = new DateTime(2023, 1, 1) + }; + + session.Save(account); + session.Save(order); + transaction.Commit(); + } + + protected override void OnTearDown() + { + using var session = OpenSession(); + using var transaction = session.BeginTransaction(); + + session.CreateQuery("delete from System.Object").ExecuteUpdate(); + transaction.Commit(); + } + + [Test] + [Explicit("Not fixed yet")] + public async Task ManyToOneTargettingAFormulaAsync() + { + using var session = OpenSession(); + using var transaction = session.BeginTransaction(); + + var result = session.Query(); + + Assert.That(await (result.ToListAsync()), Has.Count.EqualTo(1)); + await (transaction.CommitAsync()); + } + } +} diff --git a/src/NHibernate.Test/NHSpecificTest/GH1313/Account.cs b/src/NHibernate.Test/NHSpecificTest/GH1313/Account.cs new file mode 100644 index 00000000000..55833dc3612 --- /dev/null +++ b/src/NHibernate.Test/NHSpecificTest/GH1313/Account.cs @@ -0,0 +1,9 @@ +namespace NHibernate.Test.NHSpecificTest.GH1313 +{ + public class Account + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + public virtual int OldAccountNumber { get; set; } + } +} diff --git a/src/NHibernate.Test/NHSpecificTest/GH1313/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/GH1313/Fixture.cs new file mode 100644 index 00000000000..da097ba72d8 --- /dev/null +++ b/src/NHibernate.Test/NHSpecificTest/GH1313/Fixture.cs @@ -0,0 +1,49 @@ +using System; +using System.Linq; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.GH1313 +{ + [TestFixture] + public class Fixture : BugTestCase + { + protected override void OnSetUp() + { + using var session = OpenSession(); + using var transaction = session.BeginTransaction(); + + var account = new Account { Id = 1, Name = "Account_1", OldAccountNumber = 1 }; + var order = new HoldClose + { + Account = account, + CloseDate = new DateTime(2023, 1, 1) + }; + + session.Save(account); + session.Save(order); + transaction.Commit(); + } + + protected override void OnTearDown() + { + using var session = OpenSession(); + using var transaction = session.BeginTransaction(); + + session.CreateQuery("delete from System.Object").ExecuteUpdate(); + transaction.Commit(); + } + + [Test] + [Explicit("Not fixed yet")] + public void ManyToOneTargettingAFormula() + { + using var session = OpenSession(); + using var transaction = session.BeginTransaction(); + + var result = session.Query(); + + Assert.That(result.ToList(), Has.Count.EqualTo(1)); + transaction.Commit(); + } + } +} diff --git a/src/NHibernate.Test/NHSpecificTest/GH1313/HoldClose.cs b/src/NHibernate.Test/NHSpecificTest/GH1313/HoldClose.cs new file mode 100644 index 00000000000..007c768dbb9 --- /dev/null +++ b/src/NHibernate.Test/NHSpecificTest/GH1313/HoldClose.cs @@ -0,0 +1,11 @@ +using System; + +namespace NHibernate.Test.NHSpecificTest.GH1313 +{ + public class HoldClose + { + public virtual int Id { get; set; } + public virtual Account Account { get; set; } + public virtual DateTime CloseDate { get; set; } + } +} diff --git a/src/NHibernate.Test/NHSpecificTest/GH1313/Mappings.hbm.xml b/src/NHibernate.Test/NHSpecificTest/GH1313/Mappings.hbm.xml new file mode 100644 index 00000000000..04b321cd7f6 --- /dev/null +++ b/src/NHibernate.Test/NHSpecificTest/GH1313/Mappings.hbm.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + convert(int,substring([Oldaccountnumber],3,8)) + + + +