Skip to content

Commit d0bacd2

Browse files
committed
chore: additional FA replacement batch
Signed-off-by: Vincent Biret <[email protected]>
1 parent 4ecf8a4 commit d0bacd2

File tree

4 files changed

+41
-133
lines changed

4 files changed

+41
-133
lines changed

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

Lines changed: 2 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -57,104 +57,6 @@ public class OpenApiOperationTests
5757
}
5858
};
5959

60-
private static readonly OpenApiOperation _operationWithFormData =
61-
new OpenApiOperation
62-
{
63-
Summary = "Updates a pet in the store with form data",
64-
Description = "",
65-
OperationId = "updatePetWithForm",
66-
Parameters = new List<OpenApiParameter>
67-
{
68-
new OpenApiParameter
69-
{
70-
Name = "petId",
71-
In = ParameterLocation.Path,
72-
Description = "ID of pet that needs to be updated",
73-
Required = true,
74-
Schema = new()
75-
{
76-
Type = JsonSchemaType.String
77-
}
78-
}
79-
},
80-
RequestBody = new OpenApiRequestBody
81-
{
82-
Content =
83-
{
84-
["application/x-www-form-urlencoded"] = new OpenApiMediaType
85-
{
86-
Schema = new()
87-
{
88-
Type = JsonSchemaType.Object,
89-
Properties =
90-
{
91-
["name"] = new()
92-
{
93-
Description = "Updated name of the pet",
94-
Type = JsonSchemaType.String
95-
},
96-
["status"] = new()
97-
{
98-
Description = "Updated status of the pet",
99-
Type = JsonSchemaType.String
100-
}
101-
},
102-
Required = new HashSet<string>
103-
{
104-
"name"
105-
}
106-
}
107-
},
108-
["multipart/form-data"] = new OpenApiMediaType
109-
{
110-
Schema = new()
111-
{
112-
Type = JsonSchemaType.Object,
113-
Properties =
114-
{
115-
["name"] = new()
116-
{
117-
Description = "Updated name of the pet",
118-
Type = JsonSchemaType.String
119-
},
120-
["status"] = new()
121-
{
122-
Description = "Updated status of the pet",
123-
Type = JsonSchemaType.String
124-
}
125-
},
126-
Required = new HashSet<string>
127-
{
128-
"name"
129-
}
130-
}
131-
}
132-
}
133-
},
134-
Responses = new OpenApiResponses
135-
{
136-
["200"] = new OpenApiResponse
137-
{
138-
Description = "Pet updated.",
139-
Content = new Dictionary<string, OpenApiMediaType>
140-
{
141-
["application/json"] = new OpenApiMediaType(),
142-
["application/xml"] = new OpenApiMediaType()
143-
}
144-
145-
},
146-
["405"] = new OpenApiResponse
147-
{
148-
Description = "Invalid input",
149-
Content = new Dictionary<string, OpenApiMediaType>
150-
{
151-
["application/json"] = new OpenApiMediaType(),
152-
["application/xml"] = new OpenApiMediaType()
153-
}
154-
}
155-
}
156-
};
157-
15860
private static readonly OpenApiOperation _operationWithBody = new OpenApiOperation
15961
{
16062
Summary = "Updates a pet in the store with request body",
@@ -230,7 +132,7 @@ public void ParseBasicOperationShouldSucceed()
230132
var operation = OpenApiV2Deserializer.LoadOperation(node);
231133

232134
// Assert
233-
operation.Should().BeEquivalentTo(_basicOperation);
135+
Assert.Equivalent(_basicOperation, operation);
234136
}
235137

236138
[Fact]
@@ -248,7 +150,7 @@ public async Task ParseBasicOperationTwiceShouldYieldSameObject()
248150
var operation = OpenApiV2Deserializer.LoadOperation(node);
249151

250152
// Assert
251-
operation.Should().BeEquivalentTo(_basicOperation);
153+
Assert.Equivalent(_basicOperation, operation);
252154
}
253155

254156
[Fact]

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

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void ParsePathParameterShouldSucceed()
5050
var parameter = OpenApiV2Deserializer.LoadParameter(node);
5151

5252
// Assert
53-
parameter.Should().BeEquivalentTo(
53+
Assert.Equivalent(
5454
new OpenApiParameter
5555
{
5656
In = ParameterLocation.Path,
@@ -61,7 +61,8 @@ public void ParsePathParameterShouldSucceed()
6161
{
6262
Type = JsonSchemaType.String
6363
}
64-
});
64+
},
65+
parameter);
6566
}
6667

6768
[Fact]
@@ -78,7 +79,7 @@ public void ParseQueryParameterShouldSucceed()
7879
var parameter = OpenApiV2Deserializer.LoadParameter(node);
7980

8081
// Assert
81-
parameter.Should().BeEquivalentTo(
82+
Assert.Equivalent(
8283
new OpenApiParameter
8384
{
8485
In = ParameterLocation.Query,
@@ -95,7 +96,8 @@ public void ParseQueryParameterShouldSucceed()
9596
},
9697
Style = ParameterStyle.Form,
9798
Explode = true
98-
});
99+
},
100+
parameter);
99101
}
100102

101103
[Fact]
@@ -112,7 +114,7 @@ public void ParseParameterWithNullLocationShouldSucceed()
112114
var parameter = OpenApiV2Deserializer.LoadParameter(node);
113115

114116
// Assert
115-
parameter.Should().BeEquivalentTo(
117+
Assert.Equivalent(
116118
new OpenApiParameter
117119
{
118120
In = null,
@@ -123,7 +125,8 @@ public void ParseParameterWithNullLocationShouldSucceed()
123125
{
124126
Type = JsonSchemaType.String
125127
}
126-
});
128+
},
129+
parameter);
127130
}
128131

129132
[Fact]
@@ -140,7 +143,7 @@ public void ParseParameterWithNoLocationShouldSucceed()
140143
var parameter = OpenApiV2Deserializer.LoadParameter(node);
141144

142145
// Assert
143-
parameter.Should().BeEquivalentTo(
146+
Assert.Equivalent(
144147
new OpenApiParameter
145148
{
146149
In = null,
@@ -151,7 +154,8 @@ public void ParseParameterWithNoLocationShouldSucceed()
151154
{
152155
Type = JsonSchemaType.String
153156
}
154-
});
157+
},
158+
parameter);
155159
}
156160

157161
[Fact]
@@ -168,14 +172,15 @@ public void ParseParameterWithNoSchemaShouldSucceed()
168172
var parameter = OpenApiV2Deserializer.LoadParameter(node);
169173

170174
// Assert
171-
parameter.Should().BeEquivalentTo(
175+
Assert.Equivalent(
172176
new OpenApiParameter
173177
{
174178
In = null,
175179
Name = "username",
176180
Description = "username to fetch",
177181
Required = false
178-
});
182+
},
183+
parameter);
179184
}
180185

181186
[Fact]
@@ -192,7 +197,7 @@ public void ParseParameterWithUnknownLocationShouldSucceed()
192197
var parameter = OpenApiV2Deserializer.LoadParameter(node);
193198

194199
// Assert
195-
parameter.Should().BeEquivalentTo(
200+
Assert.Equivalent(
196201
new OpenApiParameter
197202
{
198203
In = null,
@@ -203,7 +208,8 @@ public void ParseParameterWithUnknownLocationShouldSucceed()
203208
{
204209
Type = JsonSchemaType.String
205210
}
206-
});
211+
},
212+
parameter);
207213
}
208214

209215
[Fact]

test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public async Task ParsePathParameterShouldSucceed()
3232
var parameter = await OpenApiModelFactory.LoadAsync<OpenApiParameter>(stream, OpenApiSpecVersion.OpenApi3_0);
3333

3434
// Assert
35-
parameter.Should().BeEquivalentTo(
35+
Assert.Equivalent(
3636
new OpenApiParameter
3737
{
3838
In = ParameterLocation.Path,
@@ -43,7 +43,7 @@ public async Task ParsePathParameterShouldSucceed()
4343
{
4444
Type = JsonSchemaType.String
4545
}
46-
});
46+
}, parameter);
4747
}
4848

4949
[Fact]
@@ -53,7 +53,7 @@ public async Task ParseQueryParameterShouldSucceed()
5353
var parameter = await OpenApiModelFactory.LoadAsync<OpenApiParameter>(Path.Combine(SampleFolderPath, "queryParameter.yaml"), OpenApiSpecVersion.OpenApi3_0);
5454

5555
// Assert
56-
parameter.Should().BeEquivalentTo(
56+
Assert.Equivalent(
5757
new OpenApiParameter
5858
{
5959
In = ParameterLocation.Query,
@@ -70,7 +70,7 @@ public async Task ParseQueryParameterShouldSucceed()
7070
},
7171
Style = ParameterStyle.Form,
7272
Explode = true
73-
});
73+
}, parameter);
7474
}
7575

7676
[Fact]
@@ -80,7 +80,7 @@ public async Task ParseQueryParameterWithObjectTypeShouldSucceed()
8080
var parameter = await OpenApiModelFactory.LoadAsync<OpenApiParameter>(Path.Combine(SampleFolderPath, "queryParameterWithObjectType.yaml"), OpenApiSpecVersion.OpenApi3_0);
8181

8282
// Assert
83-
parameter.Should().BeEquivalentTo(
83+
Assert.Equivalent(
8484
new OpenApiParameter
8585
{
8686
In = ParameterLocation.Query,
@@ -94,7 +94,7 @@ public async Task ParseQueryParameterWithObjectTypeShouldSucceed()
9494
}
9595
},
9696
Style = ParameterStyle.Form
97-
});
97+
}, parameter);
9898
}
9999

100100
[Fact]
@@ -107,7 +107,7 @@ public async Task ParseQueryParameterWithObjectTypeAndContentShouldSucceed()
107107
var parameter = await OpenApiModelFactory.LoadAsync<OpenApiParameter>(stream, OpenApiSpecVersion.OpenApi3_0);
108108

109109
// Assert
110-
parameter.Should().BeEquivalentTo(
110+
Assert.Equivalent(
111111
new OpenApiParameter
112112
{
113113
In = ParameterLocation.Query,
@@ -138,7 +138,7 @@ public async Task ParseQueryParameterWithObjectTypeAndContentShouldSucceed()
138138
}
139139
}
140140
}
141-
});
141+
}, parameter);
142142
}
143143

144144
[Fact]
@@ -148,7 +148,7 @@ public async Task ParseHeaderParameterShouldSucceed()
148148
var parameter = await OpenApiModelFactory.LoadAsync<OpenApiParameter>(Path.Combine(SampleFolderPath, "headerParameter.yaml"), OpenApiSpecVersion.OpenApi3_0);
149149

150150
// Assert
151-
parameter.Should().BeEquivalentTo(
151+
Assert.Equivalent(
152152
new OpenApiParameter
153153
{
154154
In = ParameterLocation.Header,
@@ -166,7 +166,7 @@ public async Task ParseHeaderParameterShouldSucceed()
166166
Format = "int64",
167167
}
168168
}
169-
});
169+
}, parameter);
170170
}
171171

172172
[Fact]
@@ -176,7 +176,7 @@ public async Task ParseParameterWithNullLocationShouldSucceed()
176176
var parameter = await OpenApiModelFactory.LoadAsync<OpenApiParameter>(Path.Combine(SampleFolderPath, "parameterWithNullLocation.yaml"), OpenApiSpecVersion.OpenApi3_0);
177177

178178
// Assert
179-
parameter.Should().BeEquivalentTo(
179+
Assert.Equivalent(
180180
new OpenApiParameter
181181
{
182182
In = null,
@@ -187,7 +187,7 @@ public async Task ParseParameterWithNullLocationShouldSucceed()
187187
{
188188
Type = JsonSchemaType.String
189189
}
190-
});
190+
}, parameter);
191191
}
192192

193193
[Fact]
@@ -200,7 +200,7 @@ public async Task ParseParameterWithNoLocationShouldSucceed()
200200
var parameter = await OpenApiModelFactory.LoadAsync<OpenApiParameter>(stream, OpenApiSpecVersion.OpenApi3_0);
201201

202202
// Assert
203-
parameter.Should().BeEquivalentTo(
203+
Assert.Equivalent(
204204
new OpenApiParameter
205205
{
206206
In = null,
@@ -211,7 +211,7 @@ public async Task ParseParameterWithNoLocationShouldSucceed()
211211
{
212212
Type = JsonSchemaType.String
213213
}
214-
});
214+
}, parameter);
215215
}
216216

217217
[Fact]
@@ -224,7 +224,7 @@ public async Task ParseParameterWithUnknownLocationShouldSucceed()
224224
var parameter = await OpenApiModelFactory.LoadAsync<OpenApiParameter>(stream, OpenApiSpecVersion.OpenApi3_0);
225225

226226
// Assert
227-
parameter.Should().BeEquivalentTo(
227+
Assert.Equivalent(
228228
new OpenApiParameter
229229
{
230230
In = null,
@@ -235,7 +235,7 @@ public async Task ParseParameterWithUnknownLocationShouldSucceed()
235235
{
236236
Type = JsonSchemaType.String
237237
}
238-
});
238+
}, parameter);
239239
}
240240

241241
[Fact]

0 commit comments

Comments
 (0)