Skip to content

Commit a704fad

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

File tree

4 files changed

+22
-26
lines changed

4 files changed

+22
-26
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Globalization;
77
using System.IO;
88
using System.Threading.Tasks;
9-
using FluentAssertions;
109
using Microsoft.OpenApi.Any;
1110
using Microsoft.OpenApi.Extensions;
1211
using Microsoft.OpenApi.Interfaces;

test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Collections.Generic;
55
using System.Linq;
66
using System.Text.Json.Nodes;
7-
using FluentAssertions;
87
using Microsoft.OpenApi.Extensions;
98
using Microsoft.OpenApi.Models;
109
using Microsoft.OpenApi.Properties;
@@ -29,11 +28,11 @@ public void ValidateFieldIsRequiredInParameter()
2928

3029
// Assert
3130
Assert.NotEmpty(errors);
32-
errors.Select(e => e.Message).Should().BeEquivalentTo(new[]
31+
Assert.Equivalent(new[]
3332
{
3433
nameError,
3534
inError
36-
});
35+
}, errors.Select(e => e.Message));
3736
}
3837

3938
[Fact]
@@ -54,10 +53,10 @@ public void ValidateRequiredIsTrueWhenInIsPathInParameter()
5453
var errors = validator.Errors;
5554
// Assert
5655
Assert.NotEmpty(errors);
57-
errors.Select(e => e.Message).Should().BeEquivalentTo(new[]
56+
Assert.Equivalent(new[]
5857
{
5958
"\"required\" must be true when parameter location is \"path\""
60-
});
59+
}, errors.Select(e => e.Message));
6160
}
6261

6362
[Fact]
@@ -183,14 +182,14 @@ public void PathParameterNotInThePathShouldReturnAnError()
183182

184183
// Assert
185184
Assert.True(result);
186-
errors.OfType<OpenApiValidatorError>().Select(e => e.RuleName).Should().BeEquivalentTo(new[]
185+
Assert.Equivalent(new[]
187186
{
188187
"PathParameterShouldBeInThePath"
189-
});
190-
errors.Select(e => e.Pointer).Should().BeEquivalentTo(new[]
188+
}, errors.OfType<OpenApiValidatorError>().Select(e => e.RuleName));
189+
Assert.Equivalent(new[]
191190
{
192191
"#/in"
193-
});
192+
}, errors.Select(e => e.Pointer));
194193
}
195194

196195
[Fact]

test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Linq;
2-
using FluentAssertions;
32
using Microsoft.OpenApi.Extensions;
43
using Microsoft.OpenApi.Models;
54
using Microsoft.OpenApi.Properties;
@@ -24,7 +23,7 @@ public void ValidatePathsMustBeginWithSlash()
2423

2524
// Assert
2625
Assert.NotEmpty(errors);
27-
errors.Select(e => e.Message).Should().BeEquivalentTo(error);
26+
Assert.Equivalent(new string[] {error}, errors.Select(e => e.Message).ToArray());
2827
}
2928

3029
[Fact]
@@ -43,7 +42,7 @@ public void ValidatePathsAreUnique()
4342

4443
// Assert
4544
Assert.NotEmpty(errors);
46-
errors.Select(e => e.Message).Should().BeEquivalentTo(error);
45+
Assert.Equivalent(new string[] {error}, errors.Select(e => e.Message).ToArray());
4746
}
4847
[Fact]
4948
public void ValidatePathsAreUniqueDoesNotConsiderMultiParametersAsIdentical()

test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.Collections.Generic;
55
using System.Linq;
6-
using FluentAssertions;
76
using Microsoft.OpenApi.Interfaces;
87
using Microsoft.OpenApi.Models;
98
using Microsoft.OpenApi.Models.References;
@@ -23,12 +22,12 @@ public void LocateTopLevelObjects()
2322
var walker = new OpenApiWalker(locator);
2423
walker.Walk(doc);
2524

26-
locator.Locations.Should().BeEquivalentTo(new List<string> {
25+
Assert.Equivalent(new List<string> {
2726
"#/info",
2827
"#/servers",
2928
"#/paths",
3029
"#/tags"
31-
});
30+
}, locator.Locations);
3231
}
3332

3433
[Fact]
@@ -51,15 +50,15 @@ public void LocateTopLevelArrayItems()
5150
var walker = new OpenApiWalker(locator);
5251
walker.Walk(doc);
5352

54-
locator.Locations.Should().BeEquivalentTo(new List<string> {
53+
Assert.Equivalent(new List<string> {
5554
"#/info",
5655
"#/servers",
5756
"#/servers/0",
5857
"#/servers/1",
5958
"#/paths",
6059
"#/tags",
6160
"#/tags/0"
62-
});
61+
}, locator.Locations);
6362
}
6463

6564
[Fact]
@@ -96,7 +95,7 @@ public void LocatePathOperationContentSchema()
9695
var walker = new OpenApiWalker(locator);
9796
walker.Walk(doc);
9897

99-
locator.Locations.Should().BeEquivalentTo(new List<string> {
98+
Assert.Equivalent(new List<string> {
10099
"#/info",
101100
"#/servers",
102101
"#/paths",
@@ -110,9 +109,9 @@ public void LocatePathOperationContentSchema()
110109
"#/paths/~1test/get/tags",
111110
"#/tags",
112111

113-
});
112+
}, locator.Locations);
114113

115-
locator.Keys.Should().BeEquivalentTo(new List<string> { "/test", "Get", "200", "application/json" });
114+
Assert.Equivalent(new List<string> { "/test", "Get", "200", "application/json" }, locator.Keys);
116115
}
117116

118117
[Fact]
@@ -144,15 +143,15 @@ public void WalkDOMWithCycles()
144143
var walker = new OpenApiWalker(locator);
145144
walker.Walk(doc);
146145

147-
locator.Locations.Should().BeEquivalentTo(new List<string> {
146+
Assert.Equivalent(new List<string> {
148147
"#/info",
149148
"#/servers",
150149
"#/paths",
151150
"#/components",
152151
"#/components/schemas/loopy",
153152
"#/components/schemas/loopy/properties/name",
154153
"#/tags"
155-
});
154+
}, locator.Locations);
156155
}
157156

158157
/// <summary>
@@ -237,13 +236,13 @@ public void LocateReferences()
237236
var walker = new OpenApiWalker(locator);
238237
walker.Walk(doc);
239238

240-
locator.Locations.Where(l => l.StartsWith("referenceAt:")).Should().BeEquivalentTo(new List<string> {
239+
Assert.Equivalent(new List<string> {
241240
"referenceAt: #/paths/~1/get/responses/200/content/application~1json/schema",
242241
"referenceAt: #/paths/~1/get/responses/200/headers/test-header/schema",
243242
"referenceAt: #/components/schemas/derived/anyOf/0",
244243
"referenceAt: #/components/securitySchemes/test-secScheme",
245244
"referenceAt: #/components/headers/test-header/schema"
246-
});
245+
}, locator.Locations.Where(l => l.StartsWith("referenceAt:")));
247246
}
248247
}
249248

@@ -278,7 +277,7 @@ public override void Visit(OpenApiPathItem pathItem)
278277
Locations.Add(this.PathString);
279278
}
280279

281-
public override void Visit(OpenApiResponses responses)
280+
public override void Visit(OpenApiResponses response)
282281
{
283282
Locations.Add(this.PathString);
284283
}

0 commit comments

Comments
 (0)