-
Notifications
You must be signed in to change notification settings - Fork 275
Expand file tree
/
Copy pathCollectionExtensionsTests.cs
More file actions
145 lines (143 loc) · 5.51 KB
/
CollectionExtensionsTests.cs
File metadata and controls
145 lines (143 loc) · 5.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using VerifyXunit;
using Xunit;
namespace Microsoft.OpenApi.Tests.Extensions
{
public class CollectionExtensionsTests
{
public static readonly OpenApiDocument Document = new OpenApiDocument
{
Info = new OpenApiInfo { Title = "Test API", Version = "1.0" },
Paths = new OpenApiPaths
{
["pet"] = new OpenApiPathItem
{
Operations = new ()
{
[HttpMethod.Get] = new OpenApiOperation
{
Responses = new OpenApiResponses
{
["200"] = new OpenApiResponse
{
Description = "Return a 200 status to indicate that the data was received successfully"
}
}
}
}
},
["newPet"] = new OpenApiPathItem
{
Operations = new()
{
[HttpMethod.Post] = new OpenApiOperation
{
RequestBody = new OpenApiRequestBody
{
Description = "Information about a new pet in the system",
Content = new Dictionary<string, OpenApiMediaType>()
{
["application/json"] = new OpenApiMediaType
{
Schema = new OpenApiSchemaReference("Pet", null)
}
}
},
Responses = new OpenApiResponses
{
["200"] = new OpenApiResponse
{
Description = "Return a 200 status to indicate that the data was received successfully"
}
}
}
}
}
},
Components = new OpenApiComponents
{
Schemas = new Dictionary<string, IOpenApiSchema>()
{
["pet"] = new OpenApiSchema()
{
Required = new HashSet<string>
{
"id", "name"
},
Properties = new Dictionary<string, IOpenApiSchema>()
{
["name"] = new OpenApiSchema()
{
Type = JsonSchemaType.String
},
["id"] = new OpenApiSchema()
{
Type = JsonSchemaType.Integer,
Format = "int64"
},
["tag"] = new OpenApiSchema()
{
Type = JsonSchemaType.String
}
},
},
["newPet"] = new OpenApiSchema()
{
Type = JsonSchemaType.Object,
Required = new HashSet<string>
{
"name"
},
Properties = new Dictionary<string, IOpenApiSchema>()
{
["name"] = new OpenApiSchema()
{
Type = JsonSchemaType.String
},
["id"] = new OpenApiSchema()
{
Type = JsonSchemaType.Integer,
Format = "int64"
}
}
},
["errorModel"] = new OpenApiSchema()
{
Type = JsonSchemaType.Object,
Required = new HashSet<string>
{
"code",
"message"
},
Properties = new Dictionary<string, IOpenApiSchema>()
{
["message"] = new OpenApiSchema()
{
Type = JsonSchemaType.String
},
["code"] = new OpenApiSchema()
{
Type = JsonSchemaType.Integer,
Format = "int32"
}
}
}
}
}
};
public static TheoryData<OpenApiSpecVersion> OpenApiSpecVersions()
{
var values = new TheoryData<OpenApiSpecVersion>();
foreach (var value in Enum.GetValues<OpenApiSpecVersion>())
{
values.Add(value);
}
return values;
}
}
}