Skip to content

Commit 650aaf0

Browse files
committed
retrieve id values when saving the entities and use them later in the test
1 parent 0bf6e35 commit 650aaf0

File tree

1 file changed

+13
-8
lines changed
  • src/NHibernate.Test/NHSpecificTest/NH1391

1 file changed

+13
-8
lines changed

src/NHibernate.Test/NHSpecificTest/NH1391/Fixture.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ namespace NHibernate.Test.NHSpecificTest.NH1391
44
[TestFixture]
55
public class Fixture:BugTestCase
66
{
7+
private object _idOfPersonWithAnimals;
8+
private object _idOfPersonWithCats;
9+
private object _idOfPersonWithDogs;
10+
private object _idOfPersonWithSivasKangals;
11+
712
protected override void OnSetUp()
813
{
914
using(var session=OpenSession())
@@ -51,10 +56,10 @@ protected override void OnSetUp()
5156
session.Save(dogForSivasKangals);
5257
session.Save(catForSivasKangals);
5358

54-
session.Save(personWithAnimals);
55-
session.Save(personWithCats);
56-
session.Save(personWithDogs);
57-
session.Save(personWithSivasKangals);
59+
_idOfPersonWithAnimals = session.Save(personWithAnimals);
60+
_idOfPersonWithCats = session.Save(personWithCats);
61+
_idOfPersonWithDogs = session.Save(personWithDogs);
62+
_idOfPersonWithSivasKangals = session.Save(personWithSivasKangals);
5863

5964

6065

@@ -79,10 +84,10 @@ public void Can_discriminate_subclass_on_list_with_lazy_loading_when_used_get()
7984
using (var session = OpenSession())
8085
using (var tran = session.BeginTransaction())
8186
{
82-
var personWithAnimals = session.Get<PersonWithAnimals>(1);
83-
var personWithCats = session.Get<PersonWithCats>(2);
84-
var personWithDogs = session.Get<PersonWithDogs>(3);
85-
var personWithSivasKangals = session.Get<PersonWithSivasKangals>(4);
87+
var personWithAnimals = session.Get<PersonWithAnimals>(_idOfPersonWithAnimals);
88+
var personWithCats = session.Get<PersonWithCats>(_idOfPersonWithCats);
89+
var personWithDogs = session.Get<PersonWithDogs>(_idOfPersonWithDogs);
90+
var personWithSivasKangals = session.Get<PersonWithSivasKangals>(_idOfPersonWithSivasKangals);
8691

8792
Assert.That(personWithAnimals.AnimalsGeneric,Has.Count.EqualTo(4));
8893

0 commit comments

Comments
 (0)