@@ -142,20 +142,38 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiag
142
142
Assert . Contains ( "graph LR" , output ) ;
143
143
}
144
144
145
+ [ Fact ]
146
+ public async Task ThrowIfOpenApiUrlIsNotProvidedWhenValidating ( )
147
+ {
148
+ await Assert . ThrowsAsync < ArgumentNullException > ( async ( ) =>
149
+ await OpenApiService . ValidateOpenApiDocument ( "" , new Logger < OpenApiService > ( new LoggerFactory ( ) ) , new CancellationToken ( ) ) ) ;
150
+ }
151
+
152
+
145
153
[ Fact ]
146
154
public async Task ThrowIfURLIsNotResolvableWhenValidating ( )
147
155
{
148
- var message = Assert . ThrowsAsync < InvalidOperationException > ( async ( ) =>
156
+ await Assert . ThrowsAsync < InvalidOperationException > ( async ( ) =>
149
157
await OpenApiService . ValidateOpenApiDocument ( "https://example.org/itdoesnmatter" , new Logger < OpenApiService > ( new LoggerFactory ( ) ) , new CancellationToken ( ) ) ) ;
150
158
}
151
159
152
160
[ Fact ]
153
161
public async Task ThrowIfFileDoesNotExistWhenValidating ( )
154
162
{
155
- var message = Assert . ThrowsAsync < InvalidOperationException > ( async ( ) =>
163
+ await Assert . ThrowsAsync < InvalidOperationException > ( async ( ) =>
156
164
await OpenApiService . ValidateOpenApiDocument ( "aFileThatBetterNotExist.fake" , new Logger < OpenApiService > ( new LoggerFactory ( ) ) , new CancellationToken ( ) ) ) ;
157
165
}
158
166
167
+ [ Fact ]
168
+ public async Task ValidateCommandProcessesOpenApi ( )
169
+ {
170
+ // create a dummy ILogger instance for testing
171
+ await OpenApiService . ValidateOpenApiDocument ( "UtilityFiles\\ SampleOpenApi.yml" , new Logger < OpenApiService > ( new LoggerFactory ( ) ) , new CancellationToken ( ) ) ;
172
+
173
+ Assert . True ( true ) ;
174
+ }
175
+
176
+
159
177
[ Fact ]
160
178
public async Task TransformCommandConvertsOpenApi ( )
161
179
{
@@ -167,6 +185,14 @@ public async Task TransformCommandConvertsOpenApi()
167
185
Assert . NotEmpty ( output ) ;
168
186
}
169
187
188
+ [ Fact ]
189
+ public async Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty ( )
190
+ {
191
+ await Assert . ThrowsAsync < ArgumentException > ( async ( ) =>
192
+ await OpenApiService . TransformOpenApiDocument ( null , null , null , null , true , null , null , false , null , false , false , null , null , null , new Logger < OpenApiService > ( new LoggerFactory ( ) ) , new CancellationToken ( ) ) ) ;
193
+
194
+ }
195
+
170
196
[ Fact ]
171
197
public void InvokeTransformCommand ( )
172
198
{
0 commit comments