@@ -186,40 +186,65 @@ public void TestGuid()
186186
187187 [ Fact , TestPriority ( 1 ) ]
188188 [ UseCulture ( "en-US" ) ]
189- public void TestUnion ( )
190- {
191- var assembly = Compiler . Generate ( "Union" , UnionPattern , new Generator
192- {
193- NamespacePrefix = "Union" ,
194- IntegerDataType = typeof ( int ) ,
195- MapUnionToWidestCommonType = true
196- } ) ;
197-
198- Assert . NotNull ( assembly ) ;
199-
200- SharedTestFunctions . TestSamples ( Output , "Union" , UnionPattern ) ;
201-
202- var snapshotType = assembly . GetType ( "Union.Snapshot" ) ;
203- Assert . NotNull ( snapshotType ) ;
204-
205- var date = snapshotType . GetProperty ( "Date" ) ;
206- Assert . NotNull ( date ) ;
207- Assert . Equal ( typeof ( DateTime ) , date . PropertyType ) ;
208-
209- var count = snapshotType . GetProperty ( "Count" ) ;
210- Assert . NotNull ( count ) ;
211- Assert . Equal ( typeof ( int ) , count . PropertyType ) ;
212-
213- var num = snapshotType . GetProperty ( "Num" ) ;
214- Assert . NotNull ( num ) ;
215- Assert . Equal ( typeof ( decimal ) , num . PropertyType ) ;
216- }
217-
218- [ Fact , TestPriority ( 1 ) ]
219- [ UseCulture ( "en-US" ) ]
220- public void TestList ( )
221- {
222- Compiler . Generate ( "List" , ListPattern ) ;
189+ public void TestUnion ( )
190+ {
191+ var assembly = Compiler . Generate ( "Union" , UnionPattern , new Generator
192+ {
193+ NamespacePrefix = "Union" ,
194+ IntegerDataType = typeof ( int ) ,
195+ MapUnionToWidestCommonType = true
196+ } ) ;
197+
198+ Assert . NotNull ( assembly ) ;
199+
200+ SharedTestFunctions . TestSamples ( Output , "Union" , UnionPattern ) ;
201+
202+ var snapshotType = assembly . GetType ( "Union.Snapshot" ) ;
203+ Assert . NotNull ( snapshotType ) ;
204+
205+ var date = snapshotType . GetProperty ( "Date" ) ;
206+ Assert . NotNull ( date ) ;
207+ Assert . Equal ( typeof ( DateTime ) , date . PropertyType ) ;
208+
209+ var count = snapshotType . GetProperty ( "Count" ) ;
210+ Assert . NotNull ( count ) ;
211+ Assert . Equal ( typeof ( int ) , count . PropertyType ) ;
212+
213+ var num = snapshotType . GetProperty ( "Num" ) ;
214+ Assert . NotNull ( num ) ;
215+ Assert . Equal ( typeof ( decimal ) , num . PropertyType ) ;
216+ }
217+
218+ [ Fact , TestPriority ( 1 ) ]
219+ [ UseCulture ( "en-US" ) ]
220+ public void TestSimpleContentEnum ( )
221+ {
222+ var assembly = Compiler . Generate ( "SimpleContentEnum" , "xsd/simple/simplecontent-enum.xsd" ) ;
223+
224+ const string ns = "SimpleContentEnum.Simplecontent" ;
225+
226+ var enumType = assembly . GetType ( $ "{ ns } .TransConfirmationCodeTypeEnum") ;
227+ if ( enumType == null )
228+ {
229+ var names = string . Join ( ", " , assembly . GetTypes ( ) . Select ( t => t . FullName ) ) ;
230+ Assert . Fail ( $ "Enum type not found. Available types: { names } ") ;
231+ }
232+
233+ var type = assembly . GetType ( $ "{ ns } .TransConfirmationCodeType") ;
234+ Assert . NotNull ( type ) ;
235+
236+ var baseType = assembly . GetType ( $ "{ ns } .CodeType") ;
237+ Assert . Equal ( baseType , type . BaseType ) ;
238+
239+ var valueProperty = type . GetProperties ( ) . Single ( p => p . PropertyType == enumType ) ;
240+ Assert . Equal ( "Value" , valueProperty . Name ) ;
241+ }
242+
243+ [ Fact , TestPriority ( 1 ) ]
244+ [ UseCulture ( "en-US" ) ]
245+ public void TestList ( )
246+ {
247+ Compiler . Generate ( "List" , ListPattern ) ;
223248 SharedTestFunctions . TestSamples ( Output , "List" , ListPattern ) ;
224249 }
225250
0 commit comments