Skip to content

Commit 957cf21

Browse files
committed
More tests
1 parent 4dd592a commit 957cf21

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

src/NHibernate.Test/LazyProperty/LazyPropertyFixture.cs

+31-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using NHibernate.Cfg;
55
using NHibernate.Intercept;
6+
using NHibernate.Linq;
67
using NHibernate.Tuple.Entity;
78
using NUnit.Framework;
89
using NUnit.Framework.Constraints;
@@ -389,7 +390,7 @@ public void CanMergeTransientWithLazyPropertyInCollection()
389390
}
390391
}
391392

392-
[Test]
393+
[Test(Description = "GH-3333")]
393394
public void GetLazyPropertyWithNoSetterAccessor_PropertyShouldBeInitialized()
394395
{
395396
using (ISession s = OpenSession())
@@ -401,7 +402,7 @@ public void GetLazyPropertyWithNoSetterAccessor_PropertyShouldBeInitialized()
401402
}
402403
}
403404

404-
[Test]
405+
[Test(Description = "GH-3333")]
405406
public void GetLazyPropertyWithNoSetterAccessorTwice_ResultsAreSameObject()
406407
{
407408
using (ISession s = OpenSession())
@@ -413,5 +414,33 @@ public void GetLazyPropertyWithNoSetterAccessorTwice_ResultsAreSameObject()
413414
Assert.That(ReferenceEquals(image, sameImage), Is.True);
414415
}
415416
}
417+
418+
[Test]
419+
public void CanSetValueForLazyPropertyNoSetter()
420+
{
421+
Book book;
422+
using (ISession s = OpenSession())
423+
{
424+
book = s.Get<Book>(1);
425+
book.NoSetterImage = new byte[]{10};
426+
}
427+
428+
Assert.That(NHibernateUtil.IsPropertyInitialized(book, nameof(book.NoSetterImage)), Is.True);
429+
CollectionAssert.AreEqual(book.NoSetterImage, new byte[] { 10 });
430+
}
431+
432+
[Test]
433+
public void CanFetchLazyPropertyNoSetter()
434+
{
435+
using (ISession s = OpenSession())
436+
{
437+
var book = s
438+
.Query<Book>()
439+
.Fetch(x => x.NoSetterImage)
440+
.First(x => x.Id == 1);
441+
442+
Assert.That(NHibernateUtil.IsPropertyInitialized(book, nameof(book.NoSetterImage)), Is.True);
443+
}
444+
}
416445
}
417446
}

0 commit comments

Comments
 (0)