@@ -21,17 +21,18 @@ namespace NHibernate.Test.Linq
21
21
{
22
22
using System . Threading . Tasks ;
23
23
using System . Threading ;
24
- [ TestFixture ( typeof ( EnumType < TestEnum > ) ) ]
25
- [ TestFixture ( typeof ( EnumStringType < TestEnum > ) ) ]
26
- [ TestFixture ( typeof ( EnumAnsiStringType < TestEnum > ) ) ]
24
+ [ TestFixture ( typeof ( EnumType < TestEnum > ) , "0" ) ]
25
+ [ TestFixture ( typeof ( EnumStringType < TestEnum > ) , "'Unspecified'" ) ]
26
+ [ TestFixture ( typeof ( EnumAnsiStringType < TestEnum > ) , "'Unspecified'" ) ]
27
27
public class EnumTestsAsync : TestCaseMappingByCode
28
28
{
29
29
private IType _enumType ;
30
+ private string _unspecifiedValue ;
30
31
31
-
32
- public EnumTestsAsync ( System . Type enumType )
32
+ public EnumTestsAsync ( System . Type enumType , string unspecifiedValue )
33
33
{
34
34
_enumType = ( IType ) Activator . CreateInstance ( enumType ) ;
35
+ _unspecifiedValue = unspecifiedValue ;
35
36
}
36
37
37
38
protected override HbmMapping GetMappings ( )
@@ -44,7 +45,11 @@ protected override HbmMapping GetMappings()
44
45
rc . Id ( x => x . Id , m => m . Generator ( Generators . Identity ) ) ;
45
46
rc . Property ( x => x . Name ) ;
46
47
rc . Property ( x => x . Enum , m => m . Type ( _enumType ) ) ;
47
- rc . Property ( x => x . NullableEnum , m => m . Type ( _enumType ) ) ;
48
+ rc . Property ( x => x . NullableEnum , m =>
49
+ {
50
+ m . Type ( _enumType ) ;
51
+ m . Formula ( $ "(case when Enum = { _unspecifiedValue } then null else Enum end)") ;
52
+ } ) ;
48
53
rc . ManyToOne ( x => x . Other , m => m . Cascade ( Mapping . ByCode . Cascade . All ) ) ;
49
54
} ) ;
50
55
0 commit comments