forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJoinedSubclassFixture.cs
58 lines (49 loc) · 1.28 KB
/
JoinedSubclassFixture.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
using System.Collections;
using NHibernate.Cfg;
using NHibernate.Stat;
using NUnit.Framework;
using System.Collections.Generic;
namespace NHibernate.Test.Ondelete
{
[TestFixture]
public class JoinedSubclassFixture : TestCase
{
protected override string MappingsAssembly
{
get { return "NHibernate.Test"; }
}
protected override string[] Mappings
{
get { return new string[] { "Ondelete.EFGJoinedSubclass.hbm.xml" }; }
}
protected override void Configure(Configuration cfg)
{
cfg.SetProperty(Environment.GenerateStatistics, "true");
}
[Test]
public void JoinedSubclassCascade()
{
G g1 = new G("thing", "white", "10x10");
F f1 = new F("thing2", "blue");
ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
s.Save(g1);
s.Save(f1);
t.Commit();
s.Close();
IStatistics statistics = Sfi.Statistics;
statistics.Clear();
s = OpenSession();
t = s.BeginTransaction();
IList<E> l = s.CreateQuery("from E").List<E>();
statistics.Clear();
s.Delete(l[0]);
s.Delete(l[1]);
t.Commit();
s.Close();
Assert.AreEqual(2, statistics.EntityDeleteCount);
// In this case the batcher reuse the same command because have same SQL and same parametersTypes
Assert.AreEqual(1, statistics.PrepareStatementCount);
}
}
}