forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBatcherFixture.cs
45 lines (40 loc) · 1.06 KB
/
BatcherFixture.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
using System;
using System.Collections;
using System.Collections.Generic;
using NHibernate.Cfg;
using NHibernate.Util;
using NUnit.Framework;
using Environment = NHibernate.Cfg.Environment;
namespace NHibernate.Test.ConnectionTest
{
[TestFixture]
public class BatcherFixture : ConnectionManagementTestCase
{
protected override void Configure(Configuration config)
{
base.Configure(config);
config.SetProperty(Environment.BatchSize, "10");
}
protected override ISession GetSessionUnderTest()
=> OpenSession();
protected override void OnTearDown()
{
using (var s = OpenSession())
{
s.CreateQuery("delete from System.Object").ExecuteUpdate();
}
}
[Test]
public void CanCloseCommandsAndUseBatcher()
{
using (var s = OpenSession())
{
// Need a generator strategy not causing insert at save.
var silly = new YetAnother { Name = "Silly" };
s.Save(silly);
s.GetSessionImplementation().ConnectionManager.Batcher.CloseCommands();
Assert.DoesNotThrow(s.Flush, "Flush failure after closing commands.");
}
}
}
}