Skip to content

Commit e5c2062

Browse files
committed
.
1 parent 1036e53 commit e5c2062

File tree

3 files changed

+234
-199
lines changed

3 files changed

+234
-199
lines changed

test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ public class TestCustomExtension
1414
[Fact]
1515
public void ParseCustomExtension()
1616
{
17-
var description = @"
18-
openapi: 3.0.0
19-
info:
20-
title: A doc with an extension
21-
version: 1.0.0
22-
x-foo:
23-
bar: hey
24-
baz: hi!
25-
paths: {}
26-
";
17+
var description =
18+
"""
19+
openapi: 3.0.0
20+
info:
21+
title: A doc with an extension
22+
version: 1.0.0
23+
x-foo:
24+
bar: hey
25+
baz: hi!
26+
paths: {}
27+
""";
2728
var settings = new OpenApiReaderSettings
2829
{
2930
ExtensionParsers = { { "x-foo", (a,v) => {

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

Lines changed: 123 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ public class OpenApiServerTests
1111
[Fact]
1212
public void NoServer()
1313
{
14-
var input = @"
15-
swagger: 2.0
16-
info:
17-
title: test
18-
version: 1.0.0
19-
paths: {}
20-
";
14+
var input =
15+
"""
16+
swagger: 2.0
17+
info:
18+
title: test
19+
version: 1.0.0
20+
paths: {}
21+
""";
2122
var reader = new OpenApiStringReader(new OpenApiReaderSettings
2223
{
2324
});
@@ -30,15 +31,16 @@ public void NoServer()
3031
[Fact]
3132
public void JustSchemeNoDefault()
3233
{
33-
var input = @"
34-
swagger: 2.0
35-
info:
36-
title: test
37-
version: 1.0.0
38-
schemes:
39-
- http
40-
paths: {}
41-
";
34+
var input =
35+
"""
36+
swagger: 2.0
37+
info:
38+
title: test
39+
version: 1.0.0
40+
schemes:
41+
- http
42+
paths: {}
43+
""";
4244
var reader = new OpenApiStringReader(new OpenApiReaderSettings
4345
{
4446
});
@@ -51,14 +53,15 @@ public void JustSchemeNoDefault()
5153
[Fact]
5254
public void JustHostNoDefault()
5355
{
54-
var input = @"
55-
swagger: 2.0
56-
info:
57-
title: test
58-
version: 1.0.0
59-
host: www.foo.com
60-
paths: {}
61-
";
56+
var input =
57+
"""
58+
swagger: 2.0
59+
info:
60+
title: test
61+
version: 1.0.0
62+
host: www.foo.com
63+
paths: {}
64+
""";
6265
var reader = new OpenApiStringReader(new OpenApiReaderSettings
6366
{
6467
});
@@ -73,16 +76,17 @@ public void JustHostNoDefault()
7376
[Fact]
7477
public void NoBasePath()
7578
{
76-
var input = @"
77-
swagger: 2.0
78-
info:
79-
title: test
80-
version: 1.0.0
81-
host: www.foo.com
82-
schemes:
83-
- http
84-
paths: {}
85-
";
79+
var input =
80+
"""
81+
swagger: 2.0
82+
info:
83+
title: test
84+
version: 1.0.0
85+
host: www.foo.com
86+
schemes:
87+
- http
88+
paths: {}
89+
""";
8690
var reader = new OpenApiStringReader(new OpenApiReaderSettings
8791
{
8892
BaseUrl = new Uri("https://www.foo.com/spec.yaml")
@@ -98,14 +102,15 @@ public void NoBasePath()
98102
[Fact]
99103
public void JustBasePathNoDefault()
100104
{
101-
var input = @"
102-
swagger: 2.0
103-
info:
104-
title: test
105-
version: 1.0.0
106-
basePath: /baz
107-
paths: {}
108-
";
105+
var input =
106+
"""
107+
swagger: 2.0
108+
info:
109+
title: test
110+
version: 1.0.0
111+
basePath: /baz
112+
paths: {}
113+
""";
109114
var reader = new OpenApiStringReader(new OpenApiReaderSettings
110115
{
111116
});
@@ -120,15 +125,16 @@ public void JustBasePathNoDefault()
120125
[Fact]
121126
public void JustSchemeWithCustomHost()
122127
{
123-
var input = @"
124-
swagger: 2.0
125-
info:
126-
title: test
127-
version: 1.0.0
128-
schemes:
129-
- http
130-
paths: {}
131-
";
128+
var input =
129+
"""
130+
swagger: 2.0
131+
info:
132+
title: test
133+
version: 1.0.0
134+
schemes:
135+
- http
136+
paths: {}
137+
""";
132138
var reader = new OpenApiStringReader(new OpenApiReaderSettings
133139
{
134140
BaseUrl = new Uri("https://bing.com/foo")
@@ -144,15 +150,16 @@ public void JustSchemeWithCustomHost()
144150
[Fact]
145151
public void JustSchemeWithCustomHostWithEmptyPath()
146152
{
147-
var input = @"
148-
swagger: 2.0
149-
info:
150-
title: test
151-
version: 1.0.0
152-
schemes:
153-
- http
154-
paths: {}
155-
";
153+
var input =
154+
"""
155+
swagger: 2.0
156+
info:
157+
title: test
158+
version: 1.0.0
159+
schemes:
160+
- http
161+
paths: {}
162+
""";
156163
var reader = new OpenApiStringReader(new OpenApiReaderSettings
157164
{
158165
BaseUrl = new Uri("https://bing.com")
@@ -168,14 +175,15 @@ public void JustSchemeWithCustomHostWithEmptyPath()
168175
[Fact]
169176
public void JustBasePathWithCustomHost()
170177
{
171-
var input = @"
172-
swagger: 2.0
173-
info:
174-
title: test
175-
version: 1.0.0
176-
basePath: /api
177-
paths: {}
178-
";
178+
var input =
179+
"""
180+
swagger: 2.0
181+
info:
182+
title: test
183+
version: 1.0.0
184+
basePath: /api
185+
paths: {}
186+
""";
179187
var reader = new OpenApiStringReader(new OpenApiReaderSettings
180188
{
181189
BaseUrl = new Uri("https://bing.com")
@@ -191,14 +199,15 @@ public void JustBasePathWithCustomHost()
191199
[Fact]
192200
public void JustHostWithCustomHost()
193201
{
194-
var input = @"
195-
swagger: 2.0
196-
info:
197-
title: test
198-
version: 1.0.0
199-
host: www.example.com
200-
paths: {}
201-
";
202+
var input =
203+
"""
204+
swagger: 2.0
205+
info:
206+
title: test
207+
version: 1.0.0
208+
host: www.example.com
209+
paths: {}
210+
""";
202211
var reader = new OpenApiStringReader(new OpenApiReaderSettings
203212
{
204213
BaseUrl = new Uri("https://bing.com")
@@ -214,14 +223,15 @@ public void JustHostWithCustomHost()
214223
[Fact]
215224
public void JustHostWithCustomHostWithApi()
216225
{
217-
var input = @"
218-
swagger: 2.0
219-
info:
220-
title: test
221-
version: 1.0.0
222-
host: prod.bing.com
223-
paths: {}
224-
";
226+
var input =
227+
"""
228+
swagger: 2.0
229+
info:
230+
title: test
231+
version: 1.0.0
232+
host: prod.bing.com
233+
paths: {}
234+
""";
225235
var reader = new OpenApiStringReader(new OpenApiReaderSettings
226236
{
227237
BaseUrl = new Uri("https://dev.bing.com/api/description.yaml")
@@ -237,16 +247,17 @@ public void JustHostWithCustomHostWithApi()
237247
[Fact]
238248
public void MultipleServers()
239249
{
240-
var input = @"
241-
swagger: 2.0
242-
info:
243-
title: test
244-
version: 1.0.0
245-
schemes:
246-
- http
247-
- https
248-
paths: {}
249-
";
250+
var input =
251+
"""
252+
swagger: 2.0
253+
info:
254+
title: test
255+
version: 1.0.0
256+
schemes:
257+
- http
258+
- https
259+
paths: {}
260+
""";
250261
var reader = new OpenApiStringReader(new OpenApiReaderSettings
251262
{
252263
BaseUrl = new Uri("https://dev.bing.com/api")
@@ -263,14 +274,15 @@ public void MultipleServers()
263274
[Fact]
264275
public void LocalHostWithCustomHost()
265276
{
266-
var input = @"
267-
swagger: 2.0
268-
info:
269-
title: test
270-
version: 1.0.0
271-
host: localhost:23232
272-
paths: {}
273-
";
277+
var input =
278+
"""
279+
swagger: 2.0
280+
info:
281+
title: test
282+
version: 1.0.0
283+
host: localhost:23232
284+
paths: {}
285+
""";
274286
var reader = new OpenApiStringReader(new OpenApiReaderSettings
275287
{
276288
BaseUrl = new Uri("https://bing.com")
@@ -286,14 +298,15 @@ public void LocalHostWithCustomHost()
286298
[Fact]
287299
public void InvalidHostShouldYieldError()
288300
{
289-
var input = @"
290-
swagger: 2.0
291-
info:
292-
title: test
293-
version: 1.0.0
294-
host: http://test.microsoft.com
295-
paths: {}
296-
";
301+
var input =
302+
"""
303+
swagger: 2.0
304+
info:
305+
title: test
306+
version: 1.0.0
307+
host: http://test.microsoft.com
308+
paths: {}
309+
""";
297310
var reader = new OpenApiStringReader(new OpenApiReaderSettings
298311
{
299312
BaseUrl = new Uri("https://bing.com")

0 commit comments

Comments
 (0)