Skip to content

Commit 862504f

Browse files
committed
Clean up tests
1 parent 970a74c commit 862504f

4 files changed

+40
-38
lines changed

test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDocumentWithWebhooksAsV3JsonWorks_produceTerseOutput=False.verified.txt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,6 @@
55
"version": "1.0.0"
66
},
77
"paths": { },
8-
"webhooks": {
9-
"newPet": {
10-
"post": {
11-
"requestBody": {
12-
"description": "Information about a new pet in the system",
13-
"content": {
14-
"application/json": {
15-
"schema": {
16-
"$ref": "#/components/schemas/Pet"
17-
}
18-
}
19-
}
20-
},
21-
"responses": {
22-
"200": {
23-
"description": "Return a 200 status to indicate that the data was received successfully"
24-
}
25-
}
26-
}
27-
}
28-
},
298
"components": {
309
"schemas": {
3110
"Pet": {
@@ -47,5 +26,26 @@
4726
}
4827
}
4928
}
29+
},
30+
"webhooks": {
31+
"newPet": {
32+
"post": {
33+
"requestBody": {
34+
"description": "Information about a new pet in the system",
35+
"content": {
36+
"application/json": {
37+
"schema": {
38+
"$ref": "#/components/schemas/Pet"
39+
}
40+
}
41+
}
42+
},
43+
"responses": {
44+
"200": {
45+
"description": "Return a 200 status to indicate that the data was received successfully"
46+
}
47+
}
48+
}
49+
}
5050
}
5151
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"openapi":"3.1.0","info":{"title":"Webhook Example","version":"1.0.0"},"paths":{},"webhooks":{"newPet":{"post":{"requestBody":{"description":"Information about a new pet in the system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pet"}}}},"responses":{"200":{"description":"Return a 200 status to indicate that the data was received successfully"}}}}},"components":{"schemas":{"Pet":{"required":["id","name"],"properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}}}}
1+
{"openapi":"3.1.0","info":{"title":"Webhook Example","version":"1.0.0"},"paths":{},"components":{"schemas":{"Pet":{"required":["id","name"],"properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}}},"webhooks":{"newPet":{"post":{"requestBody":{"description":"Information about a new pet in the system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pet"}}}},"responses":{"200":{"description":"Return a 200 status to indicate that the data was received successfully"}}}}}}

test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
using Microsoft.OpenApi.Models;
1313
using Microsoft.OpenApi.Readers;
1414
using Microsoft.OpenApi.Writers;
15+
using Microsoft.VisualBasic;
1516
using VerifyXunit;
1617
using Xunit;
1718
using Xunit.Abstractions;
19+
using static System.Net.Mime.MediaTypeNames;
1820

1921
namespace Microsoft.OpenApi.Tests.Models
2022
{
@@ -1456,18 +1458,6 @@ public void SerializeDocumentWithWebhooksAsV3YamlWorks()
14561458
title: Webhook Example
14571459
version: 1.0.0
14581460
paths: { }
1459-
webhooks:
1460-
newPet:
1461-
post:
1462-
requestBody:
1463-
description: Information about a new pet in the system
1464-
content:
1465-
application/json:
1466-
schema:
1467-
$ref: '#/components/schemas/Pet'
1468-
responses:
1469-
'200':
1470-
description: Return a 200 status to indicate that the data was received successfully
14711461
components:
14721462
schemas:
14731463
Pet:
@@ -1481,7 +1471,19 @@ public void SerializeDocumentWithWebhooksAsV3YamlWorks()
14811471
name:
14821472
type: string
14831473
tag:
1484-
type: string";
1474+
type: string
1475+
webhooks:
1476+
newPet:
1477+
post:
1478+
requestBody:
1479+
description: Information about a new pet in the system
1480+
content:
1481+
application/json:
1482+
schema:
1483+
$ref: '#/components/schemas/Pet'
1484+
responses:
1485+
'200':
1486+
description: Return a 200 status to indicate that the data was received successfully";
14851487

14861488
// Act
14871489
var actual = DocumentWithWebhooks.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_1);
@@ -1507,10 +1509,10 @@ public void SerializeDocumentWithRootJsonSchemaDialectPropertyWorks()
15071509
};
15081510

15091511
var expected = @"openapi: '3.1.0'
1512+
jsonSchemaDialect: http://json-schema.org/draft-07/schema#
15101513
info:
15111514
title: JsonSchemaDialectTest
15121515
version: 1.0.0
1513-
jsonSchemaDialect: http://json-schema.org/draft-07/schema#
15141516
paths: { }";
15151517

15161518
// Act

test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public void InfoVersionShouldAcceptDateStyledAsVersions()
206206
}
207207

208208
[Fact]
209-
public void SerializeInfoObjectWithSummaryAsV3YamlWorks()
209+
public void SerializeInfoObjectWithSummaryAsV31YamlWorks()
210210
{
211211
// Arrange
212212
var expected = @"title: Sample Pet Store App
@@ -224,7 +224,7 @@ public void SerializeInfoObjectWithSummaryAsV3YamlWorks()
224224
}
225225

226226
[Fact]
227-
public void SerializeInfoObjectWithSummaryAsV3JsonWorks()
227+
public void SerializeInfoObjectWithSummaryAsV31JsonWorks()
228228
{
229229
// Arrange
230230
var expected = @"{

0 commit comments

Comments
 (0)