forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimplyManyToOneIgnoreTest.cs
47 lines (43 loc) · 1.01 KB
/
SimplyManyToOneIgnoreTest.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
using System;
using System.Collections;
using NUnit.Framework;
namespace NHibernate.Test.Unconstrained
{
// represent another possible ""normal"" use (N.B. H3 create the FK if you don't use <formula>)
[TestFixture]
public class SimplyManyToOneIgnoreTest : TestCase
{
protected override string MappingsAssembly
{
get { return "NHibernate.Test"; }
}
protected override IList Mappings
{
get { return new string[] {"Unconstrained.Simply.hbm.xml"}; }
}
[Test]
public void Unconstrained()
{
using (ISession s = OpenSession())
{
SimplyB sb = new SimplyB(100);
SimplyA sa = new SimplyA("ralph");
sa.B = sb;
s.Save(sb);
s.Save(sa);
s.Flush();
}
using (ISession s = OpenSession())
{
SimplyB sb = (SimplyB) s.Get(typeof(SimplyB), 100);
Assert.IsNotNull(sb);
s.Delete(sb);
s.Flush();
SimplyA sa = (SimplyA) s.Get(typeof(SimplyA), "ralph");
Assert.IsNull(sa.B);
s.Delete(sa);
s.Flush();
}
}
}
}