-
Notifications
You must be signed in to change notification settings - Fork 934
/
Copy pathKeyPropertyRefFixture.cs
68 lines (57 loc) · 1.39 KB
/
KeyPropertyRefFixture.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AsyncGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using NHibernate;
using NUnit.Framework;
namespace NHibernate.Test.PropertyRef
{
using System.Threading.Tasks;
[TestFixture]
public class KeyPropertyRefFixtureAsync : TestCase
{
protected override string[] Mappings
{
get { return new string[] { "PropertyRef.KeyPropertyRef.hbm.xml" }; }
}
protected override string MappingsAssembly
{
get { return "NHibernate.Test"; }
}
protected override void OnTearDown()
{
using (ISession s = OpenSession())
{
s.Delete("from B");
s.Flush();
s.Delete("from A");
s.Flush();
}
}
[Test]
public async Task PropertyRefUsesOtherColumnAsync()
{
const int ExtraId = 500;
A a = new A();
a.Name = "First";
a.ExtraId = ExtraId;
B b = new B();
b.Id = ExtraId;
b.Name = "Second";
ISession s = OpenSession();
await (s.SaveAsync(a));
await (s.SaveAsync(b));
await (s.FlushAsync());
s.Close();
s = OpenSession();
A newA = await (s.GetAsync<A>(a.Id));
Assert.AreEqual(1, newA.Items.Count);
s.Close();
}
}
}