Skip to content

Commit 5e9bb92

Browse files
committed
Update OpenApiWorkspaceTests.cs
1 parent f571bf5 commit 5e9bb92

File tree

1 file changed

+48
-3
lines changed

1 file changed

+48
-3
lines changed

test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,54 @@ public void OpenApiWorkspacesAllowDocumentsToReferenceEachOther()
2828
{
2929
var workspace = new OpenApiWorkspace();
3030

31-
workspace.AddDocument("root", new OpenApiDocument {Paths = new OpenApiPaths {["/"] = new OpenApiPathItem {Operations = new Dictionary<OperationType, OpenApiOperation> {[OperationType.Get] = new OpenApiOperation {Responses = new OpenApiResponses {["200"] = new OpenApiResponse {Content = new Dictionary<string, OpenApiMediaType> {["application/json"] = new OpenApiMediaType {Schema = new OpenApiSchema {Reference = new OpenApiReference {Id = "test", Type = ReferenceType.Schema}}}}}}}}}}});
32-
workspace.AddDocument("common", new OpenApiDocument {Components = new OpenApiComponents {Schemas = {["test"] = new OpenApiSchema {Type = "string", Description = "The referenced one"}}}});
33-
31+
workspace.AddDocument("root", new OpenApiDocument
32+
{
33+
Paths = new OpenApiPaths
34+
{
35+
["/"] = new OpenApiPathItem
36+
{
37+
Operations = new Dictionary<OperationType, OpenApiOperation>
38+
{
39+
[OperationType.Get] = new OpenApiOperation
40+
{
41+
Responses = new OpenApiResponses
42+
{
43+
["200"] = new OpenApiResponse
44+
{
45+
Content = new Dictionary<string,OpenApiMediaType>
46+
{
47+
["application/json"] = new OpenApiMediaType
48+
{
49+
Schema = new OpenApiSchema
50+
{
51+
Reference = new OpenApiReference
52+
{
53+
Id = "test",
54+
Type = ReferenceType.Schema
55+
}
56+
}
57+
}
58+
}
59+
}
60+
}
61+
}
62+
}
63+
}
64+
}
65+
});
66+
workspace.AddDocument("common", new OpenApiDocument
67+
{
68+
Components = new OpenApiComponents
69+
{
70+
Schemas = {
71+
["test"] = new OpenApiSchema
72+
{
73+
Type = "string",
74+
Description = "The referenced one"
75+
}
76+
}
77+
}
78+
});
3479
Assert.Equal(2, workspace.Documents.Count());
3580
}
3681

0 commit comments

Comments
 (0)