Skip to content

Commit 73bba29

Browse files
committed
Failing test for GH1920
1 parent fdac0d0 commit 73bba29

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
3+
namespace NHibernate.Test.NHSpecificTest.GH1920
4+
{
5+
public class EntityWithBatchSize
6+
{
7+
public virtual Guid Id { get; set; }
8+
public virtual string Name { get; set; }
9+
}
10+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System;
2+
using NUnit.Framework;
3+
4+
namespace NHibernate.Test.NHSpecificTest.GH1920
5+
{
6+
[TestFixture]
7+
public class Fixture : BugTestCase
8+
{
9+
private Guid entityId;
10+
private Guid someOtherEntityId;
11+
12+
protected override void OnSetUp()
13+
{
14+
using (var session = OpenSession())
15+
using (var transaction = session.BeginTransaction())
16+
{
17+
entityId = (Guid) session.Save(new EntityWithBatchSize {Name = "some name"});
18+
someOtherEntityId = (Guid) session.Save(new EntityWithBatchSize());
19+
20+
transaction.Commit();
21+
}
22+
}
23+
24+
[TestCase(true)]
25+
[TestCase(false)]
26+
public void CanLoadEntity(bool loadProxyOfOtherEntity)
27+
{
28+
using (var session = OpenSession())
29+
using (session.BeginTransaction())
30+
{
31+
if(loadProxyOfOtherEntity)
32+
session.Load<EntityWithBatchSize>(someOtherEntityId);
33+
34+
var result = session.Get<EntityWithBatchSize>(entityId);
35+
36+
Assert.That(result.Name, Is.Not.Null);
37+
}
38+
}
39+
40+
41+
protected override void OnTearDown()
42+
{
43+
using (var session = OpenSession())
44+
using (var transaction = session.BeginTransaction())
45+
{
46+
session.CreateQuery("delete from EntityWithBatchSize").ExecuteUpdate();
47+
transaction.Commit();
48+
}
49+
}
50+
}
51+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernate.Test"
3+
namespace="NHibernate.Test.NHSpecificTest.GH1920">
4+
5+
<class name="EntityWithBatchSize" batch-size="3">
6+
<id name="Id" generator="guid.comb"/>
7+
<property name="Name"/>
8+
</class>
9+
</hibernate-mapping>

0 commit comments

Comments
 (0)