Skip to content

Commit 8d7a6e6

Browse files
illkostinfmaca88
authored andcommitted
Cleaning
1 parent bc8424b commit 8d7a6e6

File tree

1 file changed

+19
-30
lines changed

1 file changed

+19
-30
lines changed

src/NHibernate.Test/NHSpecificTest/CachingComplexQuery/FixtureByCode.cs

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66

77
namespace NHibernate.Test.NHSpecificTest.CachingComplexQuery
88
{
9-
/// <summary>
10-
/// Fixture using 'by code' mappings
11-
/// </summary>
12-
/// <remarks>
13-
/// This fixture is identical to <see cref="Fixture" /> except the <see cref="Person" /> mapping is performed
14-
/// by code in the GetMappings method, and does not require the <c>Mappings.hbm.xml</c> file. Use this approach
15-
/// if you prefer.
16-
/// </remarks>
179
[TestFixture]
1810
public class ByCodeFixture : TestCaseMappingByCode
1911
{
@@ -94,7 +86,7 @@ protected override void OnSetUp()
9486
var car2 = new Car { Name = "Car2", Owner = person };
9587
session.Save(car1);
9688
session.Save(car2);
97-
89+
9890
session.Save(person);
9991
transaction.Commit();
10092
}
@@ -105,11 +97,10 @@ protected override void OnTearDown()
10597
using (var session = OpenSession())
10698
using (var transaction = session.BeginTransaction())
10799
{
108-
session.Delete("from Pet");
109-
session.Delete("from Child");
110-
session.Delete("from Car");
111-
session.Delete("from Person");
112-
100+
session.CreateQuery("delete from Pet").ExecuteUpdate();
101+
session.CreateQuery("delete from Child").ExecuteUpdate();
102+
session.CreateQuery("delete from Car").ExecuteUpdate();
103+
session.CreateQuery("delete from Person").ExecuteUpdate();
113104
transaction.Commit();
114105
}
115106
}
@@ -118,25 +109,23 @@ protected override void OnTearDown()
118109
public void TestQueryCachingWithThenFetchMany()
119110
{
120111
using (var session = OpenSession())
112+
using (var transaction = session.BeginTransaction())
121113
{
122-
using (var transaction = session.BeginTransaction())
123-
{
124-
var query =
125-
session
126-
.Query<Person>()
127-
.FetchMany(p => p.Children)
128-
.ThenFetchMany(ch => ch.Pets)
129-
.FetchMany(p => p.Cars) as IQueryable<Person>;
114+
var query =
115+
session
116+
.Query<Person>()
117+
.FetchMany(p => p.Children)
118+
.ThenFetchMany(ch => ch.Pets)
119+
.FetchMany(p => p.Cars) as IQueryable<Person>;
130120

131-
query = query.WithOptions(opt =>
132-
opt.SetCacheable(true)
133-
.SetCacheMode(CacheMode.Normal)
134-
.SetCacheRegion("Long_Cache"));
121+
query = query.WithOptions(opt =>
122+
opt.SetCacheable(true)
123+
.SetCacheMode(CacheMode.Normal)
124+
.SetCacheRegion("Long_Cache"));
135125

136-
query.ToList(); // First time the result will be cached
137-
Assert.That(() => query.ToList(), Throws.Nothing); //
138-
transaction.Commit();
139-
}
126+
query.ToList(); // First time the result will be cached
127+
Assert.That(() => query.ToList(), Throws.Nothing);
128+
transaction.Commit();
140129
}
141130
}
142131
}

0 commit comments

Comments
 (0)