File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
NHibernate.Test/TypesTest Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,36 @@ public void ReadWrite()
40
40
}
41
41
}
42
42
43
+
44
+ [ Test ( Description = "NH-2887" ) ]
45
+ public void ReadWriteRelativeUri ( )
46
+ {
47
+ using ( var s = OpenSession ( ) )
48
+ {
49
+ var entity = new UriClass { Id = 1 } ;
50
+ entity . Url = new Uri ( "/" , UriKind . Relative ) ;
51
+ s . Save ( entity ) ;
52
+ s . Flush ( ) ;
53
+ }
54
+
55
+ using ( var s = OpenSession ( ) )
56
+ {
57
+ var entity = s . Get < UriClass > ( 1 ) ;
58
+ Assert . That ( entity . Url , Is . Not . Null ) ;
59
+ Assert . That ( entity . Url . OriginalString , Is . EqualTo ( "/" ) ) ;
60
+ entity . Url = new Uri ( "/2010/10/nhibernate-30-cookbook.html" , UriKind . Relative ) ;
61
+ s . Save ( entity ) ;
62
+ s . Flush ( ) ;
63
+ }
64
+ using ( var s = OpenSession ( ) )
65
+ {
66
+ var entity = s . Get < UriClass > ( 1 ) ;
67
+ Assert . That ( entity . Url . OriginalString , Is . EqualTo ( "/2010/10/nhibernate-30-cookbook.html" ) ) ;
68
+ s . Delete ( entity ) ;
69
+ s . Flush ( ) ;
70
+ }
71
+ }
72
+
43
73
[ Test ]
44
74
public void InsertNullValue ( )
45
75
{
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public override System.Type ReturnedClass
28
28
29
29
public object StringToObject ( string xml )
30
30
{
31
- return new Uri ( xml ) ;
31
+ return new Uri ( xml , UriKind . RelativeOrAbsolute ) ;
32
32
}
33
33
34
34
public override void Set ( IDbCommand cmd , object value , int index )
You can’t perform that action at this time.
0 commit comments