Skip to content

Commit 0ec2f1d

Browse files
author
Danko Durbić
committed
Added failing test case TestFetchAllPropertiesAfterEntityIsInitialized to FetchLazyPropertiesFixture.
1 parent 3f6119a commit 0ec2f1d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/NHibernate.Test/FetchLazyProperties/FetchLazyPropertiesFixture.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,26 @@ public void TestFetchAfterEntityIsInitialized(bool readOnly)
934934
Assert.That(NHibernateUtil.IsPropertyInitialized(person, "Formula"), Is.True);
935935
}
936936

937+
[TestCase(true)]
938+
[TestCase(false)]
939+
public void TestFetchAllPropertiesAfterEntityIsInitialized(bool readOnly)
940+
{
941+
Person person;
942+
using(var s = OpenSession())
943+
using(var tx = s.BeginTransaction())
944+
{
945+
person = s.CreateQuery("from Person where Id = 1").SetReadOnly(readOnly).UniqueResult<Person>();
946+
var image = person.Image;
947+
person = s.CreateQuery("from Person fetch all properties where Id = 1").SetReadOnly(readOnly).UniqueResult<Person>();
948+
949+
tx.Commit();
950+
}
951+
952+
Assert.That(NHibernateUtil.IsPropertyInitialized(person, "Image"), Is.True);
953+
Assert.That(NHibernateUtil.IsPropertyInitialized(person, "Address"), Is.True);
954+
Assert.That(NHibernateUtil.IsPropertyInitialized(person, "Formula"), Is.True);
955+
}
956+
937957
[Test]
938958
public void TestHqlCrossJoinFetchFormula()
939959
{

0 commit comments

Comments
 (0)