Skip to content

Commit f407702

Browse files
committed
use async overloads
1 parent 05cb002 commit f407702

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

44
using System;
@@ -49,7 +49,7 @@ public async Task StreamShouldNotBeDisposedIfLeaveStreamOpenSettingIsTrueAsync()
4949
memoryStream.Position = 0;
5050
var stream = memoryStream;
5151

52-
var result = OpenApiDocument.Load(stream, "yaml", new OpenApiReaderSettings { LeaveStreamOpen = true });
52+
_ = await OpenApiDocument.LoadAsync(stream, "yaml", new OpenApiReaderSettings { LeaveStreamOpen = true });
5353
stream.Seek(0, SeekOrigin.Begin); // does not throw an object disposed exception
5454
Assert.True(stream.CanRead);
5555
}
@@ -65,7 +65,7 @@ public async Task StreamShouldReadWhenInitializedAsync()
6565
var stream = await httpClient.GetStreamAsync("20fe7a7b720a0e48e5842d002ac418b12a8201df/tests/v3.0/pass/petstore.yaml");
6666

6767
// Read V3 as YAML
68-
var result = OpenApiDocument.Load(stream, "yaml");
68+
var result = await OpenApiDocument.LoadAsync(stream, "yaml");
6969
Assert.NotNull(result.OpenApiDocument);
7070
}
7171
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,9 @@ public async Task ParseExternalDocumentDereferenceToOpenApiDocumentByIdWorks()
522522

523523
// Act
524524
var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "externalRefById.yaml"), settings);
525-
var doc2 = OpenApiDocument.Load(Path.Combine(SampleFolderPath, "externalResource.yaml")).OpenApiDocument;
525+
var doc2 = (await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "externalResource.yaml"))).OpenApiDocument;
526526

527-
var requestBodySchema = result.OpenApiDocument.Paths["/resource"].Operations[OperationType.Get].Parameters.First().Schema;
527+
var requestBodySchema = result.OpenApiDocument.Paths["/resource"].Operations[OperationType.Get].Parameters[0].Schema;
528528
result.OpenApiDocument.Workspace.RegisterComponents(doc2);
529529

530530
// Assert
@@ -535,10 +535,10 @@ public async Task ParseExternalDocumentDereferenceToOpenApiDocumentByIdWorks()
535535
public async Task ParseDocumentWith31PropertiesWorks()
536536
{
537537
var path = Path.Combine(SampleFolderPath, "documentWith31Properties.yaml");
538-
var doc = OpenApiDocument.Load(path).OpenApiDocument;
538+
var doc = (await OpenApiDocument.LoadAsync(path)).OpenApiDocument;
539539
var outputStringWriter = new StringWriter();
540540
doc.SerializeAsV31(new OpenApiYamlWriter(outputStringWriter));
541-
outputStringWriter.Flush();
541+
await outputStringWriter.FlushAsync();
542542
var actual = outputStringWriter.GetStringBuilder().ToString();
543543

544544
// Assert

0 commit comments

Comments
 (0)