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 1
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license.
3
3
4
+ using System ;
4
5
using System . IO ;
6
+ using System . Net . Http ;
5
7
using System . Threading . Tasks ;
6
8
using Xunit ;
7
9
@@ -44,5 +46,20 @@ public async Task StreamShouldNotBeDisposedIfLeaveStreamOpenSettingIsTrue()
44
46
stream . Seek ( 0 , SeekOrigin . Begin ) ; // does not throw an object disposed exception
45
47
Assert . True ( stream . CanRead ) ;
46
48
}
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
+ }
47
64
}
48
65
}
You can’t perform that action at this time.
0 commit comments