Skip to content

Commit 29acad7

Browse files
committed
Add test
1 parent 4a01599 commit 29acad7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

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

4+
using System;
45
using System.IO;
6+
using System.Net.Http;
57
using System.Threading.Tasks;
68
using Xunit;
79

@@ -44,5 +46,20 @@ public async Task StreamShouldNotBeDisposedIfLeaveStreamOpenSettingIsTrue()
4446
stream.Seek(0, SeekOrigin.Begin); // does not throw an object disposed exception
4547
Assert.True(stream.CanRead);
4648
}
49+
50+
[Fact]
51+
public async Task StreamShouldReadWhenInitialized()
52+
{
53+
var httpClient = new HttpClient
54+
{
55+
BaseAddress = new Uri("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/")
56+
};
57+
58+
var stream = await httpClient.GetStreamAsync("master/examples/v3.0/petstore.yaml");
59+
60+
// Read V3 as YAML
61+
var openApiDocument = new OpenApiStreamReader().Read(stream, out var diagnostic);
62+
Assert.NotNull(openApiDocument);
63+
}
4764
}
4865
}

0 commit comments

Comments
 (0)