From 78802161a037a9df5a13616afa9278f081279b55 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 09:07:00 -0500 Subject: [PATCH 01/16] chore: migrates of FA to xunit first batch Signed-off-by: Vincent Biret --- .../OpenApiDiagnosticTests.cs | 13 +++--- .../UnsupportedSpecVersionTests.cs | 3 +- .../ParseNodeTests.cs | 9 ++-- .../ConvertToOpenApiReferenceV2Tests.cs | 37 ++++++++--------- .../ConvertToOpenApiReferenceV3Tests.cs | 41 +++++++++---------- .../TestCustomExtension.cs | 7 ++-- .../V2Tests/OpenApiContactTests.cs | 7 ++-- .../V2Tests/OpenApiParameterTests.cs | 2 +- .../V3Tests/OpenApiDocumentTests.cs | 4 +- .../V3Tests/OpenApiExampleTests.cs | 2 +- .../Expressions/RuntimeExpressionTests.cs | 6 +-- .../Models/OpenApiReferenceTests.cs | 2 +- .../OpenApiHeaderValidationTests.cs | 4 +- .../OpenApiMediaTypeValidationTests.cs | 4 +- .../OpenApiParameterValidationTests.cs | 9 ++-- .../OpenApiPathsValidationTests.cs | 2 +- .../OpenApiSchemaValidationTests.cs | 18 ++++---- .../Writers/OpenApiJsonWriterTests.cs | 5 +-- .../OpenApiWriterAnyExtensionsTests.cs | 16 ++++---- .../OpenApiWriterSpecialCharacterTests.cs | 11 +++-- .../Writers/OpenApiYamlWriterTests.cs | 9 ++-- 21 files changed, 97 insertions(+), 114 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs index 497de0088..667bedbd1 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs @@ -1,11 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Collections.Generic; using System.Threading.Tasks; using System; -using FluentAssertions; -using Microsoft.OpenApi.Exceptions; using Microsoft.OpenApi.Models; using Xunit; using System.IO; @@ -27,8 +24,8 @@ public async Task DetectedSpecificationVersionShouldBeV2_0() { var actual = await OpenApiDocument.LoadAsync("V2Tests/Samples/basic.v2.yaml"); - actual.Diagnostic.Should().NotBeNull(); - actual.Diagnostic.SpecificationVersion.Should().Be(OpenApiSpecVersion.OpenApi2_0); + Assert.NotNull(actual.Diagnostic); + Assert.Equal(OpenApiSpecVersion.OpenApi2_0, actual.Diagnostic.SpecificationVersion); } [Fact] @@ -36,8 +33,8 @@ public async Task DetectedSpecificationVersionShouldBeV3_0() { var actual = await OpenApiDocument.LoadAsync("V3Tests/Samples/OpenApiDocument/minimalDocument.yaml"); - actual.Diagnostic.Should().NotBeNull(); - actual.Diagnostic.SpecificationVersion.Should().Be(OpenApiSpecVersion.OpenApi3_0); + Assert.NotNull(actual.Diagnostic); + Assert.Equal(OpenApiSpecVersion.OpenApi3_0, actual.Diagnostic.SpecificationVersion); } [Fact] @@ -56,7 +53,7 @@ public async Task DiagnosticReportMergedForExternalReferenceAsync() Assert.NotNull(result); Assert.NotNull(result.Document.Workspace); - result.Diagnostic.Errors.Should().BeEmpty(); + Assert.Empty(result.Diagnostic.Errors); } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/UnsupportedSpecVersionTests.cs b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/UnsupportedSpecVersionTests.cs index 1f6cbb7e8..83d7c33d5 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/UnsupportedSpecVersionTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/UnsupportedSpecVersionTests.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Exceptions; using Microsoft.OpenApi.Models; using Xunit; @@ -21,7 +20,7 @@ public async Task ThrowOpenApiUnsupportedSpecVersionException() } catch (OpenApiUnsupportedSpecVersionException exception) { - exception.SpecificationVersion.Should().Be("1.0.0"); + Assert.Equal("1.0.0", exception.SpecificationVersion); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/ParseNodeTests.cs b/test/Microsoft.OpenApi.Readers.Tests/ParseNodeTests.cs index 0e5eae1c8..e8d22a14a 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/ParseNodeTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/ParseNodeTests.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System.Collections.Generic; -using FluentAssertions; using Microsoft.OpenApi.Exceptions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; @@ -33,9 +32,9 @@ public void BrokenSimpleList() var result = OpenApiDocument.Parse(input, "yaml"); - result.Diagnostic.Errors.Should().BeEquivalentTo(new List() { + Assert.Equivalent(new List() { new OpenApiError(new OpenApiReaderException("Expected a value.")) - }); + }, result.Diagnostic.Errors); } [Fact] @@ -59,12 +58,12 @@ public void BadSchema() var res= OpenApiDocument.Parse(input, "yaml"); - res.Diagnostic.Errors.Should().BeEquivalentTo(new List + Assert.Equivalent(new List { new(new OpenApiReaderException("schema must be a map/object") { Pointer = "#/paths/~1foo/get/responses/200/content/application~1json/schema" }) - }); + }, res.Diagnostic.Errors); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/ConvertToOpenApiReferenceV2Tests.cs b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/ConvertToOpenApiReferenceV2Tests.cs index abdbfcb9c..59c8a81f8 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/ConvertToOpenApiReferenceV2Tests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/ConvertToOpenApiReferenceV2Tests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.V2; @@ -31,9 +30,9 @@ public void ParseExternalReferenceToV2OpenApi() var reference = versionService.ConvertToOpenApiReference(input, null); // Assert - reference.ExternalResource.Should().Be(externalResource); - reference.Type.Should().NotBeNull(); - reference.Id.Should().Be(id); + Assert.Equal(externalResource, reference.ExternalResource); + Assert.NotNull(reference.Type); + Assert.Equal(id, reference.Id); } [Fact] @@ -49,9 +48,9 @@ public void ParseExternalReference() var reference = versionService.ConvertToOpenApiReference(input, null); // Assert - reference.ExternalResource.Should().Be(externalResource); - reference.Type.Should().BeNull(); - reference.Id.Should().Be(id); + Assert.Equal(externalResource, reference.ExternalResource); + Assert.Null(reference.Type); + Assert.Equal(id, reference.Id); } [Fact] @@ -67,9 +66,9 @@ public void ParseLocalParameterReference() var reference = versionService.ConvertToOpenApiReference(input, referenceType); // Assert - reference.Type.Should().Be(referenceType); - reference.ExternalResource.Should().BeNull(); - reference.Id.Should().Be(id); + Assert.Equal(referenceType, reference.Type); + Assert.Null(reference.ExternalResource); + Assert.Equal(id, reference.Id); } [Fact] @@ -85,9 +84,9 @@ public void ParseLocalSchemaReference() var reference = versionService.ConvertToOpenApiReference(input, referenceType); // Assert - reference.Type.Should().Be(referenceType); - reference.ExternalResource.Should().BeNull(); - reference.Id.Should().Be(id); + Assert.Equal(referenceType, reference.Type); + Assert.Null(reference.ExternalResource); + Assert.Equal(id, reference.Id); } [Fact] @@ -103,9 +102,9 @@ public void ParseTagReference() var reference = versionService.ConvertToOpenApiReference(input, referenceType); // Assert - reference.Type.Should().Be(referenceType); - reference.ExternalResource.Should().BeNull(); - reference.Id.Should().Be(id); + Assert.Equal(referenceType, reference.Type); + Assert.Null(reference.ExternalResource); + Assert.Equal(id, reference.Id); } [Fact] @@ -121,9 +120,9 @@ public void ParseSecuritySchemeReference() var reference = versionService.ConvertToOpenApiReference(input, referenceType); // Assert - reference.Type.Should().Be(referenceType); - reference.ExternalResource.Should().BeNull(); - reference.Id.Should().Be(id); + Assert.Equal(referenceType, reference.Type); + Assert.Null(reference.ExternalResource); + Assert.Equal(id, reference.Id); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/ConvertToOpenApiReferenceV3Tests.cs b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/ConvertToOpenApiReferenceV3Tests.cs index 6f4d53acb..0104f5208 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/ConvertToOpenApiReferenceV3Tests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/ConvertToOpenApiReferenceV3Tests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.V3; @@ -31,9 +30,9 @@ public void ParseExternalReference() var reference = versionService.ConvertToOpenApiReference(input, null); // Assert - reference.Type.Should().BeNull(); - reference.ExternalResource.Should().Be(externalResource); - reference.Id.Should().Be(id); + Assert.Null(reference.Type); + Assert.Equal(externalResource, reference.ExternalResource); + Assert.Equal(id, reference.Id); } [Fact] @@ -49,9 +48,9 @@ public void ParseLocalParameterReference() var reference = versionService.ConvertToOpenApiReference(input, referenceType); // Assert - reference.Type.Should().Be(referenceType); - reference.ExternalResource.Should().BeNull(); - reference.Id.Should().Be(id); + Assert.Equal(referenceType, reference.Type); + Assert.Null(reference.ExternalResource); + Assert.Equal(id, reference.Id); } [Fact] @@ -67,9 +66,9 @@ public void ParseLocalSchemaReference() var reference = versionService.ConvertToOpenApiReference(input, referenceType); // Assert - reference.Type.Should().Be(referenceType); - reference.ExternalResource.Should().BeNull(); - reference.Id.Should().Be(id); + Assert.Equal(referenceType, reference.Type); + Assert.Null(reference.ExternalResource); + Assert.Equal(id, reference.Id); } [Fact] @@ -85,9 +84,9 @@ public void ParseTagReference() var reference = versionService.ConvertToOpenApiReference(input, referenceType); // Assert - reference.Type.Should().Be(referenceType); - reference.ExternalResource.Should().BeNull(); - reference.Id.Should().Be(id); + Assert.Equal(referenceType, reference.Type); + Assert.Null(reference.ExternalResource); + Assert.Equal(id, reference.Id); } [Fact] @@ -103,9 +102,9 @@ public void ParseSecuritySchemeReference() var reference = versionService.ConvertToOpenApiReference(input, referenceType); // Assert - reference.Type.Should().Be(referenceType); - reference.ExternalResource.Should().BeNull(); - reference.Id.Should().Be(id); + Assert.Equal(referenceType, reference.Type); + Assert.Null(reference.ExternalResource); + Assert.Equal(id, reference.Id); } [Fact] @@ -120,8 +119,8 @@ public void ParseLocalFileReference() var reference = versionService.ConvertToOpenApiReference(input, referenceType); // Assert - reference.Type.Should().Be(referenceType); - reference.ExternalResource.Should().Be(input); + Assert.Equal(referenceType, reference.Type); + Assert.Equal(input, reference.ExternalResource); } [Fact] @@ -138,9 +137,9 @@ public void ParseExternalPathReference() var reference = versionService.ConvertToOpenApiReference(input, null); // Assert - reference.Type.Should().BeNull(); - reference.ExternalResource.Should().Be(externalResource); - reference.Id.Should().Be(id); + Assert.Null(reference.Type); + Assert.Equal(externalResource, reference.ExternalResource); + Assert.Equal(id, reference.Id); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs b/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs index 9e7d19c7f..8de46ad64 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System.Text.Json.Nodes; -using FluentAssertions; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; @@ -44,9 +43,9 @@ public void ParseCustomExtension() var fooExtension = actual.Document.Info.Extensions["x-foo"] as FooExtension; - fooExtension.Should().NotBeNull(); - fooExtension.Bar.Should().Be("hey"); - fooExtension.Baz.Should().Be("hi!"); + Assert.NotNull(fooExtension); + Assert.Equal("hey", fooExtension.Bar); + Assert.Equal("hi!", fooExtension.Baz); } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiContactTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiContactTests.cs index 413d3ee7b..9533f8751 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiContactTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiContactTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Xunit; @@ -26,15 +25,15 @@ public void ParseStringContactFragmentShouldSucceed() var contact = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi2_0, out var diagnostic); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); - contact.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiContact { Email = "support@swagger.io", Name = "API Support", Url = new("http://www.swagger.io/support") - }); + }, contact); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs index 0b4b1a77e..d89080f6d 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs @@ -33,7 +33,7 @@ public void ParseBodyParameterShouldSucceed() // Assert // Body parameter is currently not translated via LoadParameter. // This design may be revisited and this unit test may likely change. - parameter.Should().BeNull(); + Assert.Null(parameter); } [Fact] diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs index 864bb5aaa..68102328f 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs @@ -117,7 +117,7 @@ public async Task ParseBasicDocumentWithMultipleServersShouldSucceed() var path = System.IO.Path.Combine(SampleFolderPath, "basicDocumentWithMultipleServers.yaml"); var result = await OpenApiDocument.LoadAsync(path); - result.Diagnostic.Errors.Should().BeEmpty(); + Assert.Empty(result.Diagnostic.Errors); result.Document.Should().BeEquivalentTo( new OpenApiDocument { @@ -1409,7 +1409,7 @@ public void ParseBasicDocumentWithServerVariableAndNoDefaultShouldFail() public async Task ParseDocumentWithEmptyPathsSucceeds() { var result = await OpenApiDocument.LoadAsync(System.IO.Path.Combine(SampleFolderPath, "docWithEmptyPaths.yaml")); - result.Diagnostic.Errors.Should().BeEmpty(); + Assert.Empty(result.Diagnostic.Errors); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs index 633a0f688..95ee7076a 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs @@ -78,7 +78,7 @@ public async Task ParseAdvancedExampleShouldSucceed() public async Task ParseExampleForcedStringSucceed() { var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "explicitString.yaml")); - result.Diagnostic.Errors.Should().BeEmpty(); + Assert.Empty(result.Diagnostic.Errors); } } } diff --git a/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs b/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs index 70c7dc90d..fe6fde3d6 100644 --- a/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs +++ b/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs @@ -222,7 +222,7 @@ public void CompositeRuntimeExpressionWithMultipleRuntimeExpressionsAndFakeBrace var runtimeExpression = RuntimeExpression.Build(expression); // Assert - runtimeExpression.Should().NotBeNull(); + Assert.NotNull(runtimeExpression); runtimeExpression.Should().BeOfType(typeof(CompositeExpression)); var response = (CompositeExpression)runtimeExpression; response.Expression.Should().Be(expression); @@ -262,7 +262,7 @@ public void CompositeRuntimeExpressionWithoutRecognizedRuntimeExpressions(string var runtimeExpression = RuntimeExpression.Build(expression); // Assert - runtimeExpression.Should().NotBeNull(); + Assert.NotNull(runtimeExpression); runtimeExpression.Should().BeOfType(typeof(CompositeExpression)); var response = (CompositeExpression)runtimeExpression; response.Expression.Should().Be(expression); @@ -270,7 +270,7 @@ public void CompositeRuntimeExpressionWithoutRecognizedRuntimeExpressions(string var compositeExpression = runtimeExpression as CompositeExpression; // The whole string is treated as the template without any contained expressions. - compositeExpression.ContainedExpressions.Should().BeEmpty(); + Assert.Empty(compositeExpression.ContainedExpressions); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs index 4e6e47509..46d044c7c 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs @@ -29,7 +29,7 @@ public void SettingInternalReferenceForComponentsStyleReferenceShouldSucceed( }; // Assert - reference.ExternalResource.Should().BeNull(); + Assert.Null(reference.ExternalResource); reference.Type.Should().Be(type); reference.Id.Should().Be(id); diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiHeaderValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiHeaderValidationTests.cs index 25423ab1f..5f067a3b2 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiHeaderValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiHeaderValidationTests.cs @@ -43,7 +43,7 @@ public void ValidateExampleShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeFalse(); + Assert.False(result); } [Fact] @@ -102,7 +102,7 @@ public void ValidateExamplesShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeTrue(); + Assert.True(result); } } } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiMediaTypeValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiMediaTypeValidationTests.cs index 51a8e1795..a3729e0b1 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiMediaTypeValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiMediaTypeValidationTests.cs @@ -39,7 +39,7 @@ public void ValidateExampleShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeTrue(); + Assert.True(result); } [Fact] @@ -98,7 +98,7 @@ public void ValidateExamplesShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeTrue(); + Assert.True(result); } } } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs index 3f380c7f1..83d1a2e1a 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Text.Json.Nodes; using FluentAssertions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Properties; @@ -88,7 +87,7 @@ public void ValidateExampleShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeTrue(); + Assert.True(result); } [Fact] @@ -153,7 +152,7 @@ public void ValidateExamplesShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeFalse(); + Assert.False(result); } [Fact] @@ -183,7 +182,7 @@ public void PathParameterNotInThePathShouldReturnAnError() var result = errors.Any(); // Assert - result.Should().BeTrue(); + Assert.True(result); errors.OfType().Select(e => e.RuleName).Should().BeEquivalentTo(new[] { "PathParameterShouldBeInThePath" @@ -226,7 +225,7 @@ public void PathParameterInThePathShouldBeOk() var result = errors.Any(); // Assert - result.Should().BeFalse(); + Assert.False(result); } } } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs index 6d0282748..bbe15c66e 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs @@ -60,7 +60,7 @@ public void ValidatePathsAreUniqueDoesNotConsiderMultiParametersAsIdentical() var errors = paths.Validate(ValidationRuleSet.GetDefaultRuleSet()); // Assert - errors.Should().BeEmpty(); + Assert.Empty(errors); } [Fact] public void ValidatePathsAreUniqueConsidersMultiParametersAsIdentical() diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiSchemaValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiSchemaValidationTests.cs index d2aa19590..9edd57c1e 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiSchemaValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiSchemaValidationTests.cs @@ -5,14 +5,12 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; -using FluentAssertions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Properties; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Validations.Rules; using Xunit; -using Microsoft.OpenApi.Extensions; namespace Microsoft.OpenApi.Validations.Tests { @@ -39,7 +37,7 @@ public void ValidateDefaultShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeTrue(); + Assert.True(result); } [Fact] @@ -64,7 +62,7 @@ public void ValidateExampleAndDefaultShouldNotHaveDataTypeMismatchForSimpleSchem var expectedWarnings = warnings.Select(e => e.Message).ToList(); // Assert - result.Should().BeTrue(); + Assert.True(result); } [Fact] @@ -106,7 +104,7 @@ public void ValidateEnumShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeTrue(); + Assert.True(result); } [Fact] @@ -184,7 +182,7 @@ public void ValidateDefaultShouldNotHaveDataTypeMismatchForComplexSchema() bool result = !warnings.Any(); // Assert - result.Should().BeFalse(); + Assert.False(result); } [Fact] @@ -214,13 +212,13 @@ public void ValidateSchemaRequiredFieldListMustContainThePropertySpecifiedInTheD var result = !errors.Any(); // Assert - result.Should().BeFalse(); - errors.Should().BeEquivalentTo(new List + Assert.False(result); + Assert.Equivalent(new List { new OpenApiValidatorError(nameof(OpenApiSchemaRules.ValidateSchemaDiscriminator),"#/schemas/schema1/discriminator", string.Format(SRResource.Validation_SchemaRequiredFieldListMustContainThePropertySpecifiedInTheDiscriminator, "schema1", "property1")) - }); + }, errors); } [Fact] @@ -275,7 +273,7 @@ public void ValidateOneOfSchemaPropertyNameContainsPropertySpecifiedInTheDiscrim var errors = validator.Errors; //Assert - errors.Should().BeEmpty(); + Assert.Empty(errors); } } } diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs b/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs index b9c41bf5f..54fb8cfb6 100644 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs +++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs @@ -13,7 +13,6 @@ using System.Text.Json.Nodes; using System.Text.Json.Serialization; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Writers; @@ -70,7 +69,7 @@ public async Task WriteStringListAsJsonShouldMatchExpected(string[] stringValues JsonSerializer.Deserialize>(JsonSerializer.Serialize(new List(stringValues))); // Assert - parsedObject.Should().BeEquivalentTo(expectedObject); + Assert.Equivalent(expectedObject, parsedObject); } public static IEnumerable WriteMapAsJsonShouldMatchExpectedTestCasesSimple() @@ -317,7 +316,7 @@ public void WriteDateTimeAsJsonShouldMatchExpected(DateTimeOffset dateTimeOffset var expectedString = JsonSerializer.Serialize(dateTimeOffset, _jsonSerializerOptions.Value); // Assert - writtenString.Should().Be(expectedString); + Assert.Equal(expectedString, writtenString); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs index 69b176645..a26173606 100644 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs @@ -9,8 +9,6 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Threading.Tasks; -using FluentAssertions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Writers; using VerifyXunit; using Xunit; @@ -31,7 +29,7 @@ public async Task WriteOpenApiNullAsJsonWorksAsync(bool produceTerseOutput) var json = await WriteAsJsonAsync(null, produceTerseOutput); // Assert - json.Should().Be("null"); + Assert.Equal("null", json); } public static IEnumerable IntInputs @@ -59,7 +57,7 @@ public async Task WriteOpenApiIntegerAsJsonWorksAsync(int input, bool produceTer var json = await WriteAsJsonAsync(intValue, produceTerseOutput); // Assert - json.Should().Be(input.ToString()); + Assert.Equal(input.ToString(), json); } public static IEnumerable LongInputs @@ -87,7 +85,7 @@ public async Task WriteOpenApiLongAsJsonWorksAsync(long input, bool produceTerse var json = await WriteAsJsonAsync(longValue, produceTerseOutput); // Assert - json.Should().Be(input.ToString()); + Assert.Equal(input.ToString(), json); } public static IEnumerable FloatInputs @@ -115,7 +113,7 @@ public async Task WriteOpenApiFloatAsJsonWorksAsync(float input, bool produceTer var json = await WriteAsJsonAsync(floatValue, produceTerseOutput); // Assert - json.Should().Be(input.ToString()); + Assert.Equal(input.ToString(), json); } public static IEnumerable DoubleInputs @@ -143,7 +141,7 @@ public async Task WriteOpenApiDoubleAsJsonWorksAsync(double input, bool produceT var json = await WriteAsJsonAsync(doubleValue, produceTerseOutput); // Assert - json.Should().Be(input.ToString()); + Assert.Equal(input.ToString(), json); } public static IEnumerable StringifiedDateTimes @@ -174,7 +172,7 @@ public async Task WriteOpenApiDateTimeAsJsonWorksAsync(string inputString, bool var expectedJson = "\"" + input.ToString("o") + "\""; // Assert - json.Should().Be(expectedJson); + Assert.Equal(expectedJson, json); } public static IEnumerable BooleanInputs @@ -195,7 +193,7 @@ public async Task WriteOpenApiBooleanAsJsonWorksAsync(bool input, bool produceTe var json = await WriteAsJsonAsync(boolValue, produceTerseOutput); // Assert - json.Should().Be(input.ToString().ToLower()); + Assert.Equal(input.ToString().ToLower(), json); } [Theory] diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterSpecialCharacterTests.cs b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterSpecialCharacterTests.cs index a127e982b..e02200cd7 100644 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterSpecialCharacterTests.cs +++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterSpecialCharacterTests.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.IO; using System.Linq; -using FluentAssertions; using Microsoft.OpenApi.Writers; using Xunit; @@ -47,7 +46,7 @@ public void WriteStringWithSpecialCharactersAsJsonWorks(string input, string exp var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -81,7 +80,7 @@ public void WriteStringWithSpecialCharactersAsYamlWorks(string input, string exp var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -109,7 +108,7 @@ public void WriteStringWithNewlineCharactersInObjectAsYamlWorks(string input, st .Replace("\r", ""); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -135,7 +134,7 @@ public void WriteStringWithNewlineCharactersInArrayAsYamlWorks(string input, str .Replace("\r", ""); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -156,7 +155,7 @@ public void WriteStringAsYamlDoesNotDependOnSystemCulture(string input, string e var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs b/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs index 7d07e51ef..2210cce59 100644 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs +++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs @@ -7,7 +7,6 @@ using System.Globalization; using System.IO; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Writers; using Xunit; @@ -81,7 +80,7 @@ public async Task WriteStringListAsYamlShouldMatchExpected(string[] stringValues expectedYaml = expectedYaml.MakeLineBreaksEnvironmentNeutral(); // Assert - actualYaml.Should().Be(expectedYaml); + Assert.Equal(expectedYaml, actualYaml); } public static IEnumerable WriteMapAsYamlShouldMatchExpectedTestCasesSimple() @@ -315,7 +314,7 @@ public void WriteMapAsYamlShouldMatchExpected(IDictionary inputM // Assert actualYaml = actualYaml.MakeLineBreaksEnvironmentNeutral(); expectedYaml = expectedYaml.MakeLineBreaksEnvironmentNeutral(); - actualYaml.Should().Be(expectedYaml); + Assert.Equal(expectedYaml, actualYaml); } public static IEnumerable WriteDateTimeAsJsonTestCases() @@ -356,7 +355,7 @@ public void WriteDateTimeAsJsonShouldMatchExpected(DateTimeOffset dateTimeOffset var expectedString = " '" + dateTimeOffset.ToString("o") + "'"; // Assert - writtenString.Should().Be(expectedString); + Assert.Equal(expectedString, writtenString); } [Fact] @@ -396,7 +395,7 @@ public void WriteInlineSchema() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().BeEquivalentTo(expected); + Assert.Equivalent(expected, actual); Assert.Equal(expected, actual); } From 1a0153bdf7d0f681447f1acc105652bfaf38b23f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 09:23:08 -0500 Subject: [PATCH 02/16] chore: FA replacement additional batch Signed-off-by: Vincent Biret --- .../V2Tests/OpenApiOperationTests.cs | 8 +++---- .../V2Tests/OpenApiServerTests.cs | 2 +- .../Models/OpenApiComponentsTests.cs | 24 +++++++++---------- .../Models/OpenApiOAuthFlowsTests.cs | 9 ++++--- .../Models/OpenApiSchemaTests.cs | 12 +++++----- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs index 948c6544c..ab5735e77 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs @@ -451,7 +451,7 @@ public async Task ParseV2ResponseWithExamplesExtensionWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -501,7 +501,7 @@ public async Task LoadV3ExamplesInResponseAsExtensionsWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -552,7 +552,7 @@ public async Task LoadV2OperationWithBodyParameterExamplesWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -604,7 +604,7 @@ public async Task LoadV3ExamplesInRequestBodyParameterAsExtensionsWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs index e0c076ee3..6f72dccb7 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs @@ -304,7 +304,7 @@ public void InvalidHostShouldYieldError() }; var result = OpenApiDocument.Parse(input, "yaml", settings); - result.Document.Servers.Count.Should().Be(0); + Assert.Empty(result.Document.Servers); result.Diagnostic.Should().BeEquivalentTo( new OpenApiDiagnostic { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs index 3a69b708e..2ac70548d 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs @@ -286,7 +286,7 @@ public async Task SerializeBasicComponentsAsJsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -301,7 +301,7 @@ public async Task SerializeBasicComponentsAsYamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -353,7 +353,7 @@ public async Task SerializeAdvancedComponentsAsJsonV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -411,7 +411,7 @@ public async Task SerializeAdvancedComponentsWithReferenceAsJsonV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -450,7 +450,7 @@ public async Task SerializeAdvancedComponentsAsYamlV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -492,7 +492,7 @@ public async Task SerializeAdvancedComponentsWithReferenceAsYamlV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -529,7 +529,7 @@ public async Task SerializeBrokenComponentsAsJsonV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -559,7 +559,7 @@ public async Task SerializeBrokenComponentsAsYamlV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -585,7 +585,7 @@ public async Task SerializeTopLevelReferencingComponentsAsYamlV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -610,7 +610,7 @@ public async Task SerializeTopLevelSelfReferencingWithOtherPropertiesComponentsA // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -665,7 +665,7 @@ public async Task SerializeComponentsWithPathItemsAsJsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -702,7 +702,7 @@ public async Task SerializeComponentsWithPathItemsAsYamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiOAuthFlowsTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiOAuthFlowsTests.cs index 6e1b2e102..161c669fa 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiOAuthFlowsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiOAuthFlowsTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Xunit; @@ -64,7 +63,7 @@ public async Task SerializeBasicOAuthFlowsAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -80,7 +79,7 @@ public async Task SerializeBasicOAuthFlowsAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -106,7 +105,7 @@ public async Task SerializeOAuthFlowsWithSingleFlowAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -140,7 +139,7 @@ public async Task SerializeOAuthFlowsWithMultipleFlowsAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs index 49f1596c5..ea867353d 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs @@ -226,7 +226,7 @@ public async Task SerializeBasicSchemaAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -256,7 +256,7 @@ public async Task SerializeAdvancedSchemaNumberAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -308,7 +308,7 @@ public async Task SerializeAdvancedSchemaObjectAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -363,7 +363,7 @@ public async Task SerializeAdvancedSchemaWithAllOfAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -600,7 +600,7 @@ public void OpenApiWalkerVisitsOpenApiSchemaNot() walker.Walk(document); // Assert - visitor.Titles.Count.Should().Be(2); + Assert.Equal(2, visitor.Titles.Count); } [Fact] @@ -627,7 +627,7 @@ public async Task SerializeSchemaWithUnrecognizedPropertiesWorks() var actual = await schema.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi3_1); // Assert - actual.MakeLineBreaksEnvironmentNeutral().Should().Be(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected, actual); } internal class SchemaVisitor : OpenApiVisitorBase From 3ceaa12a1dff15273fa8da7812f315ad9aa16d9d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 09:26:52 -0500 Subject: [PATCH 03/16] chore: removes unused usings Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs | 1 - src/Microsoft.OpenApi/Interfaces/IOpenApiReader.cs | 1 - .../MicrosoftExtensions/OpenApiEnumFlagsExtension.cs | 1 - .../OpenApiEnumValuesDescriptionExtension.cs | 1 - .../MicrosoftExtensions/OpenApiPagingExtension.cs | 1 - src/Microsoft.OpenApi/Models/OpenApiExample.cs | 2 -- src/Microsoft.OpenApi/Models/OpenApiParameter.cs | 1 - src/Microsoft.OpenApi/Models/RuntimeExpressionAnyWrapper.cs | 1 - src/Microsoft.OpenApi/Reader/OpenApiReaderRegistry.cs | 1 - src/Microsoft.OpenApi/Reader/OpenApiReaderSettings.cs | 1 - .../Reader/ParseNodes/AnyFieldMapParameter.cs | 1 - .../Reader/ParseNodes/AnyMapFieldMapParameter.cs | 1 - src/Microsoft.OpenApi/Reader/ParseNodes/ListNode.cs | 1 - src/Microsoft.OpenApi/Reader/ParseNodes/ParseNode.cs | 1 - src/Microsoft.OpenApi/Reader/ParseNodes/PropertyNode.cs | 1 - src/Microsoft.OpenApi/Reader/ParseNodes/ValueNode.cs | 1 - src/Microsoft.OpenApi/Reader/ParsingContext.cs | 1 - .../Reader/V3/OpenApiCallbackDeserializer.cs | 1 - .../Reader/V3/OpenApiDocumentDeserializer.cs | 1 - .../Reader/V3/OpenApiExampleDeserializer.cs | 1 - src/Microsoft.OpenApi/Reader/V3/OpenApiHeaderDeserializer.cs | 1 - src/Microsoft.OpenApi/Reader/V3/OpenApiLinkDeserializer.cs | 1 - .../Reader/V3/OpenApiParameterDeserializer.cs | 2 -- .../Reader/V3/OpenApiPathItemDeserializer.cs | 1 - .../Reader/V3/OpenApiRequestBodyDeserializer.cs | 1 - .../Reader/V3/OpenApiResponseDeserializer.cs | 1 - src/Microsoft.OpenApi/Reader/V3/OpenApiV3VersionService.cs | 1 - .../Reader/V31/OpenApiCallbackDeserializer.cs | 1 - .../Reader/V31/OpenApiDocumentDeserializer.cs | 4 +--- .../Reader/V31/OpenApiExampleDeserializer.cs | 3 +-- .../Reader/V31/OpenApiHeaderDeserializer.cs | 3 +-- src/Microsoft.OpenApi/Reader/V31/OpenApiLinkDeserializer.cs | 3 +-- .../Reader/V31/OpenApiParameterDeserializer.cs | 4 +--- .../Reader/V31/OpenApiPathItemDeserializer.cs | 3 +-- .../Reader/V31/OpenApiRequestBodyDeserializer.cs | 3 +-- .../Reader/V31/OpenApiResponseDeserializer.cs | 3 +-- .../Reader/V31/OpenApiSchemaDeserializer.cs | 1 - .../Reader/V31/OpenApiSecuritySchemeDeserializer.cs | 1 - src/Microsoft.OpenApi/Reader/V31/OpenApiV31Deserializer.cs | 1 - src/Microsoft.OpenApi/Validations/ValidationRule.cs | 1 - src/Microsoft.OpenApi/Writers/OpenApiWriterBase.cs | 5 ----- src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs | 2 -- .../Services/OpenApiFilterServiceTests.cs | 2 -- test/Microsoft.OpenApi.Readers.Tests/Resources.cs | 1 - .../V2Tests/OpenApiDocumentTests.cs | 1 - .../V2Tests/OpenApiOperationTests.cs | 1 - .../V31Tests/OpenApiDocumentTests.cs | 2 -- .../V31Tests/OpenApiSchemaTests.cs | 1 - .../V3Tests/OpenApiDocumentTests.cs | 1 - .../V3Tests/OpenApiExampleTests.cs | 1 - .../V3Tests/OpenApiParameterTests.cs | 3 --- .../V3Tests/OpenApiSchemaTests.cs | 1 - .../OpenApiPrimaryErrorMessageExtensionTests.cs | 1 - .../OpenApiReservedParameterExtensionTests.cs | 2 -- .../Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs | 2 -- test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs | 1 - test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs | 1 - test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs | 1 - .../Models/References/OpenApiCallbackReferenceTests.cs | 1 - .../Models/References/OpenApiExampleReferenceTests.cs | 1 - .../Models/References/OpenApiHeaderReferenceTests.cs | 1 - .../Models/References/OpenApiLinkReferenceTests.cs | 1 - .../Models/References/OpenApiParameterReferenceTests.cs | 1 - .../Models/References/OpenApiPathItemReferenceTests.cs | 1 - .../Models/References/OpenApiRequestBodyReferenceTests.cs | 1 - .../Models/References/OpenApiResponseReferenceTest.cs | 1 - .../Validations/OpenApiHeaderValidationTests.cs | 2 -- .../Validations/OpenApiMediaTypeValidationTests.cs | 3 --- 68 files changed, 8 insertions(+), 94 deletions(-) diff --git a/src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs b/src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs index 217db91b3..d33450c2b 100644 --- a/src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs +++ b/src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs @@ -9,7 +9,6 @@ using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Reader; using SharpYaml.Serialization; -using System.Linq; using Microsoft.OpenApi.Models; using System; using System.Text; diff --git a/src/Microsoft.OpenApi/Interfaces/IOpenApiReader.cs b/src/Microsoft.OpenApi/Interfaces/IOpenApiReader.cs index 9398551dd..39eb06979 100644 --- a/src/Microsoft.OpenApi/Interfaces/IOpenApiReader.cs +++ b/src/Microsoft.OpenApi/Interfaces/IOpenApiReader.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System.IO; -using System.Text.Json.Nodes; using System.Threading; using System.Threading.Tasks; using Microsoft.OpenApi.Reader; diff --git a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiEnumFlagsExtension.cs b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiEnumFlagsExtension.cs index 9cbae6350..22b9f0df2 100644 --- a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiEnumFlagsExtension.cs +++ b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiEnumFlagsExtension.cs @@ -5,7 +5,6 @@ using System; using Microsoft.OpenApi.Extensions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Writers; using System.Text.Json.Nodes; diff --git a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiEnumValuesDescriptionExtension.cs b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiEnumValuesDescriptionExtension.cs index d2661a225..df1e664e1 100644 --- a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiEnumValuesDescriptionExtension.cs +++ b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiEnumValuesDescriptionExtension.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.Linq; using Microsoft.OpenApi.Extensions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Writers; using System.Text.Json.Nodes; diff --git a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiPagingExtension.cs b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiPagingExtension.cs index f64eebf3f..57d057e59 100644 --- a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiPagingExtension.cs +++ b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiPagingExtension.cs @@ -5,7 +5,6 @@ using System; using Microsoft.OpenApi.Extensions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Writers; using System.Text.Json.Nodes; diff --git a/src/Microsoft.OpenApi/Models/OpenApiExample.cs b/src/Microsoft.OpenApi/Models/OpenApiExample.cs index ef8a64b7a..1fc7ca900 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiExample.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiExample.cs @@ -1,10 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.Collections.Generic; using System.Text.Json.Nodes; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Helpers; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Writers; diff --git a/src/Microsoft.OpenApi/Models/OpenApiParameter.cs b/src/Microsoft.OpenApi/Models/OpenApiParameter.cs index f3eb6c76f..bdaba739e 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiParameter.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiParameter.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Helpers; using Microsoft.OpenApi.Interfaces; diff --git a/src/Microsoft.OpenApi/Models/RuntimeExpressionAnyWrapper.cs b/src/Microsoft.OpenApi/Models/RuntimeExpressionAnyWrapper.cs index dca24c3e5..35a08a422 100644 --- a/src/Microsoft.OpenApi/Models/RuntimeExpressionAnyWrapper.cs +++ b/src/Microsoft.OpenApi/Models/RuntimeExpressionAnyWrapper.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System.Text.Json.Nodes; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Expressions; using Microsoft.OpenApi.Helpers; using Microsoft.OpenApi.Interfaces; diff --git a/src/Microsoft.OpenApi/Reader/OpenApiReaderRegistry.cs b/src/Microsoft.OpenApi/Reader/OpenApiReaderRegistry.cs index e1eea86a1..b86b5a9c6 100644 --- a/src/Microsoft.OpenApi/Reader/OpenApiReaderRegistry.cs +++ b/src/Microsoft.OpenApi/Reader/OpenApiReaderRegistry.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Concurrent; -using System.Collections.Generic; using Microsoft.OpenApi.Interfaces; namespace Microsoft.OpenApi.Reader diff --git a/src/Microsoft.OpenApi/Reader/OpenApiReaderSettings.cs b/src/Microsoft.OpenApi/Reader/OpenApiReaderSettings.cs index fa0040ff8..33f03eedb 100644 --- a/src/Microsoft.OpenApi/Reader/OpenApiReaderSettings.cs +++ b/src/Microsoft.OpenApi/Reader/OpenApiReaderSettings.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Text.Json.Nodes; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.MicrosoftExtensions; using Microsoft.OpenApi.Validations; diff --git a/src/Microsoft.OpenApi/Reader/ParseNodes/AnyFieldMapParameter.cs b/src/Microsoft.OpenApi/Reader/ParseNodes/AnyFieldMapParameter.cs index ad8394b58..92dd24138 100644 --- a/src/Microsoft.OpenApi/Reader/ParseNodes/AnyFieldMapParameter.cs +++ b/src/Microsoft.OpenApi/Reader/ParseNodes/AnyFieldMapParameter.cs @@ -3,7 +3,6 @@ using System; using System.Text.Json.Nodes; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; namespace Microsoft.OpenApi.Reader.ParseNodes diff --git a/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs b/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs index a4dc41b7f..4d365125b 100644 --- a/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs +++ b/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Nodes; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; namespace Microsoft.OpenApi.Reader.ParseNodes diff --git a/src/Microsoft.OpenApi/Reader/ParseNodes/ListNode.cs b/src/Microsoft.OpenApi/Reader/ParseNodes/ListNode.cs index 6654344cd..3de21c79e 100644 --- a/src/Microsoft.OpenApi/Reader/ParseNodes/ListNode.cs +++ b/src/Microsoft.OpenApi/Reader/ParseNodes/ListNode.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Exceptions; using Microsoft.OpenApi.Models; diff --git a/src/Microsoft.OpenApi/Reader/ParseNodes/ParseNode.cs b/src/Microsoft.OpenApi/Reader/ParseNodes/ParseNode.cs index 44d626f35..49ebc9c74 100644 --- a/src/Microsoft.OpenApi/Reader/ParseNodes/ParseNode.cs +++ b/src/Microsoft.OpenApi/Reader/ParseNodes/ParseNode.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Text.Json.Nodes; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Exceptions; using Microsoft.OpenApi.Models; diff --git a/src/Microsoft.OpenApi/Reader/ParseNodes/PropertyNode.cs b/src/Microsoft.OpenApi/Reader/ParseNodes/PropertyNode.cs index 5f8031e87..170dfa14a 100644 --- a/src/Microsoft.OpenApi/Reader/ParseNodes/PropertyNode.cs +++ b/src/Microsoft.OpenApi/Reader/ParseNodes/PropertyNode.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Exceptions; using Microsoft.OpenApi.Models; diff --git a/src/Microsoft.OpenApi/Reader/ParseNodes/ValueNode.cs b/src/Microsoft.OpenApi/Reader/ParseNodes/ValueNode.cs index ec9fefde5..f83d2ba66 100644 --- a/src/Microsoft.OpenApi/Reader/ParseNodes/ValueNode.cs +++ b/src/Microsoft.OpenApi/Reader/ParseNodes/ValueNode.cs @@ -4,7 +4,6 @@ using System; using System.Globalization; using System.Text.Json.Nodes; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Exceptions; namespace Microsoft.OpenApi.Reader.ParseNodes diff --git a/src/Microsoft.OpenApi/Reader/ParsingContext.cs b/src/Microsoft.OpenApi/Reader/ParsingContext.cs index 7a8b07244..830b6390b 100644 --- a/src/Microsoft.OpenApi/Reader/ParsingContext.cs +++ b/src/Microsoft.OpenApi/Reader/ParsingContext.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Exceptions; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiCallbackDeserializer.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiCallbackDeserializer.cs index faf50ebb1..b81914521 100644 --- a/src/Microsoft.OpenApi/Reader/V3/OpenApiCallbackDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiCallbackDeserializer.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Linq; using Microsoft.OpenApi.Expressions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiDocumentDeserializer.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiDocumentDeserializer.cs index 3fcdb9af7..5a20be549 100644 --- a/src/Microsoft.OpenApi/Reader/V3/OpenApiDocumentDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiDocumentDeserializer.cs @@ -4,7 +4,6 @@ using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader.ParseNodes; -using Microsoft.OpenApi.Services; namespace Microsoft.OpenApi.Reader.V3 { diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiExampleDeserializer.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiExampleDeserializer.cs index a73ee02b1..29ebacb61 100644 --- a/src/Microsoft.OpenApi/Reader/V3/OpenApiExampleDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiExampleDeserializer.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiHeaderDeserializer.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiHeaderDeserializer.cs index 8f6edb55b..867781316 100644 --- a/src/Microsoft.OpenApi/Reader/V3/OpenApiHeaderDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiHeaderDeserializer.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiLinkDeserializer.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiLinkDeserializer.cs index a95b6ebf8..fd71ca186 100644 --- a/src/Microsoft.OpenApi/Reader/V3/OpenApiLinkDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiLinkDeserializer.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiParameterDeserializer.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiParameterDeserializer.cs index 74edfd462..1b950ec7e 100644 --- a/src/Microsoft.OpenApi/Reader/V3/OpenApiParameterDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiParameterDeserializer.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; -using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiPathItemDeserializer.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiPathItemDeserializer.cs index afcee89b5..e7cad91db 100644 --- a/src/Microsoft.OpenApi/Reader/V3/OpenApiPathItemDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiPathItemDeserializer.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiRequestBodyDeserializer.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiRequestBodyDeserializer.cs index 435b576e1..0b3cbd718 100644 --- a/src/Microsoft.OpenApi/Reader/V3/OpenApiRequestBodyDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiRequestBodyDeserializer.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiResponseDeserializer.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiResponseDeserializer.cs index e65a1aafe..dd6f66d9b 100644 --- a/src/Microsoft.OpenApi/Reader/V3/OpenApiResponseDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiResponseDeserializer.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiV3VersionService.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiV3VersionService.cs index 9ac257814..372a8b26f 100644 --- a/src/Microsoft.OpenApi/Reader/V3/OpenApiV3VersionService.cs +++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiV3VersionService.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text.Json.Nodes; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Exceptions; using Microsoft.OpenApi.Extensions; diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiCallbackDeserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiCallbackDeserializer.cs index 580ce1356..4bb91bb39 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiCallbackDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiCallbackDeserializer.cs @@ -4,7 +4,6 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader.ParseNodes; using Microsoft.OpenApi.Models.References; -using System.Linq; namespace Microsoft.OpenApi.Reader.V31 { diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiDocumentDeserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiDocumentDeserializer.cs index 8137fb460..c3915fc84 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiDocumentDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiDocumentDeserializer.cs @@ -1,8 +1,6 @@ -using System; -using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader.ParseNodes; -using Microsoft.OpenApi.Services; namespace Microsoft.OpenApi.Reader.V31 { diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiExampleDeserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiExampleDeserializer.cs index 0035360d5..724e72327 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiExampleDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiExampleDeserializer.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader.ParseNodes; diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiHeaderDeserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiHeaderDeserializer.cs index 7349774f6..22ddfe0a5 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiHeaderDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiHeaderDeserializer.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader.ParseNodes; diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiLinkDeserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiLinkDeserializer.cs index aa1e26ea1..b458c2b52 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiLinkDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiLinkDeserializer.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader.ParseNodes; diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiParameterDeserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiParameterDeserializer.cs index 824e6e577..47056cddb 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiParameterDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiParameterDeserializer.cs @@ -1,6 +1,4 @@ -using System; -using System.Linq; -using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader.ParseNodes; diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiPathItemDeserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiPathItemDeserializer.cs index 8797b03e6..c71840b1a 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiPathItemDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiPathItemDeserializer.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader.ParseNodes; diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiRequestBodyDeserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiRequestBodyDeserializer.cs index 7acea65c0..d972169ba 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiRequestBodyDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiRequestBodyDeserializer.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader.ParseNodes; diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiResponseDeserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiResponseDeserializer.cs index 611574bf2..1632439d4 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiResponseDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiResponseDeserializer.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader.ParseNodes; diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiSchemaDeserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiSchemaDeserializer.cs index ad943dce4..95ba75f27 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiSchemaDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiSchemaDeserializer.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Text.Json.Nodes; namespace Microsoft.OpenApi.Reader.V31 { diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiSecuritySchemeDeserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiSecuritySchemeDeserializer.cs index 8fb5c0cd1..572895a7a 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiSecuritySchemeDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiSecuritySchemeDeserializer.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System; -using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiV31Deserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiV31Deserializer.cs index a037dc3c1..9616d04cc 100644 --- a/src/Microsoft.OpenApi/Reader/V31/OpenApiV31Deserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiV31Deserializer.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; using Microsoft.OpenApi.Any; diff --git a/src/Microsoft.OpenApi/Validations/ValidationRule.cs b/src/Microsoft.OpenApi/Validations/ValidationRule.cs index 35503606f..a72beb5c1 100644 --- a/src/Microsoft.OpenApi/Validations/ValidationRule.cs +++ b/src/Microsoft.OpenApi/Validations/ValidationRule.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System; -using Microsoft.OpenApi.Exceptions; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Properties; diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterBase.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterBase.cs index 0864729d9..7626f5908 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterBase.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterBase.cs @@ -5,16 +5,11 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Exceptions; -using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Properties; -using Microsoft.OpenApi.Services; namespace Microsoft.OpenApi.Writers { diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs index f05fd13a7..3ff128ae6 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs @@ -1,5 +1,3 @@ - -using System; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 12293c4e5..77f2c9ae9 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -3,11 +3,9 @@ using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; using Moq; -using SharpYaml.Tokens; using Xunit; namespace Microsoft.OpenApi.Hidi.Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/Resources.cs b/test/Microsoft.OpenApi.Readers.Tests/Resources.cs index 431c86e04..856e87427 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/Resources.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/Resources.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.IO; namespace Microsoft.OpenApi.Readers.Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs index b3fead6b1..a9bd8291d 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Threading; using System.Threading.Tasks; using FluentAssertions; diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs index ab5735e77..c3212b802 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs @@ -9,7 +9,6 @@ using FluentAssertions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; -using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader.ParseNodes; using Microsoft.OpenApi.Reader.V2; diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs index a83da5e39..842f7172a 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs @@ -9,9 +9,7 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Tests; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using Xunit; -using System.Linq; using VerifyXunit; namespace Microsoft.OpenApi.Readers.Tests.V31Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs index 312353ba8..add70aa92 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.Collections.Generic; using System.IO; using System.Text.Json.Nodes; diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs index 68102328f..03f310f6e 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs @@ -17,7 +17,6 @@ using Microsoft.OpenApi.Validations; using Microsoft.OpenApi.Validations.Rules; using Microsoft.OpenApi.Writers; -using SharpYaml.Model; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs index 95ee7076a..2dd3d4490 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs @@ -5,7 +5,6 @@ using System.Text.Json.Nodes; using System.Threading.Tasks; using FluentAssertions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Xunit; diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs index a40cb4144..af79a64d3 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs @@ -2,15 +2,12 @@ // Licensed under the MIT license. using System.Collections.Generic; -using System; using System.IO; using FluentAssertions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Xunit; using Microsoft.OpenApi.Reader.V3; -using Microsoft.OpenApi.Services; using System.Threading.Tasks; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs index a1554352f..3110ef251 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; -using System.Linq; using System.Text.Json.Nodes; using FluentAssertions; using Microsoft.OpenApi.Any; diff --git a/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiPrimaryErrorMessageExtensionTests.cs b/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiPrimaryErrorMessageExtensionTests.cs index f7256f8e6..51f5d7b48 100644 --- a/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiPrimaryErrorMessageExtensionTests.cs +++ b/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiPrimaryErrorMessageExtensionTests.cs @@ -4,7 +4,6 @@ // ------------------------------------------------------------ using System.IO; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Writers; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiReservedParameterExtensionTests.cs b/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiReservedParameterExtensionTests.cs index 4972f3230..5850aef26 100644 --- a/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiReservedParameterExtensionTests.cs +++ b/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiReservedParameterExtensionTests.cs @@ -1,10 +1,8 @@ using System; using System.IO; using Microsoft.OpenApi.MicrosoftExtensions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Writers; using Xunit; -using System.Text.Json.Nodes; namespace Microsoft.OpenApi.Tests.MicrosoftExtensions; diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs index 2ac70548d..738002b1e 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using FluentAssertions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs index 5d9c9175b..326575b9b 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs @@ -18,7 +18,6 @@ using Microsoft.VisualBasic; using VerifyXunit; using Xunit; -using Xunit.Abstractions; namespace Microsoft.OpenApi.Tests.Models { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs index c920c986b..d1e2cd8f5 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs @@ -8,7 +8,6 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Threading.Tasks; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Writers; diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs index a47ef4052..db9bfd7d5 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs @@ -5,7 +5,6 @@ using System.Text.Json.Nodes; using System.Threading.Tasks; using FluentAssertions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs index b147e19ee..38bf27215 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs @@ -9,7 +9,6 @@ using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Readers; -using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Writers; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiExampleReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiExampleReferenceTests.cs index a3c5efb7e..2cb0ff189 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiExampleReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiExampleReferenceTests.cs @@ -10,7 +10,6 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiHeaderReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiHeaderReferenceTests.cs index 9e1867455..70eca5e9e 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiHeaderReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiHeaderReferenceTests.cs @@ -10,7 +10,6 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiLinkReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiLinkReferenceTests.cs index 9f005727f..4845c2311 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiLinkReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiLinkReferenceTests.cs @@ -10,7 +10,6 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiParameterReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiParameterReferenceTests.cs index 57239f13b..5e95246ae 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiParameterReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiParameterReferenceTests.cs @@ -10,7 +10,6 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiPathItemReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiPathItemReferenceTests.cs index 5d18b9095..510dfbda3 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiPathItemReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiPathItemReferenceTests.cs @@ -10,7 +10,6 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiRequestBodyReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiRequestBodyReferenceTests.cs index 4befbb298..0f1d8f634 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiRequestBodyReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiRequestBodyReferenceTests.cs @@ -10,7 +10,6 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiResponseReferenceTest.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiResponseReferenceTest.cs index 441677a6f..b39d6040b 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiResponseReferenceTest.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiResponseReferenceTest.cs @@ -10,7 +10,6 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiHeaderValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiHeaderValidationTests.cs index 5f067a3b2..3a685f3a8 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiHeaderValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiHeaderValidationTests.cs @@ -4,8 +4,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; -using FluentAssertions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Validations.Rules; diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiMediaTypeValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiMediaTypeValidationTests.cs index a3729e0b1..834443135 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiMediaTypeValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiMediaTypeValidationTests.cs @@ -4,11 +4,8 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; -using FluentAssertions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; -using Microsoft.OpenApi.Validations.Rules; using Xunit; namespace Microsoft.OpenApi.Validations.Tests From 865872d66a2967974526da03f3bdea20f0bd6b9e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 09:47:43 -0500 Subject: [PATCH 04/16] chore: FA replacement additional batch Signed-off-by: Vincent Biret --- .../Models/OpenApiDocumentTests.cs | 24 +++++-------- .../Models/OpenApiMediaTypeTests.cs | 18 +++++----- .../Models/OpenApiOperationTests.cs | 20 +++++------ .../Models/OpenApiReferenceTests.cs | 36 +++++++++---------- .../Models/OpenApiSchemaTests.cs | 2 +- .../Models/OpenApiSecuritySchemeTests.cs | 14 ++++---- 6 files changed, 53 insertions(+), 61 deletions(-) diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs index 326575b9b..afb06929d 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs @@ -1484,8 +1484,7 @@ public async Task SerializeSimpleDocumentWithTopLevelReferencingComponentsAsYaml // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1504,8 +1503,7 @@ public async Task SerializeSimpleDocumentWithTopLevelSelfReferencingComponentsAs // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1533,8 +1531,7 @@ public async Task SerializeSimpleDocumentWithTopLevelSelfReferencingWithOtherPro // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1615,8 +1612,7 @@ public async Task SerializeRelativePathAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1646,8 +1642,7 @@ public async Task SerializeRelativePathWithHostAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1676,8 +1671,7 @@ public async Task SerializeRelativeRootPathWithHostAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1762,8 +1756,7 @@ public async Task SerializeV2DocumentWithNonArraySchemaTypeDoesNotWriteOutCollec // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1851,8 +1844,7 @@ public async Task SerializeV2DocumentWithStyleAsNullDoesNotWriteOutStyleValue() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs index db9bfd7d5..4a7b25440 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs @@ -141,7 +141,7 @@ public async Task SerializeBasicMediaTypeAsV3Works(OpenApiFormat format, string // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -169,7 +169,7 @@ public async Task SerializeAdvanceMediaTypeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -193,7 +193,7 @@ public async Task SerializeAdvanceMediaTypeAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -228,7 +228,7 @@ public async Task SerializeMediaTypeWithObjectExampleAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -279,7 +279,7 @@ public async Task SerializeMediaTypeWithObjectExampleAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -303,7 +303,7 @@ public async Task SerializeMediaTypeWithXmlExampleAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -331,7 +331,7 @@ public async Task SerializeMediaTypeWithXmlExampleAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -369,7 +369,7 @@ public async Task SerializeMediaTypeWithObjectExamplesAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -425,7 +425,7 @@ public async Task SerializeMediaTypeWithObjectExamplesAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs index 654db50d5..db98dfa61 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs @@ -273,7 +273,7 @@ public async Task SerializeBasicOperationAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -345,7 +345,7 @@ public async Task SerializeOperationWithBodyAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -429,7 +429,7 @@ public async Task SerializeAdvancedOperationWithTagAndSecurityAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -449,7 +449,7 @@ public async Task SerializeBasicOperationAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -528,7 +528,7 @@ public async Task SerializeOperationWithFormDataAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -584,7 +584,7 @@ public async Task SerializeOperationWithFormDataAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -653,7 +653,7 @@ public async Task SerializeOperationWithBodyAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -734,7 +734,7 @@ public async Task SerializeAdvancedOperationWithTagAndSecurityAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -759,7 +759,7 @@ public async Task SerializeOperationWithNullCollectionAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -822,7 +822,7 @@ public async Task EnsureOpenApiOperationCopyConstructor_SerializationResultsInSa var actual = await openApiOperation.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi3_0); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs index 46d044c7c..617b43fd8 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs @@ -30,11 +30,11 @@ public void SettingInternalReferenceForComponentsStyleReferenceShouldSucceed( // Assert Assert.Null(reference.ExternalResource); - reference.Type.Should().Be(type); - reference.Id.Should().Be(id); + Assert.Equal(type, reference.Type); + Assert.Equal(id, reference.Id); - reference.ReferenceV3.Should().Be(input); - reference.ReferenceV2.Should().Be(input.Replace("schemas", "definitions").Replace("/components", "")); + Assert.Equal(input, reference.ReferenceV3); + Assert.Equal(input.Replace("schemas", "definitions").Replace("/components", ""), reference.ReferenceV2); } [Theory] @@ -55,10 +55,10 @@ public void SettingExternalReferenceV3ShouldSucceed(string expected, string exte }; // Assert - reference.ExternalResource.Should().Be(externalResource); - reference.Id.Should().Be(id); + Assert.Equal(externalResource, reference.ExternalResource); + Assert.Equal(id, reference.Id); - reference.ReferenceV3.Should().Be(expected); + Assert.Equal(expected, reference.ReferenceV3); } [Theory] @@ -79,10 +79,10 @@ public void SettingExternalReferenceV2ShouldSucceed(string expected, string exte }; // Assert - reference.ExternalResource.Should().Be(externalResource); - reference.Id.Should().Be(id); + Assert.Equal(externalResource, reference.ExternalResource); + Assert.Equal(id, reference.Id); - reference.ReferenceV2.Should().Be(expected); + Assert.Equal(expected, reference.ReferenceV2); } [Fact] @@ -103,7 +103,7 @@ public async Task SerializeSchemaReferenceAsJsonV3Works() actual = actual.MakeLineBreaksEnvironmentNeutral(); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -122,7 +122,7 @@ public async Task SerializeSchemaReferenceAsYamlV3Works() var actual = await reference.SerializeAsYamlAsync(OpenApiSpecVersion.OpenApi3_0); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -146,7 +146,7 @@ public async Task SerializeSchemaReferenceAsJsonV2Works() var actual = await reference.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi2_0); // Assert - actual.MakeLineBreaksEnvironmentNeutral().Should().Be(expected); + Assert.Equal(expected, actual.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -164,7 +164,7 @@ public async Task SerializeSchemaReferenceAsYamlV2Works() var actual = await reference.SerializeAsYamlAsync(OpenApiSpecVersion.OpenApi2_0); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -191,7 +191,7 @@ public async Task SerializeExternalReferenceAsJsonV2Works() actual = actual.MakeLineBreaksEnvironmentNeutral(); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -210,7 +210,7 @@ public async Task SerializeExternalReferenceAsYamlV2Works() var actual = await reference.SerializeAsYamlAsync(OpenApiSpecVersion.OpenApi2_0); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -232,7 +232,7 @@ public async Task SerializeExternalReferenceAsJsonV3Works() actual = actual.MakeLineBreaksEnvironmentNeutral(); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -246,7 +246,7 @@ public async Task SerializeExternalReferenceAsYamlV3Works() var actual = await reference.SerializeAsYamlAsync(OpenApiSpecVersion.OpenApi3_0); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs index ea867353d..145d7f535 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs @@ -627,7 +627,7 @@ public async Task SerializeSchemaWithUnrecognizedPropertiesWorks() var actual = await schema.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi3_1); // Assert - Assert.Equal(expected, actual); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral()); } internal class SchemaVisitor : OpenApiVisitorBase diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.cs index ebe06d4d6..345a75387 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.cs @@ -134,7 +134,7 @@ public async Task SerializeApiKeySecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -155,7 +155,7 @@ public async Task SerializeApiKeySecuritySchemeAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -177,7 +177,7 @@ public async Task SerializeHttpBasicSecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -200,7 +200,7 @@ public async Task SerializeHttpBearerSecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -230,7 +230,7 @@ public async Task SerializeOAuthSingleFlowSecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -276,7 +276,7 @@ public async Task SerializeOAuthMultipleFlowSecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -298,7 +298,7 @@ public async Task SerializeOpenIdConnectSecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] From b15de7aee7a7c8925be60180d278ae6e4494cde5 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 10:11:30 -0500 Subject: [PATCH 05/16] chore: FA replacement additional batch Signed-off-by: Vincent Biret --- .../V31Tests/OpenApiSchemaTests.cs | 26 +++++++++---------- .../Models/OpenApiContactTests.cs | 7 +++-- .../Models/OpenApiInfoTests.cs | 11 ++++---- .../Models/OpenApiLicenseTests.cs | 9 +++---- .../Models/OpenApiOperationTests.cs | 1 - .../Models/OpenApiReferenceTests.cs | 1 - .../Models/OpenApiResponseTests.cs | 11 ++++---- .../Models/OpenApiSecurityRequirementTests.cs | 10 +++---- .../Models/OpenApiSecuritySchemeTests.cs | 1 - .../Models/OpenApiServerTests.cs | 5 ++-- .../Models/OpenApiServerVariableTests.cs | 7 +++-- .../Models/OpenApiTagTests.cs | 17 ++++++------ .../Models/OpenApiXmlTests.cs | 7 +++-- 13 files changed, 51 insertions(+), 62 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs index add70aa92..b3b26c079 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs @@ -277,7 +277,7 @@ public void ParseSchemaWithExamplesShouldSucceed() var schema = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_1, out _, "yaml"); // Assert - schema.Examples.Should().HaveCount(2); + Assert.Equal(2, schema.Examples.Count); } [Fact] @@ -319,7 +319,7 @@ public async Task SerializeV31SchemaWithMultipleTypesAsV3Works() schema.SerializeAsV3(new OpenApiYamlWriter(writer)); var schema1String = writer.ToString(); - schema1String.MakeLineBreaksEnvironmentNeutral().Should().Be(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), schema1String.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -338,7 +338,7 @@ public async Task SerializeV31SchemaWithMultipleTypesAsV2Works() schema.SerializeAsV2(new OpenApiYamlWriter(writer)); var schema1String = writer.ToString(); - schema1String.MakeLineBreaksEnvironmentNeutral().Should().Be(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), schema1String.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -358,7 +358,7 @@ public async Task SerializeV3SchemaWithNullableAsV31Works() schema.SerializeAsV31(new OpenApiYamlWriter(writer)); var schemaString = writer.ToString(); - schemaString.MakeLineBreaksEnvironmentNeutral().Should().Be(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), schemaString.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -379,7 +379,7 @@ public async Task SerializeV2SchemaWithNullableExtensionAsV31Works() schema.SerializeAsV31(new OpenApiYamlWriter(writer)); var schemaString = writer.ToString(); - schemaString.MakeLineBreaksEnvironmentNeutral().Should().Be(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), schemaString.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -398,7 +398,7 @@ public void SerializeSchemaWithTypeArrayAndNullableDoesntEmitType() schema.SerializeAsV2(new OpenApiYamlWriter(writer)); var schemaString = writer.ToString(); - schemaString.MakeLineBreaksEnvironmentNeutral().Should().Be(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), schemaString.MakeLineBreaksEnvironmentNeutral()); } [Theory] @@ -413,7 +413,7 @@ public async Task LoadSchemaWithNullableExtensionAsV31Works(string filePath) var schema = await OpenApiModelFactory.LoadAsync(path, OpenApiSpecVersion.OpenApi3_1); // Assert - schema.Type.Should().Be(JsonSchemaType.String | JsonSchemaType.Null); + Assert.Equal(JsonSchemaType.String | JsonSchemaType.Null, schema.Type); } [Fact] @@ -458,8 +458,8 @@ public async Task SerializeSchemaWithJsonSchemaKeywordsWorks() var schemaString = writer.ToString(); // Assert - schema.Vocabulary.Keys.Count.Should().Be(5); - schemaString.MakeLineBreaksEnvironmentNeutral().Should().Be(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(5, schema.Vocabulary.Keys.Count); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), schemaString.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -495,14 +495,14 @@ public async Task ParseSchemaWithConstWorks() // Act var schema = await OpenApiModelFactory.LoadAsync(path, OpenApiSpecVersion.OpenApi3_1); - schema.Properties["status"].Const.Should().Be("active"); - schema.Properties["user"].Properties["role"].Const.Should().Be("admin"); + Assert.Equal("active", schema.Properties["status"].Const); + Assert.Equal("admin", schema.Properties["user"].Properties["role"].Const); // serialization var writer = new StringWriter(); schema.SerializeAsV31(new OpenApiJsonWriter(writer)); var schemaString = writer.ToString(); - schemaString.MakeLineBreaksEnvironmentNeutral().Should().Be(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), schemaString.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -517,7 +517,7 @@ public void ParseSchemaWithUnrecognizedKeywordsWorks() } "; var schema = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_1, out _, "json"); - schema.UnrecognizedKeywords.Should().HaveCount(2); + Assert.Equal(2, schema.UnrecognizedKeywords.Count); } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs index 337548ccb..aec4815e0 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; @@ -44,7 +43,7 @@ public async Task SerializeBasicContactWorks( // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -69,7 +68,7 @@ public async Task SerializeAdvanceContactAsJsonWorks(OpenApiSpecVersion version) // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -92,7 +91,7 @@ public async Task SerializeAdvanceContactAsYamlWorks(OpenApiSpecVersion version) // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs index a3c4633e1..65ded8841 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; @@ -71,7 +70,7 @@ public async Task SerializeBasicInfoAsJsonWorks(OpenApiSpecVersion version, stri // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } public static IEnumerable BasicInfoYamlExpected() @@ -100,7 +99,7 @@ public async Task SerializeBasicInfoAsYamlWorks(OpenApiSpecVersion version, stri // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } public static IEnumerable AdvanceInfoJsonExpect() @@ -145,7 +144,7 @@ public async Task SerializeAdvanceInfoAsJsonWorks(OpenApiSpecVersion version, st // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } public static IEnumerable AdvanceInfoYamlExpect() @@ -186,7 +185,7 @@ public async Task SerializeAdvanceInfoAsYamlWorks(OpenApiSpecVersion version, st // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -211,7 +210,7 @@ public async Task InfoVersionShouldAcceptDateStyledAsVersions() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs index 7ee848a26..7daa55e29 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; @@ -55,7 +54,7 @@ public async Task SerializeBasicLicenseAsJsonWorks(OpenApiSpecVersion version) // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -72,7 +71,7 @@ public async Task SerializeBasicLicenseAsYamlWorks(OpenApiSpecVersion version) // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -96,7 +95,7 @@ public async Task SerializeAdvanceLicenseAsJsonWorks(OpenApiSpecVersion version) // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -118,7 +117,7 @@ public async Task SerializeAdvanceLicenseAsYamlWorks(OpenApiSpecVersion version) // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs index db98dfa61..a3995601c 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs index 617b43fd8..2a27313ca 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs index 5026a0549..14d14e4be 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.IO; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; @@ -201,7 +200,7 @@ public async Task SerializeBasicResponseWorks( // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -244,7 +243,7 @@ public async Task SerializeAdvancedResponseAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -277,7 +276,7 @@ public async Task SerializeAdvancedResponseAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -314,7 +313,7 @@ public async Task SerializeAdvancedResponseAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -344,7 +343,7 @@ public async Task SerializeAdvancedResponseAsV2YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecurityRequirementTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecurityRequirementTests.cs index 8dcebc315..b555b9311 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecurityRequirementTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecurityRequirementTests.cs @@ -83,7 +83,7 @@ public async Task SerializeBasicSecurityRequirementAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -129,7 +129,7 @@ public async Task SerializeSecurityRequirementWithReferencedSecuritySchemeAsV3Js // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -158,7 +158,7 @@ public async Task SerializeSecurityRequirementWithReferencedSecuritySchemeAsV2Js // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -183,7 +183,7 @@ public async Task SerializeSecurityRequirementWithUnreferencedSecuritySchemeAsV3 // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -209,7 +209,7 @@ public async Task SerializeSecurityRequirementWithUnreferencedSecuritySchemeAsV2 // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.cs index 345a75387..9c59ca4bd 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.IO; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiServerTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiServerTests.cs index 1d4cc248c..bbfacf01c 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiServerTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiServerTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Xunit; @@ -65,7 +64,7 @@ public async Task SerializeBasicServerAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -103,7 +102,7 @@ public async Task SerializeAdvancedServerAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiServerVariableTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiServerVariableTests.cs index 032b9c7f3..255bfe908 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiServerVariableTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiServerVariableTests.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Xunit; @@ -36,7 +35,7 @@ public async Task SerializeBasicServerVariableAsV3Works(OpenApiFormat format, st // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -61,7 +60,7 @@ public async Task SerializeAdvancedServerVariableAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -83,7 +82,7 @@ public async Task SerializeAdvancedServerVariableAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs index 62616fe25..508779adf 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.IO; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; @@ -82,7 +81,7 @@ public void SerializeBasicTagAsV3YamlWithoutReferenceWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -101,7 +100,7 @@ public async Task SerializeBasicTagAsV2YamlWithoutReferenceWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -128,7 +127,7 @@ public async Task SerializeAdvancedTagAsV3YamlWithoutReferenceWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -155,7 +154,7 @@ public async Task SerializeAdvancedTagAsV2YamlWithoutReferenceWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -214,7 +213,7 @@ public async Task SerializeAdvancedTagAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -239,7 +238,7 @@ public async Task SerializeAdvancedTagAsV2YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -293,7 +292,7 @@ public async Task SerializeReferencedTagAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -313,7 +312,7 @@ public async Task SerializeReferencedTagAsV2YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs index 45c13500c..9ff3569d4 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; @@ -44,7 +43,7 @@ public async Task SerializeBasicXmlWorks( // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be("{ }"); + Assert.Equal("{ }", actual); } [Theory] @@ -71,7 +70,7 @@ public async Task SerializeAdvancedXmlAsJsonWorks(OpenApiSpecVersion version) // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] @@ -96,7 +95,7 @@ public async Task SerializeAdvancedXmlAsYamlWorks(OpenApiSpecVersion version) // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } From 0cca61ac59f94e69308fa98994039c43cb9988d0 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 10:21:23 -0500 Subject: [PATCH 06/16] chore: additional FA replacementtttttttttt Signed-off-by: Vincent Biret --- .../V3Tests/OpenApiDocumentTests.cs | 4 ++-- .../V3Tests/OpenApiSchemaTests.cs | 2 +- .../Expressions/RuntimeExpressionTests.cs | 8 ++++---- .../Extensions/OpenApiServerExtensionsTests.cs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs index 03f310f6e..8e9c5208e 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs @@ -107,7 +107,7 @@ public void ParseInlineStringWithoutProvidingFormatSucceeds() """; var readResult = OpenApiDocument.Parse(stringOpenApiDoc); - readResult.Document.Info.Title.Should().Be("Sample API"); + Assert.Equal("Sample API", readResult.Document.Info.Title); } [Fact] @@ -1401,7 +1401,7 @@ public void ParseBasicDocumentWithServerVariableAndNoDefaultShouldFail() paths: {} """, "yaml"); - result.Diagnostic.Errors.Should().NotBeEmpty(); + Assert.NotEmpty(result.Diagnostic.Errors); } [Fact] diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs index 3110ef251..2ec8704c5 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs @@ -386,7 +386,7 @@ public async Task ParseAdvancedSchemaWithReferenceShouldSucceed() var expected = await expectedComponents.SerializeAsYamlAsync(OpenApiSpecVersion.OpenApi3_0); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs b/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs index fe6fde3d6..abd9833a4 100644 --- a/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs +++ b/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs @@ -223,9 +223,9 @@ public void CompositeRuntimeExpressionWithMultipleRuntimeExpressionsAndFakeBrace // Assert Assert.NotNull(runtimeExpression); - runtimeExpression.Should().BeOfType(typeof(CompositeExpression)); + Assert.IsType(runtimeExpression); var response = (CompositeExpression)runtimeExpression; - response.Expression.Should().Be(expression); + Assert.Equal(expression, response.Expression); var compositeExpression = runtimeExpression as CompositeExpression; compositeExpression.ContainedExpressions.Should().BeEquivalentTo(new List @@ -263,9 +263,9 @@ public void CompositeRuntimeExpressionWithoutRecognizedRuntimeExpressions(string // Assert Assert.NotNull(runtimeExpression); - runtimeExpression.Should().BeOfType(typeof(CompositeExpression)); + Assert.IsType(runtimeExpression); var response = (CompositeExpression)runtimeExpression; - response.Expression.Should().Be(expression); + Assert.Equal(expression, response.Expression); var compositeExpression = runtimeExpression as CompositeExpression; diff --git a/test/Microsoft.OpenApi.Tests/Extensions/OpenApiServerExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiServerExtensionsTests.cs index b8f581541..24337549f 100644 --- a/test/Microsoft.OpenApi.Tests/Extensions/OpenApiServerExtensionsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiServerExtensionsTests.cs @@ -24,7 +24,7 @@ public void ShouldSubstituteServerVariableWithProvidedValues() var url = variable.ReplaceServerUrlVariables(new Dictionary {{"version", "v2"}}); - url.Should().Be("http://example.com/api/v2"); + Assert.Equal("http://example.com/api/v2", url); } [Fact] @@ -42,7 +42,7 @@ public void ShouldSubstituteServerVariableWithDefaultValues() var url = variable.ReplaceServerUrlVariables(new Dictionary(0)); - url.Should().Be("http://example.com/api/v1"); + Assert.Equal("http://example.com/api/v1", url); } [Fact] From 4ecf8a4123c6d190ab39e9ad59bc9c3ca8cde45b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 10:30:27 -0500 Subject: [PATCH 07/16] chore: additional batch of FA replacement Signed-off-by: Vincent Biret --- .../V31Tests/OpenApiDocumentTests.cs | 4 ++-- .../Extensions/OpenApiServerExtensionsTests.cs | 1 - .../Extensions/OpenApiTypeMapperTests.cs | 2 +- .../Models/OpenApiEncodingTests.cs | 7 +++---- .../Models/OpenApiExternalDocsTests.cs | 7 +++---- .../Models/OpenApiMediaTypeTests.cs | 2 +- .../Models/OpenApiOAuthFlowTests.cs | 9 ++++----- .../Models/OpenApiParameterTests.cs | 13 ++++++------- 8 files changed, 20 insertions(+), 25 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs index 842f7172a..9f4b82472 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs @@ -499,7 +499,7 @@ public async Task ExternalDocumentDereferenceToOpenApiDocumentUsingJsonPointerWo // Assert result.Document.Workspace.Contains("./externalResource.yaml"); - responseSchema.Properties.Count.Should().Be(2); // reference has been resolved + Assert.Equal(2, responseSchema.Properties.Count); // reference has been resolved } [Fact] @@ -522,7 +522,7 @@ public async Task ParseExternalDocumentDereferenceToOpenApiDocumentByIdWorks() result.Document.Workspace.RegisterComponents(doc2); // Assert - requestBodySchema.Properties.Count.Should().Be(2); // reference has been resolved + Assert.Equal(2, requestBodySchema.Properties.Count); // reference has been resolved } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Extensions/OpenApiServerExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiServerExtensionsTests.cs index 24337549f..e15527c64 100644 --- a/test/Microsoft.OpenApi.Tests/Extensions/OpenApiServerExtensionsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiServerExtensionsTests.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs index deec23c4e..a8abcf511 100644 --- a/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs +++ b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs @@ -77,7 +77,7 @@ public void MapOpenApiSchemaTypeToSimpleTypeShouldSucceed(OpenApiSchema schema, var actual = OpenApiTypeMapper.MapOpenApiPrimitiveTypeToSimpleType(schema); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiEncodingTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiEncodingTests.cs index c9ce9d217..fd0b21c9d 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiEncodingTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiEncodingTests.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Xunit; @@ -33,7 +32,7 @@ public async Task SerializeBasicEncodingAsV3Works(OpenApiFormat format, string e // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -56,7 +55,7 @@ public async Task SerializeAdvanceEncodingAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -77,7 +76,7 @@ public async Task SerializeAdvanceEncodingAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExternalDocsTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiExternalDocsTests.cs index 59c81865f..a2bee2e58 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiExternalDocsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiExternalDocsTests.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Xunit; @@ -33,7 +32,7 @@ public async Task SerializeBasicExternalDocsAsV3Works(OpenApiFormat format, stri // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -54,7 +53,7 @@ public async Task SerializeAdvanceExDocsAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -73,7 +72,7 @@ public async Task SerializeAdvanceExDocsAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } #endregion diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs index 4a7b25440..e062bfda3 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs @@ -441,7 +441,7 @@ public void MediaTypeCopyConstructorWorks() // Assert MediaTypeWithObjectExamples.Examples.Should().NotBeEquivalentTo(clone.Examples); - MediaTypeWithObjectExamples.Example.Should().Be(null); + Assert.Null(MediaTypeWithObjectExamples.Example); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiOAuthFlowTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiOAuthFlowTests.cs index e47d1db9b..b3e788625 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiOAuthFlowTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiOAuthFlowTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Xunit; @@ -54,7 +53,7 @@ public async Task SerializeBasicOAuthFlowAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -70,7 +69,7 @@ public async Task SerializeBasicOAuthFlowAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -94,7 +93,7 @@ public async Task SerializePartialOAuthFlowAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -120,7 +119,7 @@ public async Task SerializeCompleteOAuthFlowAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.cs index 8b4d8a42a..1c2e3329f 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.IO; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; @@ -184,7 +183,7 @@ public void WhenStyleIsFormTheDefaultValueOfExplodeShouldBeTrueOtherwiseFalse(Pa }; // Act & Assert - parameter.Explode.Should().Be(expectedExplode); + Assert.Equal(expectedExplode, parameter.Explode); } [Theory] @@ -208,7 +207,7 @@ public async Task WhenStyleAndInIsNullTheDefaultValueOfStyleShouldBeSimple(Param parameter.SerializeAsV3(writer); await writer.FlushAsync(); - parameter.Style.Should().Be(expectedStyle); + Assert.Equal(expectedStyle, parameter.Style); } [Fact] @@ -226,7 +225,7 @@ public async Task SerializeQueryParameterWithMissingStyleSucceeds() var actual = await QueryParameterWithMissingStyle.SerializeAsYamlAsync(OpenApiSpecVersion.OpenApi3_0); // Assert - actual.MakeLineBreaksEnvironmentNeutral().Should().Be(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -247,7 +246,7 @@ public async Task SerializeBasicParameterAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -291,7 +290,7 @@ public async Task SerializeAdvancedParameterAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -321,7 +320,7 @@ public async Task SerializeAdvancedParameterAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] From d0bacd20409f65ebb230cb96ad3af852f73ffd37 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 10:50:15 -0500 Subject: [PATCH 08/16] chore: additional FA replacement batch Signed-off-by: Vincent Biret --- .../V2Tests/OpenApiOperationTests.cs | 102 +----------------- .../V2Tests/OpenApiParameterTests.cs | 30 +++--- .../V3Tests/OpenApiParameterTests.cs | 32 +++--- .../Models/OpenApiDocumentTests.cs | 10 +- 4 files changed, 41 insertions(+), 133 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs index c3212b802..18b5be243 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs @@ -57,104 +57,6 @@ public class OpenApiOperationTests } }; - private static readonly OpenApiOperation _operationWithFormData = - new OpenApiOperation - { - Summary = "Updates a pet in the store with form data", - Description = "", - OperationId = "updatePetWithForm", - Parameters = new List - { - new OpenApiParameter - { - Name = "petId", - In = ParameterLocation.Path, - Description = "ID of pet that needs to be updated", - Required = true, - Schema = new() - { - Type = JsonSchemaType.String - } - } - }, - RequestBody = new OpenApiRequestBody - { - Content = - { - ["application/x-www-form-urlencoded"] = new OpenApiMediaType - { - Schema = new() - { - Type = JsonSchemaType.Object, - Properties = - { - ["name"] = new() - { - Description = "Updated name of the pet", - Type = JsonSchemaType.String - }, - ["status"] = new() - { - Description = "Updated status of the pet", - Type = JsonSchemaType.String - } - }, - Required = new HashSet - { - "name" - } - } - }, - ["multipart/form-data"] = new OpenApiMediaType - { - Schema = new() - { - Type = JsonSchemaType.Object, - Properties = - { - ["name"] = new() - { - Description = "Updated name of the pet", - Type = JsonSchemaType.String - }, - ["status"] = new() - { - Description = "Updated status of the pet", - Type = JsonSchemaType.String - } - }, - Required = new HashSet - { - "name" - } - } - } - } - }, - Responses = new OpenApiResponses - { - ["200"] = new OpenApiResponse - { - Description = "Pet updated.", - Content = new Dictionary - { - ["application/json"] = new OpenApiMediaType(), - ["application/xml"] = new OpenApiMediaType() - } - - }, - ["405"] = new OpenApiResponse - { - Description = "Invalid input", - Content = new Dictionary - { - ["application/json"] = new OpenApiMediaType(), - ["application/xml"] = new OpenApiMediaType() - } - } - } - }; - private static readonly OpenApiOperation _operationWithBody = new OpenApiOperation { Summary = "Updates a pet in the store with request body", @@ -230,7 +132,7 @@ public void ParseBasicOperationShouldSucceed() var operation = OpenApiV2Deserializer.LoadOperation(node); // Assert - operation.Should().BeEquivalentTo(_basicOperation); + Assert.Equivalent(_basicOperation, operation); } [Fact] @@ -248,7 +150,7 @@ public async Task ParseBasicOperationTwiceShouldYieldSameObject() var operation = OpenApiV2Deserializer.LoadOperation(node); // Assert - operation.Should().BeEquivalentTo(_basicOperation); + Assert.Equivalent(_basicOperation, operation); } [Fact] diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs index d89080f6d..334b54865 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs @@ -50,7 +50,7 @@ public void ParsePathParameterShouldSucceed() var parameter = OpenApiV2Deserializer.LoadParameter(node); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Path, @@ -61,7 +61,8 @@ public void ParsePathParameterShouldSucceed() { Type = JsonSchemaType.String } - }); + }, + parameter); } [Fact] @@ -78,7 +79,7 @@ public void ParseQueryParameterShouldSucceed() var parameter = OpenApiV2Deserializer.LoadParameter(node); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Query, @@ -95,7 +96,8 @@ public void ParseQueryParameterShouldSucceed() }, Style = ParameterStyle.Form, Explode = true - }); + }, + parameter); } [Fact] @@ -112,7 +114,7 @@ public void ParseParameterWithNullLocationShouldSucceed() var parameter = OpenApiV2Deserializer.LoadParameter(node); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = null, @@ -123,7 +125,8 @@ public void ParseParameterWithNullLocationShouldSucceed() { Type = JsonSchemaType.String } - }); + }, + parameter); } [Fact] @@ -140,7 +143,7 @@ public void ParseParameterWithNoLocationShouldSucceed() var parameter = OpenApiV2Deserializer.LoadParameter(node); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = null, @@ -151,7 +154,8 @@ public void ParseParameterWithNoLocationShouldSucceed() { Type = JsonSchemaType.String } - }); + }, + parameter); } [Fact] @@ -168,14 +172,15 @@ public void ParseParameterWithNoSchemaShouldSucceed() var parameter = OpenApiV2Deserializer.LoadParameter(node); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = null, Name = "username", Description = "username to fetch", Required = false - }); + }, + parameter); } [Fact] @@ -192,7 +197,7 @@ public void ParseParameterWithUnknownLocationShouldSucceed() var parameter = OpenApiV2Deserializer.LoadParameter(node); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = null, @@ -203,7 +208,8 @@ public void ParseParameterWithUnknownLocationShouldSucceed() { Type = JsonSchemaType.String } - }); + }, + parameter); } [Fact] diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs index af79a64d3..7d36d7cff 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs @@ -32,7 +32,7 @@ public async Task ParsePathParameterShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(stream, OpenApiSpecVersion.OpenApi3_0); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Path, @@ -43,7 +43,7 @@ public async Task ParsePathParameterShouldSucceed() { Type = JsonSchemaType.String } - }); + }, parameter); } [Fact] @@ -53,7 +53,7 @@ public async Task ParseQueryParameterShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "queryParameter.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Query, @@ -70,7 +70,7 @@ public async Task ParseQueryParameterShouldSucceed() }, Style = ParameterStyle.Form, Explode = true - }); + }, parameter); } [Fact] @@ -80,7 +80,7 @@ public async Task ParseQueryParameterWithObjectTypeShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "queryParameterWithObjectType.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Query, @@ -94,7 +94,7 @@ public async Task ParseQueryParameterWithObjectTypeShouldSucceed() } }, Style = ParameterStyle.Form - }); + }, parameter); } [Fact] @@ -107,7 +107,7 @@ public async Task ParseQueryParameterWithObjectTypeAndContentShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(stream, OpenApiSpecVersion.OpenApi3_0); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Query, @@ -138,7 +138,7 @@ public async Task ParseQueryParameterWithObjectTypeAndContentShouldSucceed() } } } - }); + }, parameter); } [Fact] @@ -148,7 +148,7 @@ public async Task ParseHeaderParameterShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "headerParameter.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Header, @@ -166,7 +166,7 @@ public async Task ParseHeaderParameterShouldSucceed() Format = "int64", } } - }); + }, parameter); } [Fact] @@ -176,7 +176,7 @@ public async Task ParseParameterWithNullLocationShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "parameterWithNullLocation.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = null, @@ -187,7 +187,7 @@ public async Task ParseParameterWithNullLocationShouldSucceed() { Type = JsonSchemaType.String } - }); + }, parameter); } [Fact] @@ -200,7 +200,7 @@ public async Task ParseParameterWithNoLocationShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(stream, OpenApiSpecVersion.OpenApi3_0); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = null, @@ -211,7 +211,7 @@ public async Task ParseParameterWithNoLocationShouldSucceed() { Type = JsonSchemaType.String } - }); + }, parameter); } [Fact] @@ -224,7 +224,7 @@ public async Task ParseParameterWithUnknownLocationShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(stream, OpenApiSpecVersion.OpenApi3_0); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = null, @@ -235,7 +235,7 @@ public async Task ParseParameterWithUnknownLocationShouldSucceed() { Type = JsonSchemaType.String } - }); + }, parameter); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs index afb06929d..5a2587620 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs @@ -1961,7 +1961,7 @@ public async Task SerializeDocumentWithWebhooksAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().BeEquivalentTo(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1989,7 +1989,7 @@ public async Task SerializeDocumentWithRootJsonSchemaDialectPropertyWorks() var actual = await doc.SerializeAsYamlAsync(OpenApiSpecVersion.OpenApi3_1); // Assert - actual.MakeLineBreaksEnvironmentNeutral().Should().BeEquivalentTo(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -2015,7 +2015,7 @@ public async Task SerializeV31DocumentWithRefsInWebhooksWorks() webhooks[OperationType.Get].SerializeAsV31(writer); var actual = stringWriter.ToString(); - actual.MakeLineBreaksEnvironmentNeutral().Should().BeEquivalentTo(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -2063,7 +2063,7 @@ public async Task SerializeDocWithDollarIdInDollarRefSucceeds() "; var doc = (await OpenApiDocument.LoadAsync("Models/Samples/docWithDollarId.yaml")).Document; var actual = await doc.SerializeAsYamlAsync(OpenApiSpecVersion.OpenApi3_1); - actual.MakeLineBreaksEnvironmentNeutral().Should().BeEquivalentTo(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -2117,7 +2117,7 @@ public async Task SerializeDocumentTagsWithMultipleExtensionsWorks() }; var actual = await doc.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi3_0); - actual.MakeLineBreaksEnvironmentNeutral().Should().BeEquivalentTo(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral()); } } } From d841a2ae249761037639068a3e021bdc1f746606 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 10:58:16 -0500 Subject: [PATCH 09/16] chore: additional FA replacement batch Signed-off-by: Vincent Biret --- .../V3Tests/OpenApiMediaTypeTests.cs | 3 +-- .../Expressions/RuntimeExpressionTests.cs | 3 ++- test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs | 2 +- .../Models/OpenApiSecurityRequirementTests.cs | 6 +++--- .../Validations/OpenApiParameterValidationTests.cs | 4 ++-- .../Validations/OpenApiPathsValidationTests.cs | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiMediaTypeTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiMediaTypeTests.cs index 8ade58ca5..1718028da 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiMediaTypeTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiMediaTypeTests.cs @@ -110,8 +110,7 @@ public async Task ParseMediaTypeWithEmptyArrayInExamplesWorks() var serialized = await mediaType.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi3_0); // Assert - serialized.MakeLineBreaksEnvironmentNeutral() - .Should().BeEquivalentTo(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), serialized.MakeLineBreaksEnvironmentNeutral()); } } } diff --git a/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs b/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs index abd9833a4..285366c0a 100644 --- a/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs +++ b/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs @@ -244,7 +244,8 @@ public void CompositeRuntimeExpressionWithInvalidRuntimeExpressions(string expre Action test = () => RuntimeExpression.Build(expression); // Assert - test.Should().Throw().WithMessage(String.Format(SRResource.RuntimeExpressionHasInvalidFormat, invalidExpression)); + var result = Assert.Throws(test); + Assert.Equal(result.Message, string.Format(SRResource.RuntimeExpressionHasInvalidFormat, invalidExpression)); } [Theory] diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs index 5a2587620..ef3e26221 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs @@ -1898,7 +1898,7 @@ public void SerializeExamplesDoesNotThrowNullReferenceException() }; OpenApiJsonWriter apiWriter = new OpenApiJsonWriter(new StringWriter()); - doc.Invoking(d => d.SerializeAsV3(apiWriter)).Should().NotThrow(); + doc.SerializeAsV3(apiWriter); } [Theory] diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecurityRequirementTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecurityRequirementTests.cs index b555b9311..af0343f57 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecurityRequirementTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecurityRequirementTests.cs @@ -277,10 +277,10 @@ public void SchemesShouldConsiderOnlyReferenceIdForEquality() // Assert // Only the first two should be added successfully since the latter two are duplicates of securityScheme1. // Duplicate determination only considers Reference.Id. - addSecurityScheme1Duplicate.Should().Throw(); - addSecurityScheme1WithDifferentProperties.Should().Throw(); + Assert.Throws(addSecurityScheme1Duplicate); + Assert.Throws(addSecurityScheme1WithDifferentProperties); - securityRequirement.Should().HaveCount(2); + Assert.Equal(2, securityRequirement.Count); securityRequirement.Should().BeEquivalentTo( new OpenApiSecurityRequirement diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs index 83d1a2e1a..87214c74b 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs @@ -28,7 +28,7 @@ public void ValidateFieldIsRequiredInParameter() var errors = parameter.Validate(ValidationRuleSet.GetDefaultRuleSet()); // Assert - errors.Should().NotBeEmpty(); + Assert.NotEmpty(errors); errors.Select(e => e.Message).Should().BeEquivalentTo(new[] { nameError, @@ -53,7 +53,7 @@ public void ValidateRequiredIsTrueWhenInIsPathInParameter() walker.Walk(parameter); var errors = validator.Errors; // Assert - errors.Should().NotBeEmpty(); + Assert.NotEmpty(errors); errors.Select(e => e.Message).Should().BeEquivalentTo(new[] { "\"required\" must be true when parameter location is \"path\"" diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs index bbe15c66e..4051a0a91 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs @@ -23,7 +23,7 @@ public void ValidatePathsMustBeginWithSlash() var errors = paths.Validate(ValidationRuleSet.GetDefaultRuleSet()); // Assert - errors.Should().NotBeEmpty(); + Assert.NotEmpty(errors); errors.Select(e => e.Message).Should().BeEquivalentTo(error); } @@ -42,7 +42,7 @@ public void ValidatePathsAreUnique() var errors = paths.Validate(ValidationRuleSet.GetDefaultRuleSet()); // Assert - errors.Should().NotBeEmpty(); + Assert.NotEmpty(errors); errors.Select(e => e.Message).Should().BeEquivalentTo(error); } [Fact] @@ -76,7 +76,7 @@ public void ValidatePathsAreUniqueConsidersMultiParametersAsIdentical() var errors = paths.Validate(ValidationRuleSet.GetDefaultRuleSet()); // Assert - errors.Should().NotBeEmpty(); + Assert.NotEmpty(errors); } } } From c3a1fabff35f468ec16606f038666130a6d0412c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 14:40:34 -0500 Subject: [PATCH 10/16] chore: additional FA replacement Signed-off-by: Vincent Biret --- .../V31Tests/OpenApiSchemaTests.cs | 7 ++++--- .../Models/OpenApiMediaTypeTests.cs | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs index b3b26c079..5ef68c078 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text.Json.Nodes; using System.Threading.Tasks; using FluentAssertions; @@ -298,9 +299,9 @@ public void CloningSchemaWithExamplesAndEnumsShouldSucceed() clone.Default = 6; // Assert - clone.Enum.Should().NotBeEquivalentTo(schema.Enum); - clone.Examples.Should().NotBeEquivalentTo(schema.Examples); - clone.Default.Should().NotBeEquivalentTo(schema.Default); + Assert.Equivalent(new int[] {1, 2, 3, 4}, clone.Enum.Select(static x => x.GetValue()).ToArray()); + Assert.Equivalent(new int[] {2, 3, 4}, clone.Examples.Select(static x => x.GetValue()).ToArray()); + Assert.Equivalent(6, clone.Default.GetValue()); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs index e062bfda3..b1f6ca474 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Text.Json.Nodes; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; @@ -440,7 +439,10 @@ public void MediaTypeCopyConstructorWorks() }; // Assert - MediaTypeWithObjectExamples.Examples.Should().NotBeEquivalentTo(clone.Examples); + Assert.Equal(42, clone.Example.GetValue()); + Assert.Empty(clone.Examples); + Assert.Empty(clone.Encoding); + Assert.Empty(clone.Extensions); Assert.Null(MediaTypeWithObjectExamples.Example); } } From 19d7935ac2d78716e43d496cb2b90ec1da1251dc Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 15:07:53 -0500 Subject: [PATCH 11/16] chore: additional FA replacement batch Signed-off-by: Vincent Biret --- .../V2Tests/ComparisonTests.cs | 2 +- .../V2Tests/OpenApiDocumentTests.cs | 4 +-- .../V2Tests/OpenApiPathItemTests.cs | 3 +- .../V2Tests/OpenApiSecuritySchemeTests.cs | 25 +++++++-------- .../V2Tests/OpenApiServerTests.cs | 5 ++- .../V31Tests/OpenApiDocumentTests.cs | 9 +++--- .../V31Tests/OpenApiInfoTests.cs | 5 ++- .../V31Tests/OpenApiLicenseTests.cs | 5 ++- .../V31Tests/OpenApiSchemaTests.cs | 8 ++--- .../V3Tests/OpenApiCallbackTests.cs | 29 ++++++++--------- .../V3Tests/OpenApiContactTests.cs | 7 ++-- .../V3Tests/OpenApiDiscriminatorTests.cs | 5 ++- .../V3Tests/OpenApiDocumentTests.cs | 32 +++++++++---------- .../V3Tests/OpenApiEncodingTests.cs | 9 +++--- .../V3Tests/OpenApiInfoTests.cs | 8 ++--- .../V3Tests/OpenApiSchemaTests.cs | 30 ++++++++--------- .../V3Tests/OpenApiSecuritySchemeTests.cs | 21 ++++++------ .../V3Tests/OpenApiXmlTests.cs | 5 ++- .../Extensions/OpenApiTypeMapperTests.cs | 3 +- 19 files changed, 102 insertions(+), 113 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/ComparisonTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/ComparisonTests.cs index 209edcc4d..ae725bcb1 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/ComparisonTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/ComparisonTests.cs @@ -30,7 +30,7 @@ public async Task EquivalentV2AndV3DocumentsShouldProduceEquivalentObjects(strin result2.Document.Should().BeEquivalentTo(result1.Document, options => options.Excluding(x => x.Workspace).Excluding(y => y.BaseUri)); - result1.Diagnostic.Errors.Should().BeEquivalentTo(result2.Diagnostic.Errors); + Assert.Equivalent(result2.Diagnostic.Errors, result1.Diagnostic.Errors); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs index a9bd8291d..02938f4b0 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs @@ -280,11 +280,11 @@ public async Task ShouldAssignSchemaToAllResponses() var json = response.Value.Content["application/json"]; Assert.NotNull(json); - json.Schema.Should().BeEquivalentTo(targetSchema); + Assert.Equivalent(targetSchema, json.Schema); var xml = response.Value.Content["application/xml"]; Assert.NotNull(xml); - xml.Schema.Should().BeEquivalentTo(targetSchema); + Assert.Equivalent(targetSchema, xml.Schema); } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs index 47f3903fa..f8f022167 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader.ParseNodes; using Microsoft.OpenApi.Reader.V2; @@ -260,7 +259,7 @@ public void ParseBasicPathItemWithFormDataShouldSucceed() var pathItem = OpenApiV2Deserializer.LoadPathItem(node); // Assert - pathItem.Should().BeEquivalentTo(_basicPathItemWithFormData); + Assert.Equivalent(_basicPathItemWithFormData, pathItem); } [Fact] diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSecuritySchemeTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSecuritySchemeTests.cs index 82565facd..fd3b863a5 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSecuritySchemeTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSecuritySchemeTests.cs @@ -4,7 +4,6 @@ using System; using System.IO; using System.Linq; -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.ParseNodes; @@ -36,12 +35,12 @@ public void ParseHttpSecuritySchemeShouldSucceed() var securityScheme = OpenApiV2Deserializer.LoadSecurityScheme(node); // Assert - securityScheme.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSecurityScheme { Type = SecuritySchemeType.Http, Scheme = OpenApiConstants.Basic - }); + }, securityScheme); } [Fact] @@ -61,13 +60,13 @@ public void ParseApiKeySecuritySchemeShouldSucceed() var securityScheme = OpenApiV2Deserializer.LoadSecurityScheme(node); // Assert - securityScheme.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSecurityScheme { Type = SecuritySchemeType.ApiKey, Name = "api_key", In = ParameterLocation.Header - }); + }, securityScheme); } [Fact] @@ -86,7 +85,7 @@ public void ParseOAuth2ImplicitSecuritySchemeShouldSucceed() var securityScheme = OpenApiV2Deserializer.LoadSecurityScheme(node); // Assert - securityScheme.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSecurityScheme { Type = SecuritySchemeType.OAuth2, @@ -102,7 +101,7 @@ public void ParseOAuth2ImplicitSecuritySchemeShouldSucceed() } } } - }); + }, securityScheme); } [Fact] @@ -121,7 +120,7 @@ public void ParseOAuth2PasswordSecuritySchemeShouldSucceed() var securityScheme = OpenApiV2Deserializer.LoadSecurityScheme(node); // Assert - securityScheme.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSecurityScheme { Type = SecuritySchemeType.OAuth2, @@ -137,7 +136,7 @@ public void ParseOAuth2PasswordSecuritySchemeShouldSucceed() } } } - }); + }, securityScheme); } [Fact] @@ -156,7 +155,7 @@ public void ParseOAuth2ApplicationSecuritySchemeShouldSucceed() var securityScheme = OpenApiV2Deserializer.LoadSecurityScheme(node); // Assert - securityScheme.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSecurityScheme { Type = SecuritySchemeType.OAuth2, @@ -172,7 +171,7 @@ public void ParseOAuth2ApplicationSecuritySchemeShouldSucceed() } } } - }); + }, securityScheme); } [Fact] @@ -192,7 +191,7 @@ public void ParseOAuth2AccessCodeSecuritySchemeShouldSucceed() var securityScheme = OpenApiV2Deserializer.LoadSecurityScheme(node); // Assert - securityScheme.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSecurityScheme { Type = SecuritySchemeType.OAuth2, @@ -208,7 +207,7 @@ public void ParseOAuth2AccessCodeSecuritySchemeShouldSucceed() } } } - }); + }, securityScheme); } static YamlDocument LoadYamlDocument(Stream input) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs index 6f72dccb7..95452e6ad 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs @@ -1,5 +1,4 @@ using System.Linq; -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Xunit; @@ -305,7 +304,7 @@ public void InvalidHostShouldYieldError() var result = OpenApiDocument.Parse(input, "yaml", settings); Assert.Empty(result.Document.Servers); - result.Diagnostic.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiDiagnostic { Errors = @@ -313,7 +312,7 @@ public void InvalidHostShouldYieldError() new OpenApiError("#/", "Invalid host") }, SpecificationVersion = OpenApiSpecVersion.OpenApi2_0 - }); + }, result.Diagnostic); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs index 9f4b82472..faa0ebf78 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs @@ -11,6 +11,7 @@ using Microsoft.OpenApi.Writers; using Xunit; using VerifyXunit; +using VerifyTests; namespace Microsoft.OpenApi.Readers.Tests.V31Tests { @@ -198,7 +199,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() }; // Assert - actual.Diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_1 }); + Assert.Equivalent(new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_1 }, actual.Diagnostic); actual.Document.Should().BeEquivalentTo(expected, options => options.Excluding(x => x.Workspace).Excluding(y => y.BaseUri)); } @@ -389,8 +390,8 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() .Excluding(x => x.Webhooks["pets"].Reference) .Excluding(x => x.Workspace) .Excluding(y => y.BaseUri)); - actual.Diagnostic.Should().BeEquivalentTo( - new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_1 }); + Assert.Equivalent( + new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_1 }, actual.Diagnostic); } [Fact] @@ -461,7 +462,7 @@ public async Task ParseDocumentWithPatternPropertiesInSchemaWorks() var actualMediaType = await mediaType.SerializeAsYamlAsync(OpenApiSpecVersion.OpenApi3_1); // Assert - actualSchema.Should().BeEquivalentTo(expectedSchema); + Assert.Equivalent(expectedSchema, actualSchema); actualMediaType.MakeLineBreaksEnvironmentNeutral().Should().BeEquivalentTo(expectedMediaType.MakeLineBreaksEnvironmentNeutral()); } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs index 8ecfcf7d5..6fb2d85ab 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs @@ -1,7 +1,6 @@ using System; using System.IO; using System.Linq; -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.ParseNodes; @@ -33,7 +32,7 @@ public void ParseBasicInfoShouldSucceed() var openApiInfo = OpenApiV31Deserializer.LoadInfo(node); // Assert - openApiInfo.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiInfo { Title = "Basic Info", @@ -52,7 +51,7 @@ public void ParseBasicInfoShouldSucceed() Name = "Apache 2.0", Url = new Uri("http://www.apache.org/licenses/LICENSE-2.0.html") } - }); + }, openApiInfo); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs index cb617064e..9ac47c730 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs @@ -3,7 +3,6 @@ using System.IO; using System.Linq; -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.ParseNodes; @@ -36,12 +35,12 @@ public void ParseLicenseWithSpdxIdentifierShouldSucceed() var license = OpenApiV31Deserializer.LoadLicense(node); // Assert - license.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiLicense { Name = "Apache 2.0", Identifier = "Apache-2.0" - }); + }, license); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs index 5ef68c078..04775e901 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs @@ -86,10 +86,10 @@ public async Task ParseBasicV31SchemaShouldSucceed() // Act var schema = await OpenApiModelFactory.LoadAsync( - System.IO.Path.Combine(SampleFolderPath, "jsonSchema.json"), OpenApiSpecVersion.OpenApi3_1); + Path.Combine(SampleFolderPath, "jsonSchema.json"), OpenApiSpecVersion.OpenApi3_1); // Assert - schema.Should().BeEquivalentTo(expectedObject); + Assert.Equivalent(expectedObject, schema); } [Fact] @@ -115,7 +115,7 @@ public void ParseSchemaWithTypeArrayWorks() var actual = OpenApiModelFactory.Parse(schema, OpenApiSpecVersion.OpenApi3_1, out _); // Assert - actual.Should().BeEquivalentTo(expected); + Assert.Equivalent(expected, actual); } [Fact] @@ -176,7 +176,7 @@ public async Task ParseV31SchemaShouldSucceed() }; // Assert - schema.Should().BeEquivalentTo(expectedSchema); + Assert.Equivalent(expectedSchema, schema); } [Fact] diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiCallbackTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiCallbackTests.cs index 1e50ca6e0..5899a3a65 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiCallbackTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiCallbackTests.cs @@ -4,7 +4,6 @@ using System.IO; using System.Linq; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Expressions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; @@ -28,7 +27,7 @@ public async Task ParseBasicCallbackShouldSucceed() var callback = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "basicCallback.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - callback.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiCallback { PathItems = @@ -59,7 +58,7 @@ public async Task ParseBasicCallbackShouldSucceed() } } } - }); + }, callback); } [Fact] @@ -76,10 +75,10 @@ public async Task ParseCallbackWithReferenceShouldSucceed() var callback = subscribeOperation.Callbacks["simpleHook"]; - result.Diagnostic.Should().BeEquivalentTo( - new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }); + Assert.Equivalent( + new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }, result.Diagnostic); - callback.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiCallback { PathItems = @@ -117,7 +116,7 @@ public async Task ParseCallbackWithReferenceShouldSucceed() Id = "simpleHook", HostDocument = result.Document } - }); + }, callback); } [Fact] @@ -130,12 +129,12 @@ public async Task ParseMultipleCallbacksWithReferenceShouldSucceed() var path = result.Document.Paths.First().Value; var subscribeOperation = path.Operations[OperationType.Post]; - result.Diagnostic.Should().BeEquivalentTo( - new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }); + Assert.Equivalent( + new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }, result.Diagnostic); var callback1 = subscribeOperation.Callbacks["simpleHook"]; - callback1.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiCallback { PathItems = @@ -173,10 +172,10 @@ public async Task ParseMultipleCallbacksWithReferenceShouldSucceed() Id = "simpleHook", HostDocument = result.Document } - }); + }, callback1); var callback2 = subscribeOperation.Callbacks["callback2"]; - callback2.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiCallback { PathItems = @@ -209,10 +208,10 @@ public async Task ParseMultipleCallbacksWithReferenceShouldSucceed() }, } } - }); + }, callback2); var callback3 = subscribeOperation.Callbacks["callback3"]; - callback3.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiCallback { PathItems = @@ -252,7 +251,7 @@ public async Task ParseMultipleCallbacksWithReferenceShouldSucceed() } } } - }); + }, callback3); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiContactTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiContactTests.cs index d6d0422c4..b2617ecf6 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiContactTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiContactTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Xunit; @@ -26,15 +25,15 @@ public void ParseStringContactFragmentShouldSucceed() var contact = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, out var diagnostic, OpenApiConstants.Json); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); - contact.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiContact { Email = "support@swagger.io", Name = "API Support", Url = new("http://www.swagger.io/support") - }); + }, contact); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDiscriminatorTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDiscriminatorTests.cs index ba62c7f33..476d3a93a 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDiscriminatorTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDiscriminatorTests.cs @@ -3,7 +3,6 @@ using System.IO; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Xunit; @@ -34,7 +33,7 @@ public async Task ParseBasicDiscriminatorShouldSucceed() var discriminator = OpenApiModelFactory.Load(memoryStream, OpenApiSpecVersion.OpenApi3_0, OpenApiConstants.Yaml, out var diagnostic); // Assert - discriminator.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiDiscriminator { PropertyName = "pet_type", @@ -43,7 +42,7 @@ public async Task ParseBasicDiscriminatorShouldSucceed() ["puppy"] = "#/components/schemas/Dog", ["kitten"] = "Cat" } - }); + }, discriminator); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs index 8e9c5208e..d67de2258 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs @@ -88,11 +88,11 @@ public void ParseDocumentFromInlineStringShouldSucceed() Paths = new OpenApiPaths() }, options => options.Excluding(x => x.Workspace).Excluding(y => y.BaseUri)); - result.Diagnostic.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 - }); + }, result.Diagnostic); } [Fact] @@ -162,7 +162,7 @@ public async Task ParseBrokenMinimalDocumentShouldYieldExpectedDiagnostic() Paths = new OpenApiPaths() }, options => options.Excluding(x => x.Workspace).Excluding(y => y.BaseUri)); - result.Diagnostic.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiDiagnostic { Errors = @@ -170,7 +170,7 @@ public async Task ParseBrokenMinimalDocumentShouldYieldExpectedDiagnostic() new OpenApiValidatorError(nameof(OpenApiInfoRules.InfoRequiredFields),"#/info/title", "The field 'title' in 'info' object is REQUIRED.") }, SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 - }); + }, result.Diagnostic); } [Fact] @@ -189,11 +189,11 @@ public async Task ParseMinimalDocumentShouldSucceed() Paths = new OpenApiPaths() }, options => options.Excluding(x => x.Workspace).Excluding(y => y.BaseUri)); - result.Diagnostic.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 - }); + }, result.Diagnostic); } [Fact] @@ -578,8 +578,8 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() actual.Document.Should().BeEquivalentTo(expectedDoc, options => options.Excluding(x => x.Workspace).Excluding(y => y.BaseUri)); - actual.Diagnostic.Should().BeEquivalentTo( - new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }); + Assert.Equivalent( + new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }, actual.Diagnostic); } [Fact] @@ -1089,8 +1089,8 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() .Excluding(x => x.Workspace) .Excluding(y => y.BaseUri)); - actual.Diagnostic.Should().BeEquivalentTo( - new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }); + Assert.Equivalent( + new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }, actual.Diagnostic); } [Fact] @@ -1100,8 +1100,8 @@ public async Task ParsePetStoreExpandedShouldSucceed() // TODO: Create the object in memory and compare with the one read from YAML file. - actual.Diagnostic.Should().BeEquivalentTo( - new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }); + Assert.Equivalent( + new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }, actual.Diagnostic); } [Fact] @@ -1211,14 +1211,14 @@ public async Task ParseDocumentWithJsonSchemaReferencesWorks() var expectedSchema = new OpenApiSchemaReference("User", result.Document); // Assert - actualSchema.Should().BeEquivalentTo(expectedSchema); + Assert.Equivalent(expectedSchema, actualSchema); } [Fact] public async Task ValidateExampleShouldNotHaveDataTypeMismatch() { // Act - var result = await OpenApiDocument.LoadAsync(System.IO.Path.Combine(SampleFolderPath, "documentWithDateExampleInSchema.yaml"), new OpenApiReaderSettings + var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "documentWithDateExampleInSchema.yaml"), new OpenApiReaderSettings { ReferenceResolution = ReferenceResolutionSetting.ResolveLocalReferences @@ -1375,11 +1375,11 @@ public void ParseBasicDocumentWithServerVariableShouldSucceed() Paths = new() }; - result.Diagnostic.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiDiagnostic { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 - }); + }, result.Diagnostic); result.Document.Should().BeEquivalentTo(expected, options => options.Excluding(x => x.BaseUri)); } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiEncodingTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiEncodingTests.cs index 91e428c49..6f9fb5346 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiEncodingTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiEncodingTests.cs @@ -3,7 +3,6 @@ using System.IO; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Xunit; @@ -27,11 +26,11 @@ public async Task ParseBasicEncodingShouldSucceed() var encoding = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "basicEncoding.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - encoding.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiEncoding { ContentType = "application/xml; charset=utf-8" - }); + }, encoding); } [Fact] @@ -43,7 +42,7 @@ public async Task ParseAdvancedEncodingShouldSucceed() var encoding = await OpenApiModelFactory.LoadAsync(stream, OpenApiSpecVersion.OpenApi3_0); // Assert - encoding.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiEncoding { ContentType = "image/png, image/jpeg", @@ -59,7 +58,7 @@ public async Task ParseAdvancedEncodingShouldSucceed() } } } - }); + }, encoding); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs index fdd5ae8ee..a9138ce78 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs @@ -87,7 +87,7 @@ public async Task ParseBasicInfoShouldSucceed() var openApiInfo = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "basicInfo.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - openApiInfo.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiInfo { Title = "Basic Info", @@ -105,7 +105,7 @@ public async Task ParseBasicInfoShouldSucceed() Name = "Apache 2.0", Url = new Uri("http://www.apache.org/licenses/LICENSE-2.0.html") } - }); + }, openApiInfo); } [Fact] @@ -117,12 +117,12 @@ public async Task ParseMinimalInfoShouldSucceed() var openApiInfo = await OpenApiModelFactory.LoadAsync(stream, OpenApiSpecVersion.OpenApi3_0); // Assert - openApiInfo.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiInfo { Title = "Minimal Info", Version = "1.0.1" - }); + }, openApiInfo); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs index 2ec8704c5..9a77e678e 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs @@ -47,14 +47,14 @@ public void ParsePrimitiveSchemaShouldSucceed() var schema = OpenApiV3Deserializer.LoadSchema(node); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); - schema.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSchema { Type = JsonSchemaType.String, Format = "email" - }); + }, schema); } [Fact] @@ -70,7 +70,7 @@ public void ParseExampleStringFragmentShouldSucceed() var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, out var diagnostic); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); openApiAny.Should().BeEquivalentTo(new OpenApiAny( new JsonObject @@ -93,7 +93,7 @@ public void ParseEnumFragmentShouldSucceed() var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, out var diagnostic); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); openApiAny.Should().BeEquivalentTo(new OpenApiAny( new JsonArray @@ -118,9 +118,9 @@ public void ParsePathFragmentShouldSucceed() var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, out var diagnostic, "yaml"); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); - openApiAny.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiPathItem { Summary = "externally referenced path item", @@ -137,7 +137,7 @@ public void ParsePathFragmentShouldSucceed() } } } - }); + }, openApiAny); } [Fact] @@ -159,9 +159,9 @@ public void ParseDictionarySchemaShouldSucceed() var schema = OpenApiV3Deserializer.LoadSchema(node); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); - schema.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSchema { Type = JsonSchemaType.Object, @@ -169,7 +169,7 @@ public void ParseDictionarySchemaShouldSucceed() { Type = JsonSchemaType.String } - }); + }, schema); } } @@ -191,7 +191,7 @@ public void ParseBasicSchemaWithExampleShouldSucceed() var schema = OpenApiV3Deserializer.LoadSchema(node); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); schema.Should().BeEquivalentTo( new OpenApiSchema @@ -235,11 +235,11 @@ public async Task ParseBasicSchemaWithReferenceShouldSucceed() // Assert var components = result.Document.Components; - result.Diagnostic.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 - }); + }, result.Diagnostic); var expectedComponents = new OpenApiComponents { @@ -289,7 +289,7 @@ public async Task ParseBasicSchemaWithReferenceShouldSucceed() } }; - components.Should().BeEquivalentTo(expectedComponents); + Assert.Equivalent(expectedComponents, components); } [Fact] diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSecuritySchemeTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSecuritySchemeTests.cs index 3f99bb2c5..dd090e344 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSecuritySchemeTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSecuritySchemeTests.cs @@ -4,7 +4,6 @@ using System; using System.IO; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Xunit; @@ -27,12 +26,12 @@ public async Task ParseHttpSecuritySchemeShouldSucceed() var securityScheme = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "httpSecurityScheme.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - securityScheme.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSecurityScheme { Type = SecuritySchemeType.Http, Scheme = OpenApiConstants.Basic - }); + }, securityScheme); } [Fact] @@ -42,13 +41,13 @@ public async Task ParseApiKeySecuritySchemeShouldSucceed() var securityScheme = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "apiKeySecurityScheme.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - securityScheme.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSecurityScheme { Type = SecuritySchemeType.ApiKey, Name = "api_key", In = ParameterLocation.Header - }); + }, securityScheme); } [Fact] @@ -58,13 +57,13 @@ public async Task ParseBearerSecuritySchemeShouldSucceed() var securityScheme = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "bearerSecurityScheme.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - securityScheme.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSecurityScheme { Type = SecuritySchemeType.Http, Scheme = OpenApiConstants.Bearer, BearerFormat = OpenApiConstants.Jwt - }); + }, securityScheme); } [Fact] @@ -74,7 +73,7 @@ public async Task ParseOAuth2SecuritySchemeShouldSucceed() var securityScheme = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "oauth2SecurityScheme.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - securityScheme.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSecurityScheme { Type = SecuritySchemeType.OAuth2, @@ -90,7 +89,7 @@ public async Task ParseOAuth2SecuritySchemeShouldSucceed() } } } - }); + }, securityScheme); } [Fact] @@ -100,13 +99,13 @@ public async Task ParseOpenIdConnectSecuritySchemeShouldSucceed() var securityScheme = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "openIdConnectSecurityScheme.yaml"), OpenApiSpecVersion.OpenApi3_0); // Assert - securityScheme.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSecurityScheme { Type = SecuritySchemeType.OpenIdConnect, Description = "Sample Description", OpenIdConnectUrl = new Uri("http://www.example.com") - }); + }, securityScheme); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiXmlTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiXmlTests.cs index fc23865ba..d90076516 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiXmlTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiXmlTests.cs @@ -4,7 +4,6 @@ using System; using System.IO; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Xunit; @@ -28,14 +27,14 @@ public async Task ParseBasicXmlShouldSucceed() var xml = await OpenApiModelFactory.LoadAsync(Resources.GetStream(Path.Combine(SampleFolderPath, "basicXml.yaml")), OpenApiSpecVersion.OpenApi3_0); // Assert - xml.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiXml { Name = "name1", Namespace = new Uri("http://example.com/schema/namespaceSample"), Prefix = "samplePrefix", Wrapped = true - }); + }, xml); } } } diff --git a/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs index a8abcf511..c41bd6e98 100644 --- a/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs +++ b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Xunit; @@ -66,7 +65,7 @@ public void MapTypeToOpenApiPrimitiveTypeShouldSucceed(Type type, OpenApiSchema var actual = OpenApiTypeMapper.MapTypeToOpenApiPrimitiveType(type); // Assert - actual.Should().BeEquivalentTo(expected); + Assert.Equivalent(expected, actual); } [Theory] From a704fad361bf9f49613d33ed9d665ff3980d36c8 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 15:21:39 -0500 Subject: [PATCH 12/16] chore: additional FA replacement batch Signed-off-by: Vincent Biret --- .../Models/OpenApiDocumentTests.cs | 1 - .../OpenApiParameterValidationTests.cs | 17 ++++++------- .../OpenApiPathsValidationTests.cs | 5 ++-- .../Walkers/WalkerLocationTests.cs | 25 +++++++++---------- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs index ef3e26221..752ec7d9f 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs @@ -6,7 +6,6 @@ using System.Globalization; using System.IO; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs index 87214c74b..cacf3d7fa 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Properties; @@ -29,11 +28,11 @@ public void ValidateFieldIsRequiredInParameter() // Assert Assert.NotEmpty(errors); - errors.Select(e => e.Message).Should().BeEquivalentTo(new[] + Assert.Equivalent(new[] { nameError, inError - }); + }, errors.Select(e => e.Message)); } [Fact] @@ -54,10 +53,10 @@ public void ValidateRequiredIsTrueWhenInIsPathInParameter() var errors = validator.Errors; // Assert Assert.NotEmpty(errors); - errors.Select(e => e.Message).Should().BeEquivalentTo(new[] + Assert.Equivalent(new[] { "\"required\" must be true when parameter location is \"path\"" - }); + }, errors.Select(e => e.Message)); } [Fact] @@ -183,14 +182,14 @@ public void PathParameterNotInThePathShouldReturnAnError() // Assert Assert.True(result); - errors.OfType().Select(e => e.RuleName).Should().BeEquivalentTo(new[] + Assert.Equivalent(new[] { "PathParameterShouldBeInThePath" - }); - errors.Select(e => e.Pointer).Should().BeEquivalentTo(new[] + }, errors.OfType().Select(e => e.RuleName)); + Assert.Equivalent(new[] { "#/in" - }); + }, errors.Select(e => e.Pointer)); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs index 4051a0a91..09223e7b8 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiPathsValidationTests.cs @@ -1,5 +1,4 @@ using System.Linq; -using FluentAssertions; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Properties; @@ -24,7 +23,7 @@ public void ValidatePathsMustBeginWithSlash() // Assert Assert.NotEmpty(errors); - errors.Select(e => e.Message).Should().BeEquivalentTo(error); + Assert.Equivalent(new string[] {error}, errors.Select(e => e.Message).ToArray()); } [Fact] @@ -43,7 +42,7 @@ public void ValidatePathsAreUnique() // Assert Assert.NotEmpty(errors); - errors.Select(e => e.Message).Should().BeEquivalentTo(error); + Assert.Equivalent(new string[] {error}, errors.Select(e => e.Message).ToArray()); } [Fact] public void ValidatePathsAreUniqueDoesNotConsiderMultiParametersAsIdentical() diff --git a/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs b/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs index bec1f3602..d48c88b2b 100644 --- a/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; -using FluentAssertions; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; @@ -23,12 +22,12 @@ public void LocateTopLevelObjects() var walker = new OpenApiWalker(locator); walker.Walk(doc); - locator.Locations.Should().BeEquivalentTo(new List { + Assert.Equivalent(new List { "#/info", "#/servers", "#/paths", "#/tags" - }); + }, locator.Locations); } [Fact] @@ -51,7 +50,7 @@ public void LocateTopLevelArrayItems() var walker = new OpenApiWalker(locator); walker.Walk(doc); - locator.Locations.Should().BeEquivalentTo(new List { + Assert.Equivalent(new List { "#/info", "#/servers", "#/servers/0", @@ -59,7 +58,7 @@ public void LocateTopLevelArrayItems() "#/paths", "#/tags", "#/tags/0" - }); + }, locator.Locations); } [Fact] @@ -96,7 +95,7 @@ public void LocatePathOperationContentSchema() var walker = new OpenApiWalker(locator); walker.Walk(doc); - locator.Locations.Should().BeEquivalentTo(new List { + Assert.Equivalent(new List { "#/info", "#/servers", "#/paths", @@ -110,9 +109,9 @@ public void LocatePathOperationContentSchema() "#/paths/~1test/get/tags", "#/tags", - }); + }, locator.Locations); - locator.Keys.Should().BeEquivalentTo(new List { "/test", "Get", "200", "application/json" }); + Assert.Equivalent(new List { "/test", "Get", "200", "application/json" }, locator.Keys); } [Fact] @@ -144,7 +143,7 @@ public void WalkDOMWithCycles() var walker = new OpenApiWalker(locator); walker.Walk(doc); - locator.Locations.Should().BeEquivalentTo(new List { + Assert.Equivalent(new List { "#/info", "#/servers", "#/paths", @@ -152,7 +151,7 @@ public void WalkDOMWithCycles() "#/components/schemas/loopy", "#/components/schemas/loopy/properties/name", "#/tags" - }); + }, locator.Locations); } /// @@ -237,13 +236,13 @@ public void LocateReferences() var walker = new OpenApiWalker(locator); walker.Walk(doc); - locator.Locations.Where(l => l.StartsWith("referenceAt:")).Should().BeEquivalentTo(new List { + Assert.Equivalent(new List { "referenceAt: #/paths/~1/get/responses/200/content/application~1json/schema", "referenceAt: #/paths/~1/get/responses/200/headers/test-header/schema", "referenceAt: #/components/schemas/derived/anyOf/0", "referenceAt: #/components/securitySchemes/test-secScheme", "referenceAt: #/components/headers/test-header/schema" - }); + }, locator.Locations.Where(l => l.StartsWith("referenceAt:"))); } } @@ -278,7 +277,7 @@ public override void Visit(OpenApiPathItem pathItem) Locations.Add(this.PathString); } - public override void Visit(OpenApiResponses responses) + public override void Visit(OpenApiResponses response) { Locations.Add(this.PathString); } From 99c082428ebbd202da6723daeadd556e27596b96 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 16 Jan 2025 07:35:10 -0500 Subject: [PATCH 13/16] chore: additional FA replacement batch Signed-off-by: Vincent Biret --- .../V2Tests/OpenApiOperationTests.cs | 2 +- .../V31Tests/OpenApiDocumentTests.cs | 2 +- .../V31Tests/OpenApiSchemaTests.cs | 4 ++-- .../V3Tests/OpenApiDocumentTests.cs | 2 +- .../V3Tests/OpenApiResponseTests.cs | 2 +- test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs index 18b5be243..331810a1f 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs @@ -287,7 +287,7 @@ public void ParseOperationWithEmptyProducesArraySetsResponseSchemaIfExists() // Assert var actual = stringBuilder.ToString(); - actual.MakeLineBreaksEnvironmentNeutral().Should().BeEquivalentTo(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral()); } [Fact] diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs index faa0ebf78..5f8c9e9bb 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs @@ -463,7 +463,7 @@ public async Task ParseDocumentWithPatternPropertiesInSchemaWorks() // Assert Assert.Equivalent(expectedSchema, actualSchema); - actualMediaType.MakeLineBreaksEnvironmentNeutral().Should().BeEquivalentTo(expectedMediaType.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expectedMediaType.MakeLineBreaksEnvironmentNeutral(), actualMediaType.MakeLineBreaksEnvironmentNeutral()); } [Fact] diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs index 840d552c7..abcaa9df6 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs @@ -148,10 +148,10 @@ public void TestSchemaCopyConstructorWithTypeArrayWorks() }; // Assert - schemaWithArrayCopy.Type.Should().NotBe(schemaWithTypeArray.Type); + Assert.NotEqual(schemaWithTypeArray.Type, schemaWithArrayCopy.Type); schemaWithTypeArray.Type = JsonSchemaType.String | JsonSchemaType.Null; - simpleSchemaCopy.Type.Should().NotBe(simpleSchema.Type); + Assert.NotEqual(simpleSchema.Type, simpleSchemaCopy.Type); simpleSchema.Type = JsonSchemaType.String; } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs index daf44a6ed..870c2c361 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs @@ -1325,7 +1325,7 @@ public async Task ParseDocWithRefsUsingProxyReferencesSucceeds() .Excluding(x => x.Schema.Default.Parent) .Excluding(x => x.Schema.Default.Options) .IgnoringCyclicReferences()); - outputDoc.Should().BeEquivalentTo(expectedSerializedDoc.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expectedSerializedDoc.MakeLineBreaksEnvironmentNeutral(), outputDoc); } [Fact] diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiResponseTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiResponseTests.cs index 3a9ef0bd8..2d41ed2e2 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiResponseTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiResponseTests.cs @@ -30,7 +30,7 @@ public async Task ResponseWithReferencedHeaderShouldReferenceComponent() var expected = response.Headers.First().Value; var actual = result.Document.Components.Headers.First().Value; - actual.Description.Should().BeEquivalentTo(expected.Description); + Assert.Equal(expected.Description, actual.Description); } } } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs index 145d7f535..5edd1c0d0 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs @@ -458,7 +458,7 @@ public async Task SerializeAsV2ShouldSetFormatPropertyInParentSchemaIfPresentInC """.MakeLineBreaksEnvironmentNeutral(); // Assert - expectedV2Schema.Should().BeEquivalentTo(v2Schema); + Assert.Equal(v2Schema, expectedV2Schema); } [Fact] From 18ec0d0514def714d1fef2e5bbe9d3589f481208 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 16 Jan 2025 07:41:24 -0500 Subject: [PATCH 14/16] chore: naming convention Signed-off-by: Vincent Biret --- .../Expressions/RuntimeExpressionTests.cs | 2 +- .../Expressions/SourceExpressionTests.cs | 2 +- .../Validations/OpenApiComponentsValidationTests.cs | 2 +- .../Validations/OpenApiContactValidationTests.cs | 2 +- .../Validations/OpenApiExternalDocsValidationTests.cs | 2 +- .../Validations/OpenApiInfoValidationTests.cs | 4 ++-- .../Validations/OpenApiLicenseValidationTests.cs | 2 +- .../Validations/OpenApiOAuthFlowValidationTests.cs | 4 ++-- .../Validations/OpenApiResponseValidationTests.cs | 2 +- .../Validations/OpenApiServerValidationTests.cs | 2 +- .../Validations/OpenApiTagValidationTests.cs | 4 ++-- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs b/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs index 285366c0a..a1b6c8200 100644 --- a/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs +++ b/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs @@ -39,7 +39,7 @@ public void BuildRuntimeExpressionThrowsInvalidFormat(string expression) // Assert var exception = Assert.Throws(test); - Assert.Equal(String.Format(SRResource.RuntimeExpressionHasInvalidFormat, expression), exception.Message); + Assert.Equal(string.Format(SRResource.RuntimeExpressionHasInvalidFormat, expression), exception.Message); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Expressions/SourceExpressionTests.cs b/test/Microsoft.OpenApi.Tests/Expressions/SourceExpressionTests.cs index 5ed80bf6e..8e9523946 100644 --- a/test/Microsoft.OpenApi.Tests/Expressions/SourceExpressionTests.cs +++ b/test/Microsoft.OpenApi.Tests/Expressions/SourceExpressionTests.cs @@ -25,7 +25,7 @@ public void BuildSourceExpressionThrowsInvalidFormat(string expression) // Assert var exception = Assert.Throws(test); - Assert.Equal(String.Format(SRResource.SourceExpressionHasInvalidFormat, expression), exception.Message); + Assert.Equal(string.Format(SRResource.SourceExpressionHasInvalidFormat, expression), exception.Message); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiComponentsValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiComponentsValidationTests.cs index f6ce92ead..1bae78aba 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiComponentsValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiComponentsValidationTests.cs @@ -37,7 +37,7 @@ public void ValidateKeyMustMatchRegularExpressionInComponents() Assert.False(result); Assert.NotNull(errors); var error = Assert.Single(errors); - Assert.Equal(String.Format(SRResource.Validation_ComponentsKeyMustMatchRegularExpr, key, "responses", OpenApiComponentsRules.KeyRegex.ToString()), + Assert.Equal(string.Format(SRResource.Validation_ComponentsKeyMustMatchRegularExpr, key, "responses", OpenApiComponentsRules.KeyRegex.ToString()), error.Message); } } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiContactValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiContactValidationTests.cs index 3ad7130ad..73836ed9a 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiContactValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiContactValidationTests.cs @@ -31,7 +31,7 @@ public void ValidateEmailFieldIsEmailAddressInContact() Assert.False(result); Assert.NotNull(errors); var error = Assert.Single(errors); - Assert.Equal(String.Format(SRResource.Validation_StringMustBeEmailAddress, testEmail), error.Message); + Assert.Equal(string.Format(SRResource.Validation_StringMustBeEmailAddress, testEmail), error.Message); } } } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiExternalDocsValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiExternalDocsValidationTests.cs index aebb11c0a..dbc27cfb9 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiExternalDocsValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiExternalDocsValidationTests.cs @@ -28,7 +28,7 @@ public void ValidateUrlIsRequiredInExternalDocs() Assert.True(result); Assert.NotNull(errors); var error = Assert.Single(errors); - Assert.Equal(String.Format(SRResource.Validation_FieldIsRequired, "url", "External Documentation"), error.Message); + Assert.Equal(string.Format(SRResource.Validation_FieldIsRequired, "url", "External Documentation"), error.Message); } } } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiInfoValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiInfoValidationTests.cs index 95dde7942..3e88923d6 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiInfoValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiInfoValidationTests.cs @@ -16,8 +16,8 @@ public class OpenApiInfoValidationTests public void ValidateFieldIsRequiredInInfo() { // Arrange - var titleError = String.Format(SRResource.Validation_FieldIsRequired, "title", "info"); - var versionError = String.Format(SRResource.Validation_FieldIsRequired, "version", "info"); + var titleError = string.Format(SRResource.Validation_FieldIsRequired, "title", "info"); + var versionError = string.Format(SRResource.Validation_FieldIsRequired, "version", "info"); var info = new OpenApiInfo(); // Act diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiLicenseValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiLicenseValidationTests.cs index 0f30b0580..def52b32f 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiLicenseValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiLicenseValidationTests.cs @@ -32,7 +32,7 @@ public void ValidateFieldIsRequiredInLicense() Assert.False(result); Assert.NotNull(errors); var error = Assert.Single(errors); - Assert.Equal(String.Format(SRResource.Validation_FieldIsRequired, "name", "license"), error.Message); + Assert.Equal(string.Format(SRResource.Validation_FieldIsRequired, "name", "license"), error.Message); } } } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiOAuthFlowValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiOAuthFlowValidationTests.cs index a49b3f9bb..ad8e5f387 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiOAuthFlowValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiOAuthFlowValidationTests.cs @@ -17,8 +17,8 @@ public class OpenApiOAuthFlowValidationTests public void ValidateFixedFieldsIsRequiredInResponse() { // Arrange - var authorizationUrlError = String.Format(SRResource.Validation_FieldIsRequired, "authorizationUrl", "OAuth Flow"); - var tokenUrlError = String.Format(SRResource.Validation_FieldIsRequired, "tokenUrl", "OAuth Flow"); + var authorizationUrlError = string.Format(SRResource.Validation_FieldIsRequired, "authorizationUrl", "OAuth Flow"); + var tokenUrlError = string.Format(SRResource.Validation_FieldIsRequired, "tokenUrl", "OAuth Flow"); IEnumerable errors; var oAuthFlow = new OpenApiOAuthFlow(); diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiResponseValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiResponseValidationTests.cs index b967ebab6..ca73e6b0c 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiResponseValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiResponseValidationTests.cs @@ -32,7 +32,7 @@ public void ValidateDescriptionIsRequiredInResponse() Assert.False(result); Assert.NotNull(errors); var error = Assert.Single(errors) as OpenApiValidatorError; - Assert.Equal(String.Format(SRResource.Validation_FieldIsRequired, "description", "response"), error.Message); + Assert.Equal(string.Format(SRResource.Validation_FieldIsRequired, "description", "response"), error.Message); Assert.Equal("#/description", error.Pointer); } } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiServerValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiServerValidationTests.cs index aa6d6ecd0..14fe5be0b 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiServerValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiServerValidationTests.cs @@ -29,7 +29,7 @@ public void ValidateFieldIsRequiredInServer() Assert.False(result); Assert.NotNull(errors); var error = Assert.Single(errors); - Assert.Equal(String.Format(SRResource.Validation_FieldIsRequired, "url", "server"), error.Message); + Assert.Equal(string.Format(SRResource.Validation_FieldIsRequired, "url", "server"), error.Message); } } } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs index 2bdec4ba2..545e4d2e0 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs @@ -31,7 +31,7 @@ public void ValidateNameIsRequiredInTag() Assert.False(result); Assert.NotNull(errors); var error = Assert.Single(errors); - Assert.Equal(String.Format(SRResource.Validation_FieldIsRequired, "name", "tag"), error.Message); + Assert.Equal(string.Format(SRResource.Validation_FieldIsRequired, "name", "tag"), error.Message); } [Fact] @@ -55,7 +55,7 @@ public void ValidateExtensionNameStartsWithXDashInTag() Assert.False(result); Assert.NotNull(errors); var error = Assert.Single(errors); - Assert.Equal(String.Format(SRResource.Validation_ExtensionNameMustBeginWithXDash, "tagExt", "#/extensions"), error.Message); + Assert.Equal(string.Format(SRResource.Validation_ExtensionNameMustBeginWithXDash, "tagExt", "#/extensions"), error.Message); } } } From a8153e9117a3516436c795320ee29ccaafb160a8 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 16 Jan 2025 07:43:54 -0500 Subject: [PATCH 15/16] chore: additional FA removal batch Signed-off-by: Vincent Biret --- .../Expressions/RuntimeExpressionTests.cs | 9 ++++----- .../Services/OpenApiValidatorTests.cs | 17 ++++++++--------- .../OpenApiComponentsValidationTests.cs | 1 - .../OpenApiContactValidationTests.cs | 1 - .../OpenApiExternalDocsValidationTests.cs | 1 - .../Validations/OpenApiInfoValidationTests.cs | 1 - .../OpenApiLicenseValidationTests.cs | 1 - .../OpenApiResponseValidationTests.cs | 1 - .../Validations/OpenApiServerValidationTests.cs | 1 - .../Validations/OpenApiTagValidationTests.cs | 1 - 10 files changed, 12 insertions(+), 22 deletions(-) diff --git a/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs b/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs index a1b6c8200..4b79c786a 100644 --- a/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs +++ b/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using FluentAssertions; using Microsoft.OpenApi.Exceptions; using Microsoft.OpenApi.Expressions; using Microsoft.OpenApi.Properties; @@ -184,11 +183,11 @@ public void CompositeRuntimeExpressionContainsMultipleExpressions() var compositeExpression = runtimeExpression as CompositeExpression; Assert.Equal(2, compositeExpression.ContainedExpressions.Count); - compositeExpression.ContainedExpressions.Should().BeEquivalentTo(new List + Assert.Equivalent(new List { new UrlExpression(), new RequestExpression(new HeaderExpression("foo")) - }); + }, compositeExpression.ContainedExpressions); } [Fact] @@ -228,11 +227,11 @@ public void CompositeRuntimeExpressionWithMultipleRuntimeExpressionsAndFakeBrace Assert.Equal(expression, response.Expression); var compositeExpression = runtimeExpression as CompositeExpression; - compositeExpression.ContainedExpressions.Should().BeEquivalentTo(new List + Assert.Equivalent(new List { new UrlExpression(), new RequestExpression(new HeaderExpression("foo")) - }); + }, compositeExpression.ContainedExpressions); } [Theory] diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiValidatorTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiValidatorTests.cs index e5fcc346f..ca56ff75c 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiValidatorTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiValidatorTests.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Nodes; -using FluentAssertions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; @@ -54,12 +53,12 @@ public void ResponseMustHaveADescription() var walker = new OpenApiWalker(validator); walker.Walk(openApiDocument); - validator.Errors.Should().BeEquivalentTo( + Assert.Equivalent( new List { new OpenApiValidatorError(nameof(OpenApiResponseRules.ResponseRequiredFields),"#/paths/~1test/get/responses/200/description", - String.Format(SRResource.Validation_FieldIsRequired, "description", "response")) - }); + string.Format(SRResource.Validation_FieldIsRequired, "description", "response")) + }, validator.Errors); } [Fact] @@ -88,12 +87,12 @@ public void ServersShouldBeReferencedByIndex() var walker = new OpenApiWalker(validator); walker.Walk(openApiDocument); - validator.Errors.Should().BeEquivalentTo( + Assert.Equivalent( new List { new OpenApiValidatorError(nameof(OpenApiServerRules.ServerRequiredFields), "#/servers/1/url", - String.Format(SRResource.Validation_FieldIsRequired, "url", "server")) - }); + string.Format(SRResource.Validation_FieldIsRequired, "url", "server")) + }, validator.Errors); } [Fact] @@ -135,11 +134,11 @@ public void ValidateCustomExtension() var walker = new OpenApiWalker(validator); walker.Walk(openApiDocument); - validator.Errors.Should().BeEquivalentTo( + Assert.Equivalent( new List { new OpenApiValidatorError("FooExtensionRule", "#/info/x-foo", "Don't say hey") - }); + }, validator.Errors); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiComponentsValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiComponentsValidationTests.cs index 1bae78aba..fe2a230e2 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiComponentsValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiComponentsValidationTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.Collections.Generic; using System.Linq; using Microsoft.OpenApi.Extensions; diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiContactValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiContactValidationTests.cs index 73836ed9a..213e2138f 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiContactValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiContactValidationTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiExternalDocsValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiExternalDocsValidationTests.cs index dbc27cfb9..3098d631a 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiExternalDocsValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiExternalDocsValidationTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiInfoValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiInfoValidationTests.cs index 3e88923d6..12c818a21 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiInfoValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiInfoValidationTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiLicenseValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiLicenseValidationTests.cs index def52b32f..94b9d82d0 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiLicenseValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiLicenseValidationTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.Collections.Generic; using System.Linq; using Microsoft.OpenApi.Models; diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiResponseValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiResponseValidationTests.cs index ca73e6b0c..c1b4ce62d 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiResponseValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiResponseValidationTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.Collections.Generic; using System.Linq; using Microsoft.OpenApi.Models; diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiServerValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiServerValidationTests.cs index 14fe5be0b..88be49e73 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiServerValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiServerValidationTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.Collections.Generic; using System.Linq; using Microsoft.OpenApi.Models; diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs index 545e4d2e0..d956e2cd0 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.Collections.Generic; using System.Linq; using Microsoft.OpenApi.Any; From faca076cbcbf8119ad426f3827f32aacb1f9e0c1 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 16 Jan 2025 07:48:41 -0500 Subject: [PATCH 16/16] chore: linting Signed-off-by: Vincent Biret --- .../V3Tests/OpenApiDocumentTests.cs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs index 870c2c361..7a9649bbc 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs @@ -113,7 +113,7 @@ public void ParseInlineStringWithoutProvidingFormatSucceeds() [Fact] public async Task ParseBasicDocumentWithMultipleServersShouldSucceed() { - var path = System.IO.Path.Combine(SampleFolderPath, "basicDocumentWithMultipleServers.yaml"); + var path = Path.Combine(SampleFolderPath, "basicDocumentWithMultipleServers.yaml"); var result = await OpenApiDocument.LoadAsync(path); Assert.Empty(result.Diagnostic.Errors); @@ -144,13 +144,13 @@ public async Task ParseBasicDocumentWithMultipleServersShouldSucceed() [Fact] public async Task ParseBrokenMinimalDocumentShouldYieldExpectedDiagnostic() { - using var stream = Resources.GetStream(System.IO.Path.Combine(SampleFolderPath, "brokenMinimalDocument.yaml")); + using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "brokenMinimalDocument.yaml")); // Copy stream to MemoryStream using var memoryStream = new MemoryStream(); await stream.CopyToAsync(memoryStream); memoryStream.Position = 0; - var result = OpenApiDocument.Load(memoryStream); + var result = await OpenApiDocument.LoadAsync(memoryStream); result.Document.Should().BeEquivalentTo( new OpenApiDocument @@ -176,7 +176,7 @@ public async Task ParseBrokenMinimalDocumentShouldYieldExpectedDiagnostic() [Fact] public async Task ParseMinimalDocumentShouldSucceed() { - var result = await OpenApiDocument.LoadAsync(System.IO.Path.Combine(SampleFolderPath, "minimalDocument.yaml")); + var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "minimalDocument.yaml")); result.Document.Should().BeEquivalentTo( new OpenApiDocument @@ -199,7 +199,7 @@ public async Task ParseMinimalDocumentShouldSucceed() [Fact] public async Task ParseStandardPetStoreDocumentShouldSucceed() { - using var stream = Resources.GetStream(System.IO.Path.Combine(SampleFolderPath, "petStore.yaml")); + using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "petStore.yaml")); var actual = await OpenApiDocument.LoadAsync(stream, OpenApiConstants.Yaml); var components = new OpenApiComponents @@ -585,7 +585,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() [Fact] public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() { - using var stream = Resources.GetStream(System.IO.Path.Combine(SampleFolderPath, "petStoreWithTagAndSecurity.yaml")); + using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "petStoreWithTagAndSecurity.yaml")); var actual = await OpenApiDocument.LoadAsync(stream, OpenApiConstants.Yaml); var components = new OpenApiComponents @@ -1089,7 +1089,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() [Fact] public async Task ParsePetStoreExpandedShouldSucceed() { - var actual = await OpenApiDocument.LoadAsync(System.IO.Path.Combine(SampleFolderPath, "petStoreExpanded.yaml")); + var actual = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "petStoreExpanded.yaml")); // TODO: Create the object in memory and compare with the one read from YAML file. @@ -1100,7 +1100,7 @@ public async Task ParsePetStoreExpandedShouldSucceed() [Fact] public async Task GlobalSecurityRequirementShouldReferenceSecurityScheme() { - var result = await OpenApiDocument.LoadAsync(System.IO.Path.Combine(SampleFolderPath, "securedApi.yaml")); + var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "securedApi.yaml")); var securityRequirement = result.Document.SecurityRequirements[0]; @@ -1111,7 +1111,7 @@ public async Task GlobalSecurityRequirementShouldReferenceSecurityScheme() [Fact] public async Task HeaderParameterShouldAllowExample() { - var result = await OpenApiDocument.LoadAsync(System.IO.Path.Combine(SampleFolderPath, "apiWithFullHeaderComponent.yaml")); + var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "apiWithFullHeaderComponent.yaml")); var exampleHeader = result.Document.Components?.Headers?["example-header"]; Assert.NotNull(exampleHeader); @@ -1179,7 +1179,7 @@ public async Task ParseDocumentWithReferencedSecuritySchemeWorks() ReferenceResolution = ReferenceResolutionSetting.ResolveLocalReferences }; - var result = await OpenApiDocument.LoadAsync(System.IO.Path.Combine(SampleFolderPath, "docWithSecuritySchemeReference.yaml"), settings); + var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "docWithSecuritySchemeReference.yaml"), settings); var securityScheme = result.Document.Components.SecuritySchemes["OAuth2"]; // Assert @@ -1191,7 +1191,7 @@ public async Task ParseDocumentWithReferencedSecuritySchemeWorks() public async Task ParseDocumentWithJsonSchemaReferencesWorks() { // Arrange - using var stream = Resources.GetStream(System.IO.Path.Combine(SampleFolderPath, "docWithJsonSchema.yaml")); + using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "docWithJsonSchema.yaml")); // Act var settings = new OpenApiReaderSettings @@ -1311,7 +1311,7 @@ public async Task ParseDocWithRefsUsingProxyReferencesSucceeds() format: int32 default: 10"; - using var stream = Resources.GetStream(System.IO.Path.Combine(SampleFolderPath, "minifiedPetStore.yaml")); + using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "minifiedPetStore.yaml")); // Act var doc = (await OpenApiDocument.LoadAsync(stream)).Document; @@ -1400,7 +1400,7 @@ public void ParseBasicDocumentWithServerVariableAndNoDefaultShouldFail() [Fact] public async Task ParseDocumentWithEmptyPathsSucceeds() { - var result = await OpenApiDocument.LoadAsync(System.IO.Path.Combine(SampleFolderPath, "docWithEmptyPaths.yaml")); + var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "docWithEmptyPaths.yaml")); Assert.Empty(result.Diagnostic.Errors); } }