From 763a07a0f5b5a793fc43d16bd5cd736fc18a8b03 Mon Sep 17 00:00:00 2001 From: Mark Perry Date: Fri, 17 Nov 2017 14:32:49 +0000 Subject: [PATCH 1/5] Test case for Issue #1439 --- .../NHSpecificTest/GH1439/Entity.cs | 22 ++++++ .../NHSpecificTest/GH1439/FixtureByCode.cs | 78 +++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 src/NHibernate.Test/NHSpecificTest/GH1439/Entity.cs create mode 100644 src/NHibernate.Test/NHSpecificTest/GH1439/FixtureByCode.cs diff --git a/src/NHibernate.Test/NHSpecificTest/GH1439/Entity.cs b/src/NHibernate.Test/NHSpecificTest/GH1439/Entity.cs new file mode 100644 index 00000000000..31086211781 --- /dev/null +++ b/src/NHibernate.Test/NHSpecificTest/GH1439/Entity.cs @@ -0,0 +1,22 @@ +namespace NHibernate.Test.NHSpecificTest.GH1439 +{ + public class CompositeEntity + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + public virtual string LazyProperty { get; set; } + + public override int GetHashCode() + { + return (Id + "|" + Name).GetHashCode(); + } + + public override bool Equals(object obj) + { + if (obj == null) + return false; + + return obj.GetHashCode() == GetHashCode(); + } + } +} diff --git a/src/NHibernate.Test/NHSpecificTest/GH1439/FixtureByCode.cs b/src/NHibernate.Test/NHSpecificTest/GH1439/FixtureByCode.cs new file mode 100644 index 00000000000..0bc335b3a14 --- /dev/null +++ b/src/NHibernate.Test/NHSpecificTest/GH1439/FixtureByCode.cs @@ -0,0 +1,78 @@ +using NHibernate.Test.NHSpecificTest.GH0000; + +namespace NHibernate.Test.NHSpecificTest.GH1439 +{ + /// + /// Fixture using 'by code' mappings + /// + /// + /// This fixture is identical to except the mapping is performed + /// by code in the GetMappings method, and does not require the Mappings.hbm.xml file. Use this approach + /// if you prefer. + /// + public class ByCodeFixture : TestCaseMappingByCode + { + protected override void Configure(Configuration configuration) + { + configuration.SetProperty(Cfg.Environment.ShowSql, "true"); + } + + protected override HbmMapping GetMappings() + { + var mapper = new ModelMapper(); + mapper.Class(rc => + { + rc.ComposedId( + c => + { + c.Property(t => t.Id); + c.Property(t => t.Name); + }); + + rc.Property(x => x.LazyProperty, x => x.Lazy(true)); + }); + + return mapper.CompileMappingForAllExplicitlyAddedEntities(); + } + + protected override void OnSetUp() + { + using (ISession session = OpenSession()) + using (ITransaction transaction = session.BeginTransaction()) + { + var e1 = new CompositeEntity { Id = 1, Name = "Bob", LazyProperty = "LazyProperty"}; + session.Save(e1); + + session.Flush(); + transaction.Commit(); + } + } + + protected override void OnTearDown() + { + using (ISession session = OpenSession()) + using (ITransaction transaction = session.BeginTransaction()) + { + session.Delete("from System.Object"); + + session.Flush(); + transaction.Commit(); + } + } + + [Test] + public void YourTestName() + { + using (ISession session = OpenSession()) + using (var tran = session.BeginTransaction()) + { + var result = (from e in session.Query() + where e.Name == "Bob" + select e).ToList(); + session.Flush(); + tran.Commit(); + Assert.AreEqual(1, result.ToList().Count); + } + } + } +} From 23ccd12b10dbf25cf2b547bf2e95fd59e02bb519 Mon Sep 17 00:00:00 2001 From: Alexander Zaytsev Date: Tue, 6 Nov 2018 10:54:45 +1300 Subject: [PATCH 2/5] fixup! Test case for Issue #1439 --- .../NHSpecificTest/GH1439/CompositeEntity.cs | 31 ++++++++ .../NHSpecificTest/GH1439/Entity.cs | 22 ------ .../NHSpecificTest/GH1439/Fixture.cs | 70 +++++++++++++++++ .../NHSpecificTest/GH1439/FixtureByCode.cs | 78 ------------------- 4 files changed, 101 insertions(+), 100 deletions(-) create mode 100644 src/NHibernate.Test/NHSpecificTest/GH1439/CompositeEntity.cs delete mode 100644 src/NHibernate.Test/NHSpecificTest/GH1439/Entity.cs create mode 100644 src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs delete mode 100644 src/NHibernate.Test/NHSpecificTest/GH1439/FixtureByCode.cs diff --git a/src/NHibernate.Test/NHSpecificTest/GH1439/CompositeEntity.cs b/src/NHibernate.Test/NHSpecificTest/GH1439/CompositeEntity.cs new file mode 100644 index 00000000000..087e2bf8516 --- /dev/null +++ b/src/NHibernate.Test/NHSpecificTest/GH1439/CompositeEntity.cs @@ -0,0 +1,31 @@ +using System; + +namespace NHibernate.Test.NHSpecificTest.GH1439 +{ + public class CompositeEntity : IEquatable + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + public virtual string LazyProperty { get; set; } + + public bool Equals(CompositeEntity other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return Id == other.Id && string.Equals(Name, other.Name); + } + + public override bool Equals(object obj) + { + return Equals(obj as CompositeEntity); + } + + public override int GetHashCode() + { + unchecked + { + return (Id * 397) ^ (Name != null ? Name.GetHashCode() : 0); + } + } + } +} diff --git a/src/NHibernate.Test/NHSpecificTest/GH1439/Entity.cs b/src/NHibernate.Test/NHSpecificTest/GH1439/Entity.cs deleted file mode 100644 index 31086211781..00000000000 --- a/src/NHibernate.Test/NHSpecificTest/GH1439/Entity.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace NHibernate.Test.NHSpecificTest.GH1439 -{ - public class CompositeEntity - { - public virtual int Id { get; set; } - public virtual string Name { get; set; } - public virtual string LazyProperty { get; set; } - - public override int GetHashCode() - { - return (Id + "|" + Name).GetHashCode(); - } - - public override bool Equals(object obj) - { - if (obj == null) - return false; - - return obj.GetHashCode() == GetHashCode(); - } - } -} diff --git a/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs new file mode 100644 index 00000000000..2e533c6d2b2 --- /dev/null +++ b/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs @@ -0,0 +1,70 @@ +using System.Linq; +using NHibernate.Cfg.MappingSchema; +using NHibernate.Mapping.ByCode; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.GH1439 +{ + public class Fixture : TestCaseMappingByCode + { + protected override HbmMapping GetMappings() + { + var mapper = new ModelMapper(); + mapper.Class(rc => + { + rc.ComposedId( + c => + { + c.Property(t => t.Id); + c.Property(t => t.Name); + }); + + rc.Property(x => x.LazyProperty, x => x.Lazy(true)); + }); + + return mapper.CompileMappingForAllExplicitlyAddedEntities(); + } + + protected override void OnSetUp() + { + using (var session = OpenSession()) + using (var transaction = session.BeginTransaction()) + { + var e1 = new CompositeEntity { Id = 1, Name = "Bob", LazyProperty = "LazyProperty"}; + session.Save(e1); + + session.Flush(); + transaction.Commit(); + } + } + + protected override void OnTearDown() + { + using (var session = OpenSession()) + using (var transaction = session.BeginTransaction()) + { + session.CreateQuery("delete from System.Object").ExecuteUpdate(); + + session.Flush(); + transaction.Commit(); + } + } + + [Test] + public void LazyPropertyShouldNotBeNullified() + { + using (var session = OpenSession()) + using (var tran = session.BeginTransaction()) + { + var result = ( + from e in session.Query() + where e.Name == "Bob" + select e + ).ToList(); + session.Flush(); + tran.Commit(); + Assert.That(result, Has.Count.EqualTo(1)); + } + } + } +} diff --git a/src/NHibernate.Test/NHSpecificTest/GH1439/FixtureByCode.cs b/src/NHibernate.Test/NHSpecificTest/GH1439/FixtureByCode.cs deleted file mode 100644 index 0bc335b3a14..00000000000 --- a/src/NHibernate.Test/NHSpecificTest/GH1439/FixtureByCode.cs +++ /dev/null @@ -1,78 +0,0 @@ -using NHibernate.Test.NHSpecificTest.GH0000; - -namespace NHibernate.Test.NHSpecificTest.GH1439 -{ - /// - /// Fixture using 'by code' mappings - /// - /// - /// This fixture is identical to except the mapping is performed - /// by code in the GetMappings method, and does not require the Mappings.hbm.xml file. Use this approach - /// if you prefer. - /// - public class ByCodeFixture : TestCaseMappingByCode - { - protected override void Configure(Configuration configuration) - { - configuration.SetProperty(Cfg.Environment.ShowSql, "true"); - } - - protected override HbmMapping GetMappings() - { - var mapper = new ModelMapper(); - mapper.Class(rc => - { - rc.ComposedId( - c => - { - c.Property(t => t.Id); - c.Property(t => t.Name); - }); - - rc.Property(x => x.LazyProperty, x => x.Lazy(true)); - }); - - return mapper.CompileMappingForAllExplicitlyAddedEntities(); - } - - protected override void OnSetUp() - { - using (ISession session = OpenSession()) - using (ITransaction transaction = session.BeginTransaction()) - { - var e1 = new CompositeEntity { Id = 1, Name = "Bob", LazyProperty = "LazyProperty"}; - session.Save(e1); - - session.Flush(); - transaction.Commit(); - } - } - - protected override void OnTearDown() - { - using (ISession session = OpenSession()) - using (ITransaction transaction = session.BeginTransaction()) - { - session.Delete("from System.Object"); - - session.Flush(); - transaction.Commit(); - } - } - - [Test] - public void YourTestName() - { - using (ISession session = OpenSession()) - using (var tran = session.BeginTransaction()) - { - var result = (from e in session.Query() - where e.Name == "Bob" - select e).ToList(); - session.Flush(); - tran.Commit(); - Assert.AreEqual(1, result.ToList().Count); - } - } - } -} From 12f35be1cbe8a628eec06d8fe3e11fe6a0622b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delaporte?= <12201973+fredericdelaporte@users.noreply.github.com> Date: Tue, 6 Nov 2018 14:30:32 +0100 Subject: [PATCH 3/5] fixup! Test case for Issue #1439 --- .../Async/NHSpecificTest/GH1439/Fixture.cs | 89 +++++++++++++++++++ .../NHSpecificTest/GH1439/CompositeEntity.cs | 2 +- .../NHSpecificTest/GH1439/Fixture.cs | 31 ++++--- 3 files changed, 109 insertions(+), 13 deletions(-) create mode 100644 src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs diff --git a/src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs new file mode 100644 index 00000000000..669859983fb --- /dev/null +++ b/src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs @@ -0,0 +1,89 @@ +//------------------------------------------------------------------------------ +// +// 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.Cfg.MappingSchema; +using NHibernate.Mapping.ByCode; +using NHibernate.Proxy; +using NUnit.Framework; +using NHibernate.Linq; + +namespace NHibernate.Test.NHSpecificTest.GH1439 +{ + using System.Threading.Tasks; + [TestFixture] + public class FixtureAsync : TestCaseMappingByCode + { + protected override HbmMapping GetMappings() + { + var mapper = new ModelMapper(); + mapper.Class(rc => + { + rc.ComposedId( + c => + { + c.Property(t => t.Id); + c.Property(t => t.Name); + }); + + rc.Property(x => x.LazyProperty, x => x.Lazy(true)); + }); + + return mapper.CompileMappingForAllExplicitlyAddedEntities(); + } + + protected override void OnSetUp() + { + using (var session = OpenSession()) + using (var transaction = session.BeginTransaction()) + { + var e1 = new CompositeEntity { Id = 1, Name = "Bob", LazyProperty = "LazyProperty"}; + session.Save(e1); + 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] + public async Task LazyPropertyShouldBeUninitializedAndLoadableAsync() + { + using (var session = OpenSession()) + using (var tran = session.BeginTransaction()) + { + var e1 = await (session.Query().SingleAsync()); + Assert.Multiple( + () => + { + Assert.That( + NHibernateUtil.IsPropertyInitialized(e1, nameof(CompositeEntity.LazyProperty)), + Is.False, + "Lazy property initialization status"); + Assert.That( + e1.IsProxy(), + Is.True, + "Entity IsProxy"); + Assert.That( + e1, + Has.Property(nameof(CompositeEntity.LazyProperty)).EqualTo("LazyProperty")); + }); + await (tran.CommitAsync()); + } + } + } +} diff --git a/src/NHibernate.Test/NHSpecificTest/GH1439/CompositeEntity.cs b/src/NHibernate.Test/NHSpecificTest/GH1439/CompositeEntity.cs index 087e2bf8516..0b0e4477a21 100644 --- a/src/NHibernate.Test/NHSpecificTest/GH1439/CompositeEntity.cs +++ b/src/NHibernate.Test/NHSpecificTest/GH1439/CompositeEntity.cs @@ -8,7 +8,7 @@ public class CompositeEntity : IEquatable public virtual string Name { get; set; } public virtual string LazyProperty { get; set; } - public bool Equals(CompositeEntity other) + public virtual bool Equals(CompositeEntity other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; diff --git a/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs index 2e533c6d2b2..424649e902e 100644 --- a/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs @@ -1,10 +1,12 @@ using System.Linq; using NHibernate.Cfg.MappingSchema; using NHibernate.Mapping.ByCode; +using NHibernate.Proxy; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.GH1439 { + [TestFixture] public class Fixture : TestCaseMappingByCode { protected override HbmMapping GetMappings() @@ -32,8 +34,6 @@ protected override void OnSetUp() { var e1 = new CompositeEntity { Id = 1, Name = "Bob", LazyProperty = "LazyProperty"}; session.Save(e1); - - session.Flush(); transaction.Commit(); } } @@ -44,26 +44,33 @@ protected override void OnTearDown() using (var transaction = session.BeginTransaction()) { session.CreateQuery("delete from System.Object").ExecuteUpdate(); - - session.Flush(); transaction.Commit(); } } [Test] - public void LazyPropertyShouldNotBeNullified() + public void LazyPropertyShouldBeUninitializedAndLoadable() { using (var session = OpenSession()) using (var tran = session.BeginTransaction()) { - var result = ( - from e in session.Query() - where e.Name == "Bob" - select e - ).ToList(); - session.Flush(); + var e1 = session.Query().Single(); + Assert.Multiple( + () => + { + Assert.That( + NHibernateUtil.IsPropertyInitialized(e1, nameof(CompositeEntity.LazyProperty)), + Is.False, + "Lazy property initialization status"); + Assert.That( + e1.IsProxy(), + Is.True, + "Entity IsProxy"); + Assert.That( + e1, + Has.Property(nameof(CompositeEntity.LazyProperty)).EqualTo("LazyProperty")); + }); tran.Commit(); - Assert.That(result, Has.Count.EqualTo(1)); } } } From 9459274d8437615cfefcda5cece4c8bd496e088e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delaporte?= <12201973+fredericdelaporte@users.noreply.github.com> Date: Tue, 6 Nov 2018 16:30:16 +0100 Subject: [PATCH 4/5] fixup! Test case for Issue #1439 --- .../Async/NHSpecificTest/GH1439/Fixture.cs | 46 ++++++++++++++++++- .../GH1439/EntityWithComponentId.cs | 36 +++++++++++++++ .../NHSpecificTest/GH1439/Fixture.cs | 46 ++++++++++++++++++- 3 files changed, 124 insertions(+), 4 deletions(-) create mode 100644 src/NHibernate.Test/NHSpecificTest/GH1439/EntityWithComponentId.cs diff --git a/src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs index 669859983fb..fc016afce69 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs @@ -10,6 +10,7 @@ using System.Linq; using NHibernate.Cfg.MappingSchema; +using NHibernate.Intercept; using NHibernate.Mapping.ByCode; using NHibernate.Proxy; using NUnit.Framework; @@ -24,6 +25,7 @@ public class FixtureAsync : TestCaseMappingByCode protected override HbmMapping GetMappings() { var mapper = new ModelMapper(); + mapper.Class(rc => { rc.ComposedId( @@ -36,6 +38,17 @@ protected override HbmMapping GetMappings() rc.Property(x => x.LazyProperty, x => x.Lazy(true)); }); + mapper.Class(rc => + { + rc.ComponentAsId(e => e.Id, map => + { + map.Property(c => c.Id); + map.Property(c => c.Name); + }); + + rc.Property(e => e.LazyProperty, map => map.Lazy(true)); + }); + return mapper.CompileMappingForAllExplicitlyAddedEntities(); } @@ -46,6 +59,9 @@ protected override void OnSetUp() { var e1 = new CompositeEntity { Id = 1, Name = "Bob", LazyProperty = "LazyProperty"}; session.Save(e1); + var e2 = new EntityWithComponentId + { Id = new ComponentId { Id = 1, Name = "Bob" }, LazyProperty = "LazyProperty" }; + session.Save(e2); transaction.Commit(); } } @@ -75,9 +91,9 @@ public async Task LazyPropertyShouldBeUninitializedAndLoadableAsync() Is.False, "Lazy property initialization status"); Assert.That( - e1.IsProxy(), + FieldInterceptionHelper.IsInstrumented(e1), Is.True, - "Entity IsProxy"); + "Entity IsInstrumented"); Assert.That( e1, Has.Property(nameof(CompositeEntity.LazyProperty)).EqualTo("LazyProperty")); @@ -85,5 +101,31 @@ public async Task LazyPropertyShouldBeUninitializedAndLoadableAsync() await (tran.CommitAsync()); } } + + [Test] + public async Task LazyPropertyShouldBeUninitializedAndLoadableWithComponentIdAsync() + { + using (var session = OpenSession()) + using (var tran = session.BeginTransaction()) + { + var e2 = await (session.Query().SingleAsync()); + Assert.Multiple( + () => + { + Assert.That( + NHibernateUtil.IsPropertyInitialized(e2, nameof(CompositeEntity.LazyProperty)), + Is.False, + "Lazy property initialization status"); + Assert.That( + FieldInterceptionHelper.IsInstrumented(e2), + Is.True, + "Entity IsInstrumented"); + Assert.That( + e2, + Has.Property(nameof(CompositeEntity.LazyProperty)).EqualTo("LazyProperty")); + }); + await (tran.CommitAsync()); + } + } } } diff --git a/src/NHibernate.Test/NHSpecificTest/GH1439/EntityWithComponentId.cs b/src/NHibernate.Test/NHSpecificTest/GH1439/EntityWithComponentId.cs new file mode 100644 index 00000000000..2b8263161ed --- /dev/null +++ b/src/NHibernate.Test/NHSpecificTest/GH1439/EntityWithComponentId.cs @@ -0,0 +1,36 @@ +using System; + +namespace NHibernate.Test.NHSpecificTest.GH1439 +{ + public class EntityWithComponentId + { + public virtual ComponentId Id { get; set; } + public virtual string LazyProperty { get; set; } + } + + public class ComponentId : IEquatable + { + public int Id { get; set; } + public string Name { get; set; } + + public bool Equals(ComponentId other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return Id == other.Id && string.Equals(Name, other.Name); + } + + public override bool Equals(object obj) + { + return Equals(obj as ComponentId); + } + + public override int GetHashCode() + { + unchecked + { + return (Id * 397) ^ (Name != null ? Name.GetHashCode() : 0); + } + } + } +} diff --git a/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs index 424649e902e..b1d1bef42bd 100644 --- a/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs @@ -1,5 +1,6 @@ using System.Linq; using NHibernate.Cfg.MappingSchema; +using NHibernate.Intercept; using NHibernate.Mapping.ByCode; using NHibernate.Proxy; using NUnit.Framework; @@ -12,6 +13,7 @@ public class Fixture : TestCaseMappingByCode protected override HbmMapping GetMappings() { var mapper = new ModelMapper(); + mapper.Class(rc => { rc.ComposedId( @@ -24,6 +26,17 @@ protected override HbmMapping GetMappings() rc.Property(x => x.LazyProperty, x => x.Lazy(true)); }); + mapper.Class(rc => + { + rc.ComponentAsId(e => e.Id, map => + { + map.Property(c => c.Id); + map.Property(c => c.Name); + }); + + rc.Property(e => e.LazyProperty, map => map.Lazy(true)); + }); + return mapper.CompileMappingForAllExplicitlyAddedEntities(); } @@ -34,6 +47,9 @@ protected override void OnSetUp() { var e1 = new CompositeEntity { Id = 1, Name = "Bob", LazyProperty = "LazyProperty"}; session.Save(e1); + var e2 = new EntityWithComponentId + { Id = new ComponentId { Id = 1, Name = "Bob" }, LazyProperty = "LazyProperty" }; + session.Save(e2); transaction.Commit(); } } @@ -63,9 +79,9 @@ public void LazyPropertyShouldBeUninitializedAndLoadable() Is.False, "Lazy property initialization status"); Assert.That( - e1.IsProxy(), + FieldInterceptionHelper.IsInstrumented(e1), Is.True, - "Entity IsProxy"); + "Entity IsInstrumented"); Assert.That( e1, Has.Property(nameof(CompositeEntity.LazyProperty)).EqualTo("LazyProperty")); @@ -73,5 +89,31 @@ public void LazyPropertyShouldBeUninitializedAndLoadable() tran.Commit(); } } + + [Test] + public void LazyPropertyShouldBeUninitializedAndLoadableWithComponentId() + { + using (var session = OpenSession()) + using (var tran = session.BeginTransaction()) + { + var e2 = session.Query().Single(); + Assert.Multiple( + () => + { + Assert.That( + NHibernateUtil.IsPropertyInitialized(e2, nameof(CompositeEntity.LazyProperty)), + Is.False, + "Lazy property initialization status"); + Assert.That( + FieldInterceptionHelper.IsInstrumented(e2), + Is.True, + "Entity IsInstrumented"); + Assert.That( + e2, + Has.Property(nameof(CompositeEntity.LazyProperty)).EqualTo("LazyProperty")); + }); + tran.Commit(); + } + } } } From 891f4c7a0cba355babffb4e153130eeff0afdb13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delaporte?= <12201973+fredericdelaporte@users.noreply.github.com> Date: Wed, 7 Nov 2018 13:12:27 +0100 Subject: [PATCH 5/5] fixup! Test case for Issue #1439 Mark as known bug --- src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs | 2 +- src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs index fc016afce69..0962d06c353 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/GH1439/Fixture.cs @@ -12,7 +12,6 @@ using NHibernate.Cfg.MappingSchema; using NHibernate.Intercept; using NHibernate.Mapping.ByCode; -using NHibernate.Proxy; using NUnit.Framework; using NHibernate.Linq; @@ -77,6 +76,7 @@ protected override void OnTearDown() } [Test] + [KnownBug("#1439")] public async Task LazyPropertyShouldBeUninitializedAndLoadableAsync() { using (var session = OpenSession()) diff --git a/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs index b1d1bef42bd..5a12bfe77fe 100644 --- a/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/GH1439/Fixture.cs @@ -2,7 +2,6 @@ using NHibernate.Cfg.MappingSchema; using NHibernate.Intercept; using NHibernate.Mapping.ByCode; -using NHibernate.Proxy; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.GH1439 @@ -65,6 +64,7 @@ protected override void OnTearDown() } [Test] + [KnownBug("#1439")] public void LazyPropertyShouldBeUninitializedAndLoadable() { using (var session = OpenSession())