diff --git a/src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs b/src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs index 488f497c9..2f1ce2b37 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 82a064478..3b9c85d2f 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.Models; 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/PropertyNode.cs b/src/Microsoft.OpenApi/Reader/ParseNodes/PropertyNode.cs index b285df130..9517e5363 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 184760c17..485686e89 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 ca4a353a5..bdf4a8716 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 f349250b6..842b75bf0 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 f6f6b6a6c..06d1d284a 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 377ffaa34..7830c394e 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 f0b62c361..049ecc8cc 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 81d5ea2d6..a71f633e5 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 f0c4051c3..9673c5f87 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 f982a18ce..79bb16638 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 4aaee1187..c159443ad 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 2f7a3e5c6..c0d4c5951 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 2ce56486e..0d1e08479 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 f7038e595..820c58985 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 86b5da46c..32c2b73fc 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 8ec6387fc..a849985fb 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 8c4145ca1..7a2c3d90e 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 22a0030b0..7c5fb189e 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 faa61eed2..e26ec20f9 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 4edb5e14d..8e4057a91 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 36db155c1..87ecc8f00 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 1bf948d3c..b56352c22 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 2a2fdbfe9..7c3441eed 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 09a65cc83..e6364affa 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/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/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/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/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/OpenApiContactTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiContactTests.cs index 8bbc7ffdb..e16ff425f 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, new(), 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/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs index b3fead6b1..02938f4b0 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; @@ -281,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/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs index 854568e53..7c76c424c 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; @@ -58,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", @@ -231,7 +132,7 @@ public void ParseBasicOperationShouldSucceed() var operation = OpenApiV2Deserializer.LoadOperation(node, new()); // Assert - operation.Should().BeEquivalentTo(_basicOperation); + Assert.Equivalent(_basicOperation, operation); } [Fact] @@ -249,7 +150,7 @@ public async Task ParseBasicOperationTwiceShouldYieldSameObject() var operation = OpenApiV2Deserializer.LoadOperation(node, new()); // Assert - operation.Should().BeEquivalentTo(_basicOperation); + Assert.Equivalent(_basicOperation, operation); } [Fact] @@ -386,7 +287,7 @@ public void ParseOperationWithEmptyProducesArraySetsResponseSchemaIfExists() // Assert var actual = stringBuilder.ToString(); - actual.MakeLineBreaksEnvironmentNeutral().Should().BeEquivalentTo(expected.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -451,7 +352,7 @@ public async Task ParseV2ResponseWithExamplesExtensionWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -501,7 +402,7 @@ public async Task LoadV3ExamplesInResponseAsExtensionsWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -552,7 +453,7 @@ public async Task LoadV2OperationWithBodyParameterExamplesWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -604,7 +505,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/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs index e631dc31d..1b6300faf 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] @@ -50,7 +50,7 @@ public void ParsePathParameterShouldSucceed() var parameter = OpenApiV2Deserializer.LoadParameter(node, new()); // 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, new()); // 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, new()); // 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, new()); // 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, new()); // 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, new()); // 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/V2Tests/OpenApiPathItemTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs index 6c4af9e2a..d33b9964f 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, new()); // 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 95a4cf68c..562753a19 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, new()); // 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, new()); // 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, new()); // 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, new()); // 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, new()); // 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, new()); // 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 e0c076ee3..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; @@ -304,8 +303,8 @@ public void InvalidHostShouldYieldError() }; var result = OpenApiDocument.Parse(input, "yaml", settings); - result.Document.Servers.Count.Should().Be(0); - result.Diagnostic.Should().BeEquivalentTo( + Assert.Empty(result.Document.Servers); + 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 a83da5e39..5f8c9e9bb 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs @@ -9,10 +9,9 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Tests; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using Xunit; -using System.Linq; using VerifyXunit; +using VerifyTests; namespace Microsoft.OpenApi.Readers.Tests.V31Tests { @@ -200,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)); } @@ -391,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] @@ -463,8 +462,8 @@ public async Task ParseDocumentWithPatternPropertiesInSchemaWorks() var actualMediaType = await mediaType.SerializeAsYamlAsync(OpenApiSpecVersion.OpenApi3_1); // Assert - actualSchema.Should().BeEquivalentTo(expectedSchema); - actualMediaType.MakeLineBreaksEnvironmentNeutral().Should().BeEquivalentTo(expectedMediaType.MakeLineBreaksEnvironmentNeutral()); + Assert.Equivalent(expectedSchema, actualSchema); + Assert.Equal(expectedMediaType.MakeLineBreaksEnvironmentNeutral(), actualMediaType.MakeLineBreaksEnvironmentNeutral()); } [Fact] @@ -501,7 +500,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] @@ -524,7 +523,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.Readers.Tests/V31Tests/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs index 36982637c..409dd4c79 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, new()); // 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 14fcd7eae..05bc9281b 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, new()); // 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 e01c8645d..abcaa9df6 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text.Json.Nodes; using System.Threading.Tasks; using FluentAssertions; @@ -89,7 +89,7 @@ public async Task ParseBasicV31SchemaShouldSucceed() Path.Combine(SampleFolderPath, "jsonSchema.json"), OpenApiSpecVersion.OpenApi3_1, new()); // 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, new(), out _); // Assert - actual.Should().BeEquivalentTo(expected); + Assert.Equivalent(expected, actual); } [Fact] @@ -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; } @@ -176,7 +176,7 @@ public async Task ParseV31SchemaShouldSucceed() }; // Assert - schema.Should().BeEquivalentTo(expectedSchema); + Assert.Equivalent(expectedSchema, schema); } [Fact] @@ -278,7 +278,7 @@ public void ParseSchemaWithExamplesShouldSucceed() var schema = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_1, new(), out _, "yaml"); // Assert - schema.Examples.Should().HaveCount(2); + Assert.Equal(2, schema.Examples.Count); } [Fact] @@ -299,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] @@ -320,7 +320,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] @@ -339,7 +339,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] @@ -359,7 +359,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] @@ -380,7 +380,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] @@ -399,7 +399,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] @@ -414,7 +414,7 @@ public async Task LoadSchemaWithNullableExtensionAsV31Works(string filePath) var schema = await OpenApiModelFactory.LoadAsync(path, OpenApiSpecVersion.OpenApi3_1, new()); // Assert - schema.Type.Should().Be(JsonSchemaType.String | JsonSchemaType.Null); + Assert.Equal(JsonSchemaType.String | JsonSchemaType.Null, schema.Type); } [Fact] @@ -459,8 +459,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] @@ -496,14 +496,14 @@ public async Task ParseSchemaWithConstWorks() // Act var schema = await OpenApiModelFactory.LoadAsync(path, OpenApiSpecVersion.OpenApi3_1, new()); - 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] @@ -518,7 +518,7 @@ public void ParseSchemaWithUnrecognizedKeywordsWorks() } "; var schema = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_1, new(), out _, "json"); - schema.UnrecognizedKeywords.Should().HaveCount(2); + Assert.Equal(2, schema.UnrecognizedKeywords.Count); } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiCallbackTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiCallbackTests.cs index d7ed66049..7a1b43f2f 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, new()); // 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 d230d33d2..a2e5fd61d 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, new(), 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 78196ee87..6ab83bf3c 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, new(), 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 a04b3c486..7a9649bbc 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 @@ -89,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] @@ -108,16 +107,16 @@ 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] 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); - result.Diagnostic.Errors.Should().BeEmpty(); + Assert.Empty(result.Diagnostic.Errors); result.Document.Should().BeEquivalentTo( new OpenApiDocument { @@ -145,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 @@ -163,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 = @@ -171,13 +170,13 @@ 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] 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 @@ -190,17 +189,17 @@ 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] 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 @@ -579,14 +578,14 @@ 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] 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 @@ -1083,25 +1082,25 @@ 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] 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. - actual.Diagnostic.Should().BeEquivalentTo( - new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }); + Assert.Equivalent( + new OpenApiDiagnostic() { SpecificationVersion = OpenApiSpecVersion.OpenApi3_0 }, actual.Diagnostic); } [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]; @@ -1112,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); @@ -1180,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 @@ -1192,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 @@ -1205,14 +1204,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 @@ -1312,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; @@ -1326,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] @@ -1369,11 +1368,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)); } @@ -1395,14 +1394,14 @@ public void ParseBasicDocumentWithServerVariableAndNoDefaultShouldFail() paths: {} """, "yaml"); - result.Diagnostic.Errors.Should().NotBeEmpty(); + Assert.NotEmpty(result.Diagnostic.Errors); } [Fact] public async Task ParseDocumentWithEmptyPathsSucceeds() { - var result = await OpenApiDocument.LoadAsync(System.IO.Path.Combine(SampleFolderPath, "docWithEmptyPaths.yaml")); - result.Diagnostic.Errors.Should().BeEmpty(); + var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "docWithEmptyPaths.yaml")); + Assert.Empty(result.Diagnostic.Errors); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiEncodingTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiEncodingTests.cs index 8a9f2fe4f..874cf6b04 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, new()); // 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, new()); // 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/OpenApiExampleTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs index 5bb83a9fc..2a8691ab3 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; @@ -78,7 +77,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.Readers.Tests/V3Tests/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs index db59dad32..9a11ef5c3 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, new()); // 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, new()); // 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/OpenApiMediaTypeTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiMediaTypeTests.cs index a2abb0e6f..e3c1435fd 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.Readers.Tests/V3Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs index a2c127728..8a30fc9ba 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 @@ -35,7 +32,7 @@ public async Task ParsePathParameterShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(stream, OpenApiSpecVersion.OpenApi3_0, new()); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Path, @@ -46,7 +43,7 @@ public async Task ParsePathParameterShouldSucceed() { Type = JsonSchemaType.String } - }); + }, parameter); } [Fact] @@ -56,7 +53,7 @@ public async Task ParseQueryParameterShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "queryParameter.yaml"), OpenApiSpecVersion.OpenApi3_0, new()); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Query, @@ -73,7 +70,7 @@ public async Task ParseQueryParameterShouldSucceed() }, Style = ParameterStyle.Form, Explode = true - }); + }, parameter); } [Fact] @@ -83,7 +80,7 @@ public async Task ParseQueryParameterWithObjectTypeShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "queryParameterWithObjectType.yaml"), OpenApiSpecVersion.OpenApi3_0, new()); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Query, @@ -97,7 +94,7 @@ public async Task ParseQueryParameterWithObjectTypeShouldSucceed() } }, Style = ParameterStyle.Form - }); + }, parameter); } [Fact] @@ -110,7 +107,7 @@ public async Task ParseQueryParameterWithObjectTypeAndContentShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(stream, OpenApiSpecVersion.OpenApi3_0, new()); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Query, @@ -141,7 +138,7 @@ public async Task ParseQueryParameterWithObjectTypeAndContentShouldSucceed() } } } - }); + }, parameter); } [Fact] @@ -151,7 +148,7 @@ public async Task ParseHeaderParameterShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "headerParameter.yaml"), OpenApiSpecVersion.OpenApi3_0, new()); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = ParameterLocation.Header, @@ -169,7 +166,7 @@ public async Task ParseHeaderParameterShouldSucceed() Format = "int64", } } - }); + }, parameter); } [Fact] @@ -179,7 +176,7 @@ public async Task ParseParameterWithNullLocationShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(Path.Combine(SampleFolderPath, "parameterWithNullLocation.yaml"), OpenApiSpecVersion.OpenApi3_0, new()); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = null, @@ -190,7 +187,7 @@ public async Task ParseParameterWithNullLocationShouldSucceed() { Type = JsonSchemaType.String } - }); + }, parameter); } [Fact] @@ -203,7 +200,7 @@ public async Task ParseParameterWithNoLocationShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(stream, OpenApiSpecVersion.OpenApi3_0, new()); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = null, @@ -214,7 +211,7 @@ public async Task ParseParameterWithNoLocationShouldSucceed() { Type = JsonSchemaType.String } - }); + }, parameter); } [Fact] @@ -227,7 +224,7 @@ public async Task ParseParameterWithUnknownLocationShouldSucceed() var parameter = await OpenApiModelFactory.LoadAsync(stream, OpenApiSpecVersion.OpenApi3_0, new()); // Assert - parameter.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiParameter { In = null, @@ -238,7 +235,7 @@ public async Task ParseParameterWithUnknownLocationShouldSucceed() { Type = JsonSchemaType.String } - }); + }, parameter); } [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.Readers.Tests/V3Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs index 6311f9a8a..8d94822ef 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; @@ -48,14 +47,14 @@ public void ParsePrimitiveSchemaShouldSucceed() var schema = OpenApiV3Deserializer.LoadSchema(node, new()); // 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] @@ -71,7 +70,7 @@ public void ParseExampleStringFragmentShouldSucceed() var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, new(), out var diagnostic); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); openApiAny.Should().BeEquivalentTo(new OpenApiAny( new JsonObject @@ -94,7 +93,7 @@ public void ParseEnumFragmentShouldSucceed() var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, new(), out var diagnostic); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); openApiAny.Should().BeEquivalentTo(new OpenApiAny( new JsonArray @@ -119,9 +118,9 @@ public void ParsePathFragmentShouldSucceed() var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, new(), 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", @@ -138,7 +137,7 @@ public void ParsePathFragmentShouldSucceed() } } } - }); + }, openApiAny); } [Fact] @@ -160,9 +159,9 @@ public void ParseDictionarySchemaShouldSucceed() var schema = OpenApiV3Deserializer.LoadSchema(node, new()); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); - schema.Should().BeEquivalentTo( + Assert.Equivalent( new OpenApiSchema { Type = JsonSchemaType.Object, @@ -170,7 +169,7 @@ public void ParseDictionarySchemaShouldSucceed() { Type = JsonSchemaType.String } - }); + }, schema); } } @@ -192,7 +191,7 @@ public void ParseBasicSchemaWithExampleShouldSucceed() var schema = OpenApiV3Deserializer.LoadSchema(node, new()); // Assert - diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); + Assert.Equivalent(new OpenApiDiagnostic(), diagnostic); schema.Should().BeEquivalentTo( new OpenApiSchema @@ -236,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 { @@ -290,7 +289,7 @@ public async Task ParseBasicSchemaWithReferenceShouldSucceed() } }; - components.Should().BeEquivalentTo(expectedComponents); + Assert.Equivalent(expectedComponents, components); } [Fact] @@ -387,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.Readers.Tests/V3Tests/OpenApiSecuritySchemeTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSecuritySchemeTests.cs index 5ff92fb0a..b0f02270c 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, new()); // 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, new()); // 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, new()); // 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, new()); // 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, new()); // 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 c9864642d..6485aad21 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, new()); // 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/Expressions/RuntimeExpressionTests.cs b/test/Microsoft.OpenApi.Tests/Expressions/RuntimeExpressionTests.cs index 70c7dc90d..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; @@ -39,7 +38,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] @@ -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] @@ -222,17 +221,17 @@ public void CompositeRuntimeExpressionWithMultipleRuntimeExpressionsAndFakeBrace var runtimeExpression = RuntimeExpression.Build(expression); // Assert - runtimeExpression.Should().NotBeNull(); - runtimeExpression.Should().BeOfType(typeof(CompositeExpression)); + Assert.NotNull(runtimeExpression); + 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 + Assert.Equivalent(new List { new UrlExpression(), new RequestExpression(new HeaderExpression("foo")) - }); + }, compositeExpression.ContainedExpressions); } [Theory] @@ -244,7 +243,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] @@ -262,15 +262,15 @@ public void CompositeRuntimeExpressionWithoutRecognizedRuntimeExpressions(string var runtimeExpression = RuntimeExpression.Build(expression); // Assert - runtimeExpression.Should().NotBeNull(); - runtimeExpression.Should().BeOfType(typeof(CompositeExpression)); + Assert.NotNull(runtimeExpression); + Assert.IsType(runtimeExpression); var response = (CompositeExpression)runtimeExpression; - response.Expression.Should().Be(expression); + Assert.Equal(expression, response.Expression); 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/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/Extensions/OpenApiServerExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiServerExtensionsTests.cs index b8f581541..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; @@ -24,7 +23,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 +41,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] diff --git a/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs index deec23c4e..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] @@ -77,7 +76,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/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 3a69b708e..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; @@ -286,7 +284,7 @@ public async Task SerializeBasicComponentsAsJsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -301,7 +299,7 @@ public async Task SerializeBasicComponentsAsYamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -353,7 +351,7 @@ public async Task SerializeAdvancedComponentsAsJsonV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -411,7 +409,7 @@ public async Task SerializeAdvancedComponentsWithReferenceAsJsonV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -450,7 +448,7 @@ public async Task SerializeAdvancedComponentsAsYamlV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -492,7 +490,7 @@ public async Task SerializeAdvancedComponentsWithReferenceAsYamlV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -529,7 +527,7 @@ public async Task SerializeBrokenComponentsAsJsonV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -559,7 +557,7 @@ public async Task SerializeBrokenComponentsAsYamlV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -585,7 +583,7 @@ public async Task SerializeTopLevelReferencingComponentsAsYamlV3Works() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -610,7 +608,7 @@ public async Task SerializeTopLevelSelfReferencingWithOtherPropertiesComponentsA // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -665,7 +663,7 @@ public async Task SerializeComponentsWithPathItemsAsJsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -702,7 +700,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/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/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs index 5d9c9175b..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; @@ -18,7 +17,6 @@ using Microsoft.VisualBasic; using VerifyXunit; using Xunit; -using Xunit.Abstractions; namespace Microsoft.OpenApi.Tests.Models { @@ -1485,8 +1483,7 @@ public async Task SerializeSimpleDocumentWithTopLevelReferencingComponentsAsYaml // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1505,8 +1502,7 @@ public async Task SerializeSimpleDocumentWithTopLevelSelfReferencingComponentsAs // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1534,8 +1530,7 @@ public async Task SerializeSimpleDocumentWithTopLevelSelfReferencingWithOtherPro // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1616,8 +1611,7 @@ public async Task SerializeRelativePathAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1647,8 +1641,7 @@ public async Task SerializeRelativePathWithHostAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1677,8 +1670,7 @@ public async Task SerializeRelativeRootPathWithHostAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1763,8 +1755,7 @@ public async Task SerializeV2DocumentWithNonArraySchemaTypeDoesNotWriteOutCollec // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1852,8 +1843,7 @@ public async Task SerializeV2DocumentWithStyleAsNullDoesNotWriteOutStyleValue() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); - expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1907,7 +1897,7 @@ public void SerializeExamplesDoesNotThrowNullReferenceException() }; OpenApiJsonWriter apiWriter = new OpenApiJsonWriter(new StringWriter()); - doc.Invoking(d => d.SerializeAsV3(apiWriter)).Should().NotThrow(); + doc.SerializeAsV3(apiWriter); } [Theory] @@ -1970,7 +1960,7 @@ public async Task SerializeDocumentWithWebhooksAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().BeEquivalentTo(expected); + Assert.Equal(expected, actual); } [Fact] @@ -1998,7 +1988,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] @@ -2024,7 +2014,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] @@ -2072,7 +2062,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] @@ -2126,7 +2116,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()); } } } 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/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/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/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/OpenApiMediaTypeTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs index a47ef4052..b1f6ca474 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs @@ -4,8 +4,6 @@ using System.Collections.Generic; 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; @@ -142,7 +140,7 @@ public async Task SerializeBasicMediaTypeAsV3Works(OpenApiFormat format, string // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -170,7 +168,7 @@ public async Task SerializeAdvanceMediaTypeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -194,7 +192,7 @@ public async Task SerializeAdvanceMediaTypeAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -229,7 +227,7 @@ public async Task SerializeMediaTypeWithObjectExampleAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -280,7 +278,7 @@ public async Task SerializeMediaTypeWithObjectExampleAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -304,7 +302,7 @@ public async Task SerializeMediaTypeWithXmlExampleAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -332,7 +330,7 @@ public async Task SerializeMediaTypeWithXmlExampleAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -370,7 +368,7 @@ public async Task SerializeMediaTypeWithObjectExamplesAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -426,7 +424,7 @@ public async Task SerializeMediaTypeWithObjectExamplesAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -441,8 +439,11 @@ public void MediaTypeCopyConstructorWorks() }; // Assert - MediaTypeWithObjectExamples.Examples.Should().NotBeEquivalentTo(clone.Examples); - MediaTypeWithObjectExamples.Example.Should().Be(null); + Assert.Equal(42, clone.Example.GetValue()); + Assert.Empty(clone.Examples); + Assert.Empty(clone.Encoding); + Assert.Empty(clone.Extensions); + 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/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/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs index 80ffe2266..1b0b27ada 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; @@ -273,7 +272,7 @@ public async Task SerializeBasicOperationAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -345,7 +344,7 @@ public async Task SerializeOperationWithBodyAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -429,7 +428,7 @@ public async Task SerializeAdvancedOperationWithTagAndSecurityAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -449,7 +448,7 @@ public async Task SerializeBasicOperationAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -528,7 +527,7 @@ public async Task SerializeOperationWithFormDataAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -584,7 +583,7 @@ public async Task SerializeOperationWithFormDataAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -653,7 +652,7 @@ public async Task SerializeOperationWithBodyAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -734,7 +733,7 @@ public async Task SerializeAdvancedOperationWithTagAndSecurityAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -759,7 +758,7 @@ public async Task SerializeOperationWithNullCollectionAsV2JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -822,7 +821,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/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] diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiReferenceTests.cs index 4e6e47509..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; @@ -29,12 +28,12 @@ public void SettingInternalReferenceForComponentsStyleReferenceShouldSucceed( }; // Assert - reference.ExternalResource.Should().BeNull(); - reference.Type.Should().Be(type); - reference.Id.Should().Be(id); + Assert.Null(reference.ExternalResource); + 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 +54,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 +78,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 +102,7 @@ public async Task SerializeSchemaReferenceAsJsonV3Works() actual = actual.MakeLineBreaksEnvironmentNeutral(); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -122,7 +121,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 +145,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 +163,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 +190,7 @@ public async Task SerializeExternalReferenceAsJsonV2Works() actual = actual.MakeLineBreaksEnvironmentNeutral(); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -210,7 +209,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 +231,7 @@ public async Task SerializeExternalReferenceAsJsonV3Works() actual = actual.MakeLineBreaksEnvironmentNeutral(); // Assert - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -246,7 +245,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/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/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs index 49f1596c5..5edd1c0d0 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] @@ -458,7 +458,7 @@ public async Task SerializeAsV2ShouldSetFormatPropertyInParentSchemaIfPresentInC """.MakeLineBreaksEnvironmentNeutral(); // Assert - expectedV2Schema.Should().BeEquivalentTo(v2Schema); + Assert.Equal(v2Schema, expectedV2Schema); } [Fact] @@ -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.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral()); } internal class SchemaVisitor : OpenApiVisitorBase diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecurityRequirementTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecurityRequirementTests.cs index 8dcebc315..af0343f57 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] @@ -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/Models/OpenApiSecuritySchemeTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.cs index ebe06d4d6..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; @@ -134,7 +133,7 @@ public async Task SerializeApiKeySecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -155,7 +154,7 @@ public async Task SerializeApiKeySecuritySchemeAsV3YamlWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -177,7 +176,7 @@ public async Task SerializeHttpBasicSecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -200,7 +199,7 @@ public async Task SerializeHttpBearerSecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -230,7 +229,7 @@ public async Task SerializeOAuthSingleFlowSecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -276,7 +275,7 @@ public async Task SerializeOAuthMultipleFlowSecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Fact] @@ -298,7 +297,7 @@ public async Task SerializeOpenIdConnectSecuritySchemeAsV3JsonWorks() // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); - actual.Should().Be(expected); + Assert.Equal(expected, actual); } [Theory] 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); } } } 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/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 f6ce92ead..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; @@ -37,7 +36,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..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; @@ -31,7 +30,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..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; @@ -28,7 +27,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/OpenApiHeaderValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiHeaderValidationTests.cs index 25423ab1f..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; @@ -43,7 +41,7 @@ public void ValidateExampleShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeFalse(); + Assert.False(result); } [Fact] @@ -102,7 +100,7 @@ public void ValidateExamplesShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeTrue(); + Assert.True(result); } } } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiInfoValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiInfoValidationTests.cs index 95dde7942..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; @@ -16,8 +15,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..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; @@ -32,7 +31,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/OpenApiMediaTypeValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiMediaTypeValidationTests.cs index 51a8e1795..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 @@ -39,7 +36,7 @@ public void ValidateExampleShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeTrue(); + Assert.True(result); } [Fact] @@ -98,7 +95,7 @@ public void ValidateExamplesShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeTrue(); + Assert.True(result); } } } 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/OpenApiParameterValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs index 3f380c7f1..cacf3d7fa 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiParameterValidationTests.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.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Properties; @@ -29,12 +27,12 @@ public void ValidateFieldIsRequiredInParameter() var errors = parameter.Validate(ValidationRuleSet.GetDefaultRuleSet()); // Assert - errors.Should().NotBeEmpty(); - errors.Select(e => e.Message).Should().BeEquivalentTo(new[] + Assert.NotEmpty(errors); + Assert.Equivalent(new[] { nameError, inError - }); + }, errors.Select(e => e.Message)); } [Fact] @@ -54,11 +52,11 @@ public void ValidateRequiredIsTrueWhenInIsPathInParameter() walker.Walk(parameter); var errors = validator.Errors; // Assert - errors.Should().NotBeEmpty(); - errors.Select(e => e.Message).Should().BeEquivalentTo(new[] + Assert.NotEmpty(errors); + Assert.Equivalent(new[] { "\"required\" must be true when parameter location is \"path\"" - }); + }, errors.Select(e => e.Message)); } [Fact] @@ -88,7 +86,7 @@ public void ValidateExampleShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeTrue(); + Assert.True(result); } [Fact] @@ -153,7 +151,7 @@ public void ValidateExamplesShouldNotHaveDataTypeMismatchForSimpleSchema() var result = !warnings.Any(); // Assert - result.Should().BeFalse(); + Assert.False(result); } [Fact] @@ -183,15 +181,15 @@ public void PathParameterNotInThePathShouldReturnAnError() var result = errors.Any(); // Assert - result.Should().BeTrue(); - errors.OfType().Select(e => e.RuleName).Should().BeEquivalentTo(new[] + Assert.True(result); + 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] @@ -226,7 +224,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..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; @@ -23,8 +22,8 @@ public void ValidatePathsMustBeginWithSlash() var errors = paths.Validate(ValidationRuleSet.GetDefaultRuleSet()); // Assert - errors.Should().NotBeEmpty(); - errors.Select(e => e.Message).Should().BeEquivalentTo(error); + Assert.NotEmpty(errors); + Assert.Equivalent(new string[] {error}, errors.Select(e => e.Message).ToArray()); } [Fact] @@ -42,8 +41,8 @@ public void ValidatePathsAreUnique() var errors = paths.Validate(ValidationRuleSet.GetDefaultRuleSet()); // Assert - errors.Should().NotBeEmpty(); - errors.Select(e => e.Message).Should().BeEquivalentTo(error); + Assert.NotEmpty(errors); + Assert.Equivalent(new string[] {error}, errors.Select(e => e.Message).ToArray()); } [Fact] public void ValidatePathsAreUniqueDoesNotConsiderMultiParametersAsIdentical() @@ -60,7 +59,7 @@ public void ValidatePathsAreUniqueDoesNotConsiderMultiParametersAsIdentical() var errors = paths.Validate(ValidationRuleSet.GetDefaultRuleSet()); // Assert - errors.Should().BeEmpty(); + Assert.Empty(errors); } [Fact] public void ValidatePathsAreUniqueConsidersMultiParametersAsIdentical() @@ -76,7 +75,7 @@ public void ValidatePathsAreUniqueConsidersMultiParametersAsIdentical() var errors = paths.Validate(ValidationRuleSet.GetDefaultRuleSet()); // Assert - errors.Should().NotBeEmpty(); + Assert.NotEmpty(errors); } } } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiResponseValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiResponseValidationTests.cs index b967ebab6..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; @@ -32,7 +31,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/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/Validations/OpenApiServerValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiServerValidationTests.cs index aa6d6ecd0..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; @@ -29,7 +28,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..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; @@ -31,7 +30,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 +54,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); } } } diff --git a/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs b/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs index 7e12ad766..f90d058b2 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); } 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); }