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()
4040}
4141}
4242
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+
4373[ Test ]
4474public void InsertNullValue ( )
4575{
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public override System.Type ReturnedClass
2828
2929public object StringToObject ( string xml )
3030{
31- return new Uri ( xml ) ;
31+ return new Uri ( xml , UriKind . RelativeOrAbsolute ) ;
3232}
3333
3434public override void Set ( IDbCommand cmd , object value , int index )
You can’t perform that action at this time.
0 commit comments