File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT license.
33
4+ using System ;
45using System . IO ;
6+ using System . Net . Http ;
57using System . Threading . Tasks ;
68using 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}
You can’t perform that action at this time.
0 commit comments