Skip to content

Commit 964faa7

Browse files
David EllingsworthDavid Ellingsworth
David Ellingsworth
authored and
David Ellingsworth
committed
GH2552 Async test for one-to-one session update.
1 parent 04b140a commit 964faa7

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/NHibernate.Test/Async/OneToOneType/Fixture.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,47 @@ public async Task OneToOnePersistedOnOwnerUpdateAsync()
6868
Assert.NotNull(owner.Details);
6969
}
7070
}
71+
72+
[Test]
73+
public async Task OneToOnePersistedOnOwnerUpdateForSessionUpdateAsync()
74+
{
75+
Owner owner;
76+
77+
using (var s = Sfi.OpenSession())
78+
using (var tx = s.BeginTransaction())
79+
{
80+
owner = new Owner()
81+
{
82+
Name = "Owner",
83+
};
84+
85+
await (s.SaveAsync(owner));
86+
await (tx.CommitAsync());
87+
}
88+
89+
using (var s = Sfi.OpenSession())
90+
{
91+
owner = await (s.GetAsync<Owner>(owner.Id));
92+
}
93+
94+
using (var s = Sfi.OpenSession())
95+
using (var tx = s.BeginTransaction())
96+
{
97+
await (s.SaveOrUpdateAsync(owner));
98+
owner.Details = new Details()
99+
{
100+
Data = "Owner Details"
101+
};
102+
103+
await (tx.CommitAsync());
104+
}
105+
106+
using (var s = Sfi.OpenSession())
107+
{
108+
owner = await (s.GetAsync<Owner>(owner.Id));
109+
110+
Assert.IsNotNull(owner.Details);
111+
}
112+
}
71113
}
72114
}

0 commit comments

Comments
 (0)