Skip to content

Commit a915e5b

Browse files
committed
Fixes based on PR comments
1 parent d1b8b4d commit a915e5b

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

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

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using System;
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
24
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
65
using FluentAssertions;
76
using Microsoft.OpenApi.Exceptions;
87
using Microsoft.OpenApi.Models;
@@ -28,18 +27,14 @@ public void ShouldThrowWhenReferenceTypeIsInvalid()
2827
'200':
2928
description: ok
3029
schema:
31-
$ref: '#/definition/does/notexist'
30+
$ref: '#/defi888nition/does/notexist'
3231
";
3332

34-
var reader = new OpenApiStringReader(new OpenApiReaderSettings() {
35-
});
36-
37-
OpenApiDocument doc = null;
38-
39-
Assert.Throws<OpenApiReaderException>(() =>
40-
doc = reader.Read(input, out var diagnostic));
33+
var reader = new OpenApiStringReader();
4134

42-
Assert.Null(doc);
35+
Assert.Throws<OpenApiReaderException>(() => {
36+
var doc = reader.Read(input, out var diagnostic);
37+
});
4338
}
4439

4540

@@ -62,16 +57,13 @@ public void ShouldThrowWhenReferenceDoesNotExist()
6257
$ref: '#/definitions/doesnotexist'
6358
";
6459

65-
var reader = new OpenApiStringReader(new OpenApiReaderSettings()
66-
{
67-
});
68-
69-
OpenApiDocument doc = null;
60+
var reader = new OpenApiStringReader();
7061

71-
doc = reader.Read(input, out var diagnostic);
62+
var doc = reader.Read(input, out var diagnostic);
7263

7364
diagnostic.Errors.ShouldBeEquivalentTo(new List<OpenApiError> {
7465
new OpenApiError( new OpenApiException("Invalid Reference identifier 'doesnotexist'.")) });
66+
doc.Should().NotBeNull();
7567
}
7668
}
7769
}

0 commit comments

Comments
 (0)