Skip to content

Commit 2583b89

Browse files
committed
Clean up tests
1 parent c8acd59 commit 2583b89

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l
6060
if (options.Output == null)
6161
{
6262
#pragma warning disable CA1308 // Normalize strings to uppercase
63-
var inputExtension = string.Concat(".", options.OpenApiFormat.GetDisplayName().ToLowerInvariant())
63+
var inputExtension = string.Concat(".", options.OpenApiFormat?.GetDisplayName().ToLowerInvariant())
6464
?? GetInputPathExtension(options.OpenApi, options.Csdl);
6565
#pragma warning restore CA1308 // Normalize strings to uppercase
6666
options.Output = new($"./output{inputExtension}");

test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,9 @@ public void ParseDocumentWithExampleInSchemaShouldSucceed()
356356
[Fact]
357357
public void ParseDocumentWithPatternPropertiesInSchemaWorks()
358358
{
359-
// Arrange
360-
using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "docWithPatternPropertiesInSchema.yaml"));
361-
362-
// Act
363-
var doc = new OpenApiStreamReader().Read(stream, out var diagnostic);
364-
365-
var actualSchema = doc.Paths["/example"].Operations[OperationType.Get].Responses["200"].Content["application/json"].Schema;
359+
// Arrange and Act
360+
var result = OpenApiDocument.Load(Path.Combine(SampleFolderPath, "docWithPatternPropertiesInSchema.yaml"));
361+
var actualSchema = result.OpenApiDocument.Paths["/example"].Operations[OperationType.Get].Responses["200"].Content["application/json"].Schema;
366362

367363
var expectedSchema = new JsonSchemaBuilder()
368364
.Type(SchemaValueType.Object)
@@ -375,7 +371,7 @@ public void ParseDocumentWithPatternPropertiesInSchemaWorks()
375371
.Build();
376372

377373
// Serialization
378-
var mediaType = doc.Paths["/example"].Operations[OperationType.Get].Responses["200"].Content["application/json"];
374+
var mediaType = result.OpenApiDocument.Paths["/example"].Operations[OperationType.Get].Responses["200"].Content["application/json"];
379375

380376
var expectedMediaType = @"schema:
381377
type: object

0 commit comments

Comments
 (0)