@@ -24,6 +24,7 @@ public void BuildCode_GeneratesCodeForDocumentType()
2424 factory = CreateDocTypeGenerator ;
2525
2626 Generate ( contentType ) ;
27+ Assert . Inconclusive ( "Not finished yet" ) ;
2728 }
2829
2930 [ Test ]
@@ -34,6 +35,7 @@ public void BuildCode_GeneratesCodeForMediaType()
3435 contentType . Info . Description = "Oy, need a description to boot!" ;
3536
3637 Generate ( contentType ) ;
38+ Assert . Inconclusive ( "Not finished yet" ) ;
3739 }
3840
3941 private void Generate ( ContentType contentType )
@@ -52,7 +54,6 @@ private void Generate(ContentType contentType)
5254 generator . Generate ( contentType , writer ) ;
5355
5456 Console . WriteLine ( stringBuilder . ToString ( ) ) ;
55- Assert . Inconclusive ( "Not finished yet" ) ;
5657 }
5758
5859 public override CodeGeneratorBase Create ( ContentTypeConfiguration configuration , IEnumerable < DataTypeDefinition > dataTypes )
@@ -62,40 +63,29 @@ public override CodeGeneratorBase Create(ContentTypeConfiguration configuration,
6263
6364 public CodeGeneratorBase CreateDocTypeGenerator ( ContentTypeConfiguration configuration , IEnumerable < DataTypeDefinition > dataTypes )
6465 {
65- return new NamespaceGenerator (
66- configuration ,
67- new ImportsGenerator ( configuration ) ,
68- new ClassGenerator ( configuration ,
69- new CompositeCodeGenerator (
70- configuration ,
71- new EntityNameGenerator ( configuration ) ,
72- new AttributeCodeGenerator (
73- "DocumentType" ,
74- configuration ,
75- new EntityDescriptionGenerator ( configuration ) ,
76- new CommonInfoGenerator ( configuration ) ,
77- new DocumentTypeInfoGenerator ( configuration )
78- )
79- ) ,
80- new CtorGenerator ( configuration ) ,
81- new PropertiesGenerator (
82- configuration ,
83- new PropertyDeclarationGenerator (
84- configuration ,
85- dataTypes . ToList ( ) ,
86- new EntityNameGenerator ( configuration ) ,
87- new AttributeCodeGenerator (
88- "GenericProperty" ,
89- configuration ,
90- new EntityDescriptionGenerator ( configuration )
91- ) ,
92- new PropertyBodyGenerator ( configuration )
93- )
94- )
95- )
66+ return CreateGenerators (
67+ configuration ,
68+ dataTypes ,
69+ "DocumentType" ,
70+ new DocumentTypeInfoGenerator ( configuration )
9671 ) ;
9772 }
73+
9874 public CodeGeneratorBase CreateMediaTypeGenerator ( ContentTypeConfiguration configuration , IEnumerable < DataTypeDefinition > dataTypes )
75+ {
76+ return CreateGenerators (
77+ configuration ,
78+ dataTypes ,
79+ "MediaType" ,
80+ new CommonInfoGenerator ( configuration )
81+ ) ;
82+ }
83+
84+ private static CodeGeneratorBase CreateGenerators (
85+ ContentTypeConfiguration configuration ,
86+ IEnumerable < DataTypeDefinition > dataTypes ,
87+ string attributeName ,
88+ CodeGeneratorBase infoGenerator )
9989 {
10090 return new NamespaceGenerator (
10191 configuration ,
@@ -105,12 +95,11 @@ public CodeGeneratorBase CreateMediaTypeGenerator(ContentTypeConfiguration confi
10595 configuration ,
10696 new EntityNameGenerator ( configuration ) ,
10797 new AttributeCodeGenerator (
108- "MediaType" ,
98+ attributeName ,
10999 configuration ,
110- new EntityDescriptionGenerator ( configuration ) ,
111- new CommonInfoGenerator ( configuration )
112- )
113- ) ,
100+ infoGenerator
101+ )
102+ ) ,
114103 new CtorGenerator ( configuration ) ,
115104 new PropertiesGenerator (
116105 configuration ,
@@ -121,10 +110,10 @@ public CodeGeneratorBase CreateMediaTypeGenerator(ContentTypeConfiguration confi
121110 new AttributeCodeGenerator (
122111 "GenericProperty" ,
123112 configuration ,
124- new EntityDescriptionGenerator ( configuration )
113+ new PropertyInfoGenerator ( configuration , dataTypes . ToList ( ) )
125114 ) ,
126115 new PropertyBodyGenerator ( configuration )
127- )
116+ )
128117 )
129118 )
130119 ) ;
0 commit comments