forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTableGeneratorFixture.cs
29 lines (26 loc) · 1012 Bytes
/
TableGeneratorFixture.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
using System.Collections.Generic;
using System.Reflection;
using NHibernate.Dialect;
using NHibernate.Id;
using NUnit.Framework;
namespace NHibernate.Test.IdTest
{
[TestFixture]
public class TableGeneratorFixture
{
private const BindingFlags Flags =
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly;
private readonly FieldInfo updateSql = typeof (TableGenerator).GetField("updateSql", Flags);
private readonly FieldInfo selectSql = typeof (TableGenerator).GetField("query", Flags);
[Test]
public void SelectAndUpdateStringContainCustomWhere()
{
const string customWhere = "table_name='second'";
var dialect = new MsSql2005Dialect();
var tg = new TableGenerator();
tg.Configure(NHibernateUtil.Int64, new Dictionary<string, string> {{"where", customWhere}}, dialect);
Assert.That(selectSql.GetValue(tg).ToString(), Does.Contain(customWhere));
Assert.That(updateSql.GetValue(tg).ToString(), Does.Contain(customWhere));
}
}
}