File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
src/Microsoft.OpenApi.Readers
test/Microsoft.OpenApi.Readers.Tests/V31Tests Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -126,8 +126,7 @@ static JsonNode LoadJsonNodesFromYamlDocument(TextReader input)
126
126
yamlStream . Load ( input ) ;
127
127
if ( yamlStream . Documents . Any ( ) )
128
128
{
129
- var yamlDocument = yamlStream . Documents [ 0 ] ;
130
- return yamlDocument . ToJsonNode ( ) ;
129
+ return yamlStream . Documents [ 0 ] . ToJsonNode ( ) ;
131
130
}
132
131
133
132
throw new InvalidOperationException ( "No documents found in the YAML stream." ) ;
Original file line number Diff line number Diff line change 11
11
using Microsoft . OpenApi . Writers ;
12
12
using Xunit ;
13
13
using VerifyXunit ;
14
- using VerifyTests ;
15
14
using Microsoft . OpenApi . Models . Interfaces ;
15
+ using System ;
16
16
17
17
namespace Microsoft . OpenApi . Readers . Tests . V31Tests
18
18
{
@@ -539,5 +539,11 @@ public async Task ParseDocumentWith31PropertiesWorks()
539
539
// Assert
540
540
await Verifier . Verify ( actual ) ;
541
541
}
542
+
543
+ [ Fact ]
544
+ public void ParseEmptyMemoryStreamThrowsAnArgumentException ( )
545
+ {
546
+ Assert . Throws < ArgumentException > ( ( ) => OpenApiDocument . Load ( new MemoryStream ( ) ) ) ;
547
+ }
542
548
}
543
549
}
You can’t perform that action at this time.
0 commit comments