55
66namespace ServiceStack . OrmLite . Tests
77{
8- [ TestFixture ]
8+ using System . Collections ;
9+ using System . Collections . Generic ;
10+
11+ [ TestFixture ]
912 public class OrmLiteComplexTypesTests
1013 : OrmLiteTestBase
1114 {
@@ -58,6 +61,41 @@ public void Can_insert_and_select_from_OrderLineData()
5861 }
5962 }
6063
64+ [ Test ]
65+ public void Lists_Of_Guids_Are_Formatted_Correctly ( )
66+ {
67+ using ( var db = OpenDbConnection ( ) )
68+ {
69+ db . CreateTable < WithAListOfGuids > ( true ) ;
70+
71+ var item = new WithAListOfGuids
72+ {
73+ GuidOne = new Guid ( "32cb0acb-db43-4061-a6aa-7f4902a7002a" ) ,
74+ GuidTwo = new Guid ( "13083231-b005-4ff4-ab62-41bdc7f50a4d" ) ,
75+ TheGuids = new [ ] { new Guid ( "18176030-7a1c-4288-82df-a52f71832381" ) , new Guid ( "017f986b-f7be-4b6f-b978-ff05fba3b0aa" ) } ,
76+ } ;
77+
78+ db . Insert ( item ) ;
79+
80+ var savedGuidOne = db . Select < string > ( "SELECT GuidOne FROM WithAListOfGuids" ) . First ( ) ;
81+ Assert . That ( savedGuidOne , Is . EqualTo ( "32cb0acb-db43-4061-a6aa-7f4902a7002a" ) ) ;
82+
83+ var savedGuidTwo = db . Select < string > ( "SELECT GuidTwo FROM WithAListOfGuids" ) . First ( ) ;
84+ Assert . That ( savedGuidTwo , Is . EqualTo ( "13083231-b005-4ff4-ab62-41bdc7f50a4d" ) ) ;
85+
86+ var savedGuidList = db . Select < string > ( "SELECT TheGuids FROM WithAListOfGuids" ) . First ( ) ;
87+ Assert . That ( savedGuidList , Is . EqualTo ( "[18176030-7a1c-4288-82df-a52f71832381,017f986b-f7be-4b6f-b978-ff05fba3b0aa]" ) ) ;
88+ }
89+ }
90+
6191 }
6292
93+ public class WithAListOfGuids
94+ {
95+ public Guid GuidOne { get ; set ; }
96+
97+ public Guid GuidTwo { get ; set ; }
98+
99+ public IEnumerable < Guid > TheGuids { get ; set ; }
100+ }
63101}
0 commit comments