forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLinqToHqlGeneratorsRegistryFactoryTest.cs
58 lines (51 loc) · 1.75 KB
/
LinqToHqlGeneratorsRegistryFactoryTest.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;
using System.Collections.Generic;
using System.Reflection;
using NHibernate.Linq.Functions;
using NUnit.Framework;
using Environment = NHibernate.Cfg.Environment;
namespace NHibernate.Test.Linq
{
[TestFixture]
public class LinqToHqlGeneratorsRegistryFactoryTest
{
[Test]
public void WhenNotDefinedThenReturnDefaultRegistry()
{
var registry = LinqToHqlGeneratorsRegistryFactory.CreateGeneratorsRegistry(new Dictionary<string, string>());
Assert.That(registry, Is.Not.Null);
Assert.That(registry, Is.TypeOf<DefaultLinqToHqlGeneratorsRegistry>());
}
[Test]
public void WhenDefinedThenReturnCustomtRegistry()
{
var properties = new Dictionary<string, string> { { Environment.LinqToHqlGeneratorsRegistry, typeof(MyLinqToHqlGeneratorsRegistry).AssemblyQualifiedName } };
var registry = LinqToHqlGeneratorsRegistryFactory.CreateGeneratorsRegistry(properties);
Assert.That(registry, Is.Not.Null);
Assert.That(registry, Is.TypeOf<MyLinqToHqlGeneratorsRegistry>());
}
private class MyLinqToHqlGeneratorsRegistry : ILinqToHqlGeneratorsRegistry
{
public bool TryGetGenerator(MethodInfo method, out IHqlGeneratorForMethod generator)
{
throw new NotImplementedException();
}
public bool TryGetGenerator(MemberInfo property, out IHqlGeneratorForProperty generator)
{
throw new NotImplementedException();
}
public void RegisterGenerator(MethodInfo method, IHqlGeneratorForMethod generator)
{
throw new NotImplementedException();
}
public void RegisterGenerator(MemberInfo property, IHqlGeneratorForProperty generator)
{
throw new NotImplementedException();
}
public void RegisterGenerator(IRuntimeMethodHqlGenerator generator)
{
throw new NotImplementedException();
}
}
}
}