From 216b170eaec2e66b8df5603b4dd5978ff4bece32 Mon Sep 17 00:00:00 2001 From: Marcin Smolka <6661461+msmolka@users.noreply.github.com> Date: Sat, 7 Jun 2025 14:36:04 +0200 Subject: [PATCH 1/2] Added support for AwesomeAssertions fork --- Directory.Packages.props | 5 ++ FluentAssertions.Web.sln | 49 ++++++++++++++++ readme.md | 21 +++++-- ...ions.Web.Serializers.NewtonsoftJson.csproj | 49 ++++++++++++++++ .../AwesomeAssertions.Web.Types.csproj | 22 ++++++++ .../GlobalUsings.cs | 5 ++ .../Properties/AssemblyInfo.cs | 4 ++ .../AwesomeAssertions.Web.csproj | 56 +++++++++++++++++++ src/AwesomeAssertions.Web/GlobalUsings.cs | 13 +++++ .../Properties/AssemblyInfo.cs | 3 + src/Directory.Build.props | 2 +- .../NewtonsoftJsonSerializer.cs | 4 ++ .../NewtonsoftJsonSerializerConfig.cs | 4 ++ .../DeserializationException.cs | 4 ++ .../FluentAssertionsWebConfig.cs | 15 +++++ src/FluentAssertions.Web.Types/ISerializer.cs | 4 ++ .../Serializers/SystemTextJsonSerializer.cs | 4 ++ .../SystemTextJsonSerializerConfig.cs | 4 ++ .../BadRequestAssertions.cs | 6 +- src/FluentAssertions.Web/GlobalUsings.cs | 1 - .../HaveHeaderAssertions.cs | 6 +- .../HttpResponseContentAssertions.cs | 6 +- .../HttpResponseMessageAssertions.cs | 19 ++++++- ...sponseMessageFluentAssertionsExtensions.cs | 32 ++++++----- .../HttpResponseMessageFormatter.cs | 12 +++- .../HttpStatusCodeAssertions.cs | 6 +- .../Internal/AssertionsFailures.cs | 6 +- .../Internal/AssertionsFailuresFormatter.cs | 10 +++- .../Internal/ContentFormatterOptions.cs | 6 +- .../Internal/ContentProcessors/Appender.cs | 4 ++ .../ContentProcessors/BinaryProcessor.cs | 4 ++ .../ContentProcessors/FallbackProcessor.cs | 4 ++ .../ContentProcessors/IContentProcessor.cs | 4 ++ .../InternalServerErrorProcessor.cs | 4 ++ .../ContentProcessors/JsonProcessor.cs | 4 ++ .../ContentProcessors/MultipartProcessor.cs | 4 ++ .../ContentProcessors/ProcessorBase.cs | 4 ++ .../ContentProcessors/ProcessorsRunner.cs | 4 ++ src/FluentAssertions.Web/Internal/Guard.cs | 6 +- .../Internal/HttpContentExtensions.cs | 4 ++ .../Internal/HttpResponseMessageExtensions.cs | 6 +- .../Internal/JsonExtensions.cs | 6 +- .../Internal/NoSynchronizationContextScope.cs | 4 ++ .../Internal/ObjectExtensions.cs | 6 +- .../Internal/StringExtensions.cs | 6 +- .../Internal/TaskExtensions.cs | 6 +- .../SatisfyHttpResponseMessageAssertions.cs | 6 +- .../SatisfyModelAssertions.cs | 6 +- ...eb.AwesomeAssertionsWebConfig.Tests.csproj | 20 +++++++ .../GlobalUsings.cs | 2 + .../NewtonsoftJsonSerializerTests.cs | 29 ++++++++++ .../SystemTextJsonSerializerTests.cs | 19 +++++++ .../xunit.runner.json | 3 + ...eb.Serializers.NewtonsoftJson.Tests.csproj | 24 ++++++++ .../ConfigureAwesomeAssertionsWebFixture.cs | 12 ++++ .../AwesomeAssertions.Web.Tests.csproj | 24 ++++++++ .../GlobalUsings.cs | 16 ++++++ test/Directory.Build.props | 1 - ...Web.FluentAssertionsWebConfig.Tests.csproj | 1 + .../ConfigureFluentAssertionsWebFixture.cs | 12 ++++ ...eb.Serializers.NewtonsoftJson.Tests.csproj | 1 + .../NewtonsoftSerializerTests.cs | 16 ++---- .../YesNoBooleanJsonConverter.cs | 4 ++ .../BadRequestAssertionsSpecs.cs | 6 +- .../DeserializationExceptionTests.cs | 6 +- .../FluentAssertions.Web.Tests.csproj | 1 + .../HeadersAssertionsSpecs.cs | 6 +- .../HttpResponseContentAssertionsSpecs.cs | 6 +- .../HttpResponseMessageFormatterSpecs.cs | 9 +++ .../HttpStatusCodeAssertionsSpecs.cs | 6 +- .../Internal/ApiAccessibilityTests.cs | 29 +++++++++- .../FallbackProcessorTests.cs | 12 +++- .../InternalServerErrorProcessorTests.cs | 12 +++- .../ContentProcessors/JsonProcessorTests.cs | 12 +++- .../Internal/HttpContentExtensionsTests.cs | 12 +++- .../Internal/JsonExtensionsTests.cs | 6 +- ...HttpResponseMessageAssertionsAsyncSpecs.cs | 6 +- ...tisfyHttpResponseMessageAssertionsSpecs.cs | 6 +- .../SatisfyModelAssertionsAsyncSpecs.cs | 12 +++- .../SatisfyModelAssertionsSpecs.cs | 6 +- .../TestModels/TestEnum.cs | 6 +- .../TestModels/TestModel.cs | 6 +- .../FluentAssertions.Web.v8.Tests.csproj | 1 + .../Sample.Api.AwesomeAssertions.Tests.csproj | 35 ++++++++++++ .../CommentsControllerTests.cs | 4 ++ .../CustomStartupConfigurationsTests.cs | 6 +- test/Sample.Api.Tests/FilesControllerTests.cs | 6 +- test/Sample.Api.Tests/Sample.Api.Tests.csproj | 4 ++ .../Sample.Api.Tests/ValuesControllerTests.cs | 4 ++ .../Sample.Api.v8.Tests.csproj | 1 + 90 files changed, 803 insertions(+), 77 deletions(-) create mode 100644 src/AwesomeAssertions.Web.Serializers.NewtonsoftJson/AwesomeAssertions.Web.Serializers.NewtonsoftJson.csproj create mode 100644 src/AwesomeAssertions.Web.Types/AwesomeAssertions.Web.Types.csproj create mode 100644 src/AwesomeAssertions.Web.Types/GlobalUsings.cs create mode 100644 src/AwesomeAssertions.Web.Types/Properties/AssemblyInfo.cs create mode 100644 src/AwesomeAssertions.Web/AwesomeAssertions.Web.csproj create mode 100644 src/AwesomeAssertions.Web/GlobalUsings.cs create mode 100644 src/AwesomeAssertions.Web/Properties/AssemblyInfo.cs create mode 100644 test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests.csproj create mode 100644 test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/GlobalUsings.cs create mode 100644 test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/Serializers/NewtonsoftJsonSerializerTests.cs create mode 100644 test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/Serializers/SystemTextJsonSerializerTests.cs create mode 100644 test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/xunit.runner.json create mode 100644 test/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests.csproj create mode 100644 test/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests/ConfigureAwesomeAssertionsWebFixture.cs create mode 100644 test/AwesomeAssertions.Web.Tests/AwesomeAssertions.Web.Tests.csproj create mode 100644 test/AwesomeAssertions.Web.Tests/GlobalUsings.cs create mode 100644 test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/ConfigureFluentAssertionsWebFixture.cs create mode 100644 test/Sample.Api.AwesomeAssertions.Tests/Sample.Api.AwesomeAssertions.Tests.csproj diff --git a/Directory.Packages.props b/Directory.Packages.props index 3842892..372ba7f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -19,4 +19,9 @@ + + + + + \ No newline at end of file diff --git a/FluentAssertions.Web.sln b/FluentAssertions.Web.sln index b13b697..bf292f8 100644 --- a/FluentAssertions.Web.sln +++ b/FluentAssertions.Web.sln @@ -54,6 +54,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentAssertions.Web.v8.Tes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentAssertions.Web.Types", "src\FluentAssertions.Web.Types\FluentAssertions.Web.Types.csproj", "{455E5F41-B678-4286-BB4D-FC232D08CAC0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AwesomeAssertions.Web", "src\AwesomeAssertions.Web\AwesomeAssertions.Web.csproj", "{54EF3A12-DB43-48C4-A64C-97D2B62E3C2E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AwesomeAssertions.Web.Types", "src\AwesomeAssertions.Web.Types\AwesomeAssertions.Web.Types.csproj", "{418ADD1B-EA19-4EAE-95DE-5ED327BC4E9E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AwesomeAssertions.Web.Serializers.NewtonsoftJson", "src\AwesomeAssertions.Web.Serializers.NewtonsoftJson\AwesomeAssertions.Web.Serializers.NewtonsoftJson.csproj", "{79495BD6-C628-42E9-8147-990B8112F377}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AwesomeAssertions.Web.Tests", "test\AwesomeAssertions.Web.Tests\AwesomeAssertions.Web.Tests.csproj", "{BBBB8E66-221B-4D89-A942-E63BC7C64C94}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests", "test\AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests\AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests.csproj", "{1455C2AB-9EE2-4C4B-96AC-B030EB06928C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests", "test\AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests\AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests.csproj", "{E2EC106A-42E7-448F-85F5-85FB07BA2AC1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.Api.AwesomeAssertions.Tests", "test\Sample.Api.AwesomeAssertions.Tests\Sample.Api.AwesomeAssertions.Tests.csproj", "{2D38D734-43BF-423C-9CED-8484B5141E85}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -108,6 +122,34 @@ Global {455E5F41-B678-4286-BB4D-FC232D08CAC0}.Debug|Any CPU.Build.0 = Debug|Any CPU {455E5F41-B678-4286-BB4D-FC232D08CAC0}.Release|Any CPU.ActiveCfg = Release|Any CPU {455E5F41-B678-4286-BB4D-FC232D08CAC0}.Release|Any CPU.Build.0 = Release|Any CPU + {54EF3A12-DB43-48C4-A64C-97D2B62E3C2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {54EF3A12-DB43-48C4-A64C-97D2B62E3C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {54EF3A12-DB43-48C4-A64C-97D2B62E3C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {54EF3A12-DB43-48C4-A64C-97D2B62E3C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {418ADD1B-EA19-4EAE-95DE-5ED327BC4E9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {418ADD1B-EA19-4EAE-95DE-5ED327BC4E9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {418ADD1B-EA19-4EAE-95DE-5ED327BC4E9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {418ADD1B-EA19-4EAE-95DE-5ED327BC4E9E}.Release|Any CPU.Build.0 = Release|Any CPU + {79495BD6-C628-42E9-8147-990B8112F377}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {79495BD6-C628-42E9-8147-990B8112F377}.Debug|Any CPU.Build.0 = Debug|Any CPU + {79495BD6-C628-42E9-8147-990B8112F377}.Release|Any CPU.ActiveCfg = Release|Any CPU + {79495BD6-C628-42E9-8147-990B8112F377}.Release|Any CPU.Build.0 = Release|Any CPU + {BBBB8E66-221B-4D89-A942-E63BC7C64C94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BBBB8E66-221B-4D89-A942-E63BC7C64C94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BBBB8E66-221B-4D89-A942-E63BC7C64C94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BBBB8E66-221B-4D89-A942-E63BC7C64C94}.Release|Any CPU.Build.0 = Release|Any CPU + {1455C2AB-9EE2-4C4B-96AC-B030EB06928C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1455C2AB-9EE2-4C4B-96AC-B030EB06928C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1455C2AB-9EE2-4C4B-96AC-B030EB06928C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1455C2AB-9EE2-4C4B-96AC-B030EB06928C}.Release|Any CPU.Build.0 = Release|Any CPU + {E2EC106A-42E7-448F-85F5-85FB07BA2AC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2EC106A-42E7-448F-85F5-85FB07BA2AC1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2EC106A-42E7-448F-85F5-85FB07BA2AC1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2EC106A-42E7-448F-85F5-85FB07BA2AC1}.Release|Any CPU.Build.0 = Release|Any CPU + {2D38D734-43BF-423C-9CED-8484B5141E85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D38D734-43BF-423C-9CED-8484B5141E85}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D38D734-43BF-423C-9CED-8484B5141E85}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D38D734-43BF-423C-9CED-8484B5141E85}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -126,6 +168,13 @@ Global {EBB6D06F-B87F-4BDA-8F1B-A6E88C96C2E1} = {BFF7517A-C9EA-458D-829E-28A10F8D61BF} {056E517C-F644-4B8A-9494-09276E6E3C6B} = {BFF7517A-C9EA-458D-829E-28A10F8D61BF} {455E5F41-B678-4286-BB4D-FC232D08CAC0} = {14FDD52D-B83A-445B-BD2F-04B3E7B8033C} + {54EF3A12-DB43-48C4-A64C-97D2B62E3C2E} = {14FDD52D-B83A-445B-BD2F-04B3E7B8033C} + {418ADD1B-EA19-4EAE-95DE-5ED327BC4E9E} = {14FDD52D-B83A-445B-BD2F-04B3E7B8033C} + {79495BD6-C628-42E9-8147-990B8112F377} = {14FDD52D-B83A-445B-BD2F-04B3E7B8033C} + {BBBB8E66-221B-4D89-A942-E63BC7C64C94} = {BFF7517A-C9EA-458D-829E-28A10F8D61BF} + {1455C2AB-9EE2-4C4B-96AC-B030EB06928C} = {BFF7517A-C9EA-458D-829E-28A10F8D61BF} + {E2EC106A-42E7-448F-85F5-85FB07BA2AC1} = {BFF7517A-C9EA-458D-829E-28A10F8D61BF} + {2D38D734-43BF-423C-9CED-8484B5141E85} = {BFF7517A-C9EA-458D-829E-28A10F8D61BF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {81F41C75-2F8A-4E70-BA17-38146C4BB6E6} diff --git a/readme.md b/readme.md index 0a587d8..81a5b3d 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ ## FluentAssertions.Web -This is a [*FluentAssertions*](https://fluentassertions.com/) extension over the *HttpResponseMessage* object. +This is a [*FluentAssertions*](https://fluentassertions.com/) and [*AwesomeAssertions*](https://awesomeassertions.org//) extension over the *HttpResponseMessage* object. -It provides assertions specific to HTTP responses and outputs rich erros messages when the tests fail, so less time with debugging is spent. +It provides assertions specific to HTTP responses and outputs rich errors messages when the tests fail, so less time with debugging is spent. ```csharp [Fact] @@ -33,7 +33,7 @@ Thus this library solves two problems: ##### Focus on the Assert part and not on the HttpClient related APIs, neither on the response deserialization -Once the response is ready you'll want to assert it. With first level properties like `StatusCode` is somehow easy, especially with FluentAssertions, but often we need more, like to deserialize the content into an object of a certain type and then to Assert it. Or to simply assert something about the response content itself. Soon duplication code occurs and the urge to reduce it is just the next logical step. +Once the response is ready you'll want to assert it. With first level properties like `StatusCode` is somehow easy, especially with FluentAssertions/AwesomeAssertions, but often we need more, like to deserialize the content into an object of a certain type and then to Assert it. Or to simply assert something about the response content itself. Soon duplication code occurs and the urge to reduce it is just the next logical step. ##### Debugging failed tests interrupts the programmer's flow state When a test is failing, the following actions are taken most of the time: @@ -65,6 +65,12 @@ If you are using FluentAssertions >= 8.0.0 dotnet add package FluentAssertions.Web.v8 ``` +If you are using AwesomeAssertions >= 8.0.0 + +``` +dotnet add package AwesomeAssertions.Web +``` + ### FluentAssertions.Web Examples - Asserting that the response content of a HTTP POST request is equivalent to a certain object @@ -232,7 +238,8 @@ The change must be done before the test is run and this depends on the testing f #### Newtonsoft.Json -The serializer itself is replaceable, so you can implement your own, by implementing the `ISerialize` interface. The serializer is shipped via the **FluentAssertions.Web.Serializers.NewtonsoftJson** package. +The serializer itself is replaceable, so you can implement your own, by implementing the `ISerialize` interface. +The serializer is shipped via the **FluentAssertions.Web.Serializers.NewtonsoftJson** and **AwesomeAssertions.Web.Serializers.NewtonsoftJson** package. [![NuGet](https://img.shields.io/nuget/v/FluentAssertions.Web.Serializers.NewtonsoftJson.svg)](https://www.nuget.org/packages/FluentAssertions.Web.Serializers.NewtonsoftJson) @@ -242,6 +249,12 @@ To set the default serializer to **Newtonsoft.Json** one, use the following conf ```csharp FluentAssertionsWebConfig.Serializer = new NewtonsoftJsonSerializer(); +``` +or + +```csharp +AwesomeAssertionsWebConfig.Serializer = new NewtonsoftJsonSerializer(); + ``` The related `Newtonsoft.Json.JsonSerializerSetttings` used to configure the Newtonsoft.Json serializer is accesible via the `NewtonsoftJsonSerializerConfig.Options` static field. So if you want to add a custom converter, then the related setting is changed like this: diff --git a/src/AwesomeAssertions.Web.Serializers.NewtonsoftJson/AwesomeAssertions.Web.Serializers.NewtonsoftJson.csproj b/src/AwesomeAssertions.Web.Serializers.NewtonsoftJson/AwesomeAssertions.Web.Serializers.NewtonsoftJson.csproj new file mode 100644 index 0000000..6fdf9ed --- /dev/null +++ b/src/AwesomeAssertions.Web.Serializers.NewtonsoftJson/AwesomeAssertions.Web.Serializers.NewtonsoftJson.csproj @@ -0,0 +1,49 @@ + + + + + NewtonsoftJson based serializer for AwesomeAssertions.Web + + + + + $(DefineConstants);AAV + + + + + + + + + + + + + %(RecursiveDir)%(Filename)%(Extension) + $(ContentTargetFolders)\src\%RecursiveDir% + + + + + $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage + + + + + + <_ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('PrivateAssets', 'all'))"/> + + + + + + + + + + + + + + diff --git a/src/AwesomeAssertions.Web.Types/AwesomeAssertions.Web.Types.csproj b/src/AwesomeAssertions.Web.Types/AwesomeAssertions.Web.Types.csproj new file mode 100644 index 0000000..e72fecf --- /dev/null +++ b/src/AwesomeAssertions.Web.Types/AwesomeAssertions.Web.Types.csproj @@ -0,0 +1,22 @@ + + + + false + + + + + + + + $(DefineConstants);AAV + + + + + %(RecursiveDir)%(Filename)%(Extension) + $(ContentTargetFolders)\src\%RecursiveDir% + + + + diff --git a/src/AwesomeAssertions.Web.Types/GlobalUsings.cs b/src/AwesomeAssertions.Web.Types/GlobalUsings.cs new file mode 100644 index 0000000..a5019d6 --- /dev/null +++ b/src/AwesomeAssertions.Web.Types/GlobalUsings.cs @@ -0,0 +1,5 @@ +global using AwesomeAssertions.Web.Internal.Serializers; +global using System; +global using System.IO; +global using System.Text.Json; +global using System.Threading.Tasks; diff --git a/src/AwesomeAssertions.Web.Types/Properties/AssemblyInfo.cs b/src/AwesomeAssertions.Web.Types/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9a7de82 --- /dev/null +++ b/src/AwesomeAssertions.Web.Types/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("AwesomeAssertions.Web.Tests")] +[assembly: InternalsVisibleTo("AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests")] \ No newline at end of file diff --git a/src/AwesomeAssertions.Web/AwesomeAssertions.Web.csproj b/src/AwesomeAssertions.Web/AwesomeAssertions.Web.csproj new file mode 100644 index 0000000..3e76859 --- /dev/null +++ b/src/AwesomeAssertions.Web/AwesomeAssertions.Web.csproj @@ -0,0 +1,56 @@ + + + + + This is a AwesomeAssertions extension over the HttpResponseMessage object. + It provides specific assertions and outputs rich erros messages that include the HTTP Request and Response. + This version depends on the commercial version of the FluentAssertions library (>= 8.0.0). + + readme.md + + + + $(DefineConstants);FAV8;AAV + + + + + + + + + + + + + + + + + + + %(RecursiveDir)%(Filename)%(Extension) + $(ContentTargetFolders)\src\%RecursiveDir% + + + + + $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage + + + + + + <_ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('PrivateAssets', 'all'))" /> + + + + + + + + + + + + diff --git a/src/AwesomeAssertions.Web/GlobalUsings.cs b/src/AwesomeAssertions.Web/GlobalUsings.cs new file mode 100644 index 0000000..f011eff --- /dev/null +++ b/src/AwesomeAssertions.Web/GlobalUsings.cs @@ -0,0 +1,13 @@ +global using AwesomeAssertions.Equivalency; +global using AwesomeAssertions.Execution; +global using AwesomeAssertions.Web; +global using AwesomeAssertions.Web.Internal; +global using System; +global using System.Collections.Generic; +global using System.Diagnostics; +global using System.IO; +global using System.Linq; +global using System.Net; +global using System.Net.Http; +global using System.Text.Json; +global using System.Threading.Tasks; diff --git a/src/AwesomeAssertions.Web/Properties/AssemblyInfo.cs b/src/AwesomeAssertions.Web/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..10eb3a8 --- /dev/null +++ b/src/AwesomeAssertions.Web/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("AwesomeAssertions.Web.Tests")] diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 3cd149c..de76138 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -12,7 +12,7 @@ Adrian Iftode - fluentassertions;httpresponsemessage;fluentassertionsweb;unit;unittest;integration;integrationtest;functionaltest + fluentassertions;awesomeassertions;httpresponsemessage;fluentassertionsweb;awesomeassertionsweb;unit;unittest;integration;integrationtest;functionaltest 1.1.0 https://github.com/adrianiftode/FluentAssertions.Web https://github.com/adrianiftode/FluentAssertions.Web diff --git a/src/FluentAssertions.Web.Serializers.NewtonsoftJson/NewtonsoftJsonSerializer.cs b/src/FluentAssertions.Web.Serializers.NewtonsoftJson/NewtonsoftJsonSerializer.cs index a21cbd0..64a99ae 100644 --- a/src/FluentAssertions.Web.Serializers.NewtonsoftJson/NewtonsoftJsonSerializer.cs +++ b/src/FluentAssertions.Web.Serializers.NewtonsoftJson/NewtonsoftJsonSerializer.cs @@ -1,5 +1,9 @@ // ReSharper disable once CheckNamespace +#if AAV +namespace AwesomeAssertions; +#else namespace FluentAssertions; +#endif /// /// Newtonsoft.Json based serializer diff --git a/src/FluentAssertions.Web.Serializers.NewtonsoftJson/NewtonsoftJsonSerializerConfig.cs b/src/FluentAssertions.Web.Serializers.NewtonsoftJson/NewtonsoftJsonSerializerConfig.cs index 00edda7..842fb8a 100644 --- a/src/FluentAssertions.Web.Serializers.NewtonsoftJson/NewtonsoftJsonSerializerConfig.cs +++ b/src/FluentAssertions.Web.Serializers.NewtonsoftJson/NewtonsoftJsonSerializerConfig.cs @@ -1,5 +1,9 @@ // ReSharper disable once CheckNamespace +#if AAV +namespace AwesomeAssertions; +#else namespace FluentAssertions; +#endif /// /// Holder of the global diff --git a/src/FluentAssertions.Web.Types/DeserializationException.cs b/src/FluentAssertions.Web.Types/DeserializationException.cs index 98e04b5..f1cd2fe 100644 --- a/src/FluentAssertions.Web.Types/DeserializationException.cs +++ b/src/FluentAssertions.Web.Types/DeserializationException.cs @@ -2,7 +2,11 @@ using System; using System.Runtime.Serialization; +#if AAV +namespace AwesomeAssertions; +#else namespace FluentAssertions; +#endif /// /// Captures serialization exceptions. diff --git a/src/FluentAssertions.Web.Types/FluentAssertionsWebConfig.cs b/src/FluentAssertions.Web.Types/FluentAssertionsWebConfig.cs index 4f0317f..afffb35 100644 --- a/src/FluentAssertions.Web.Types/FluentAssertionsWebConfig.cs +++ b/src/FluentAssertions.Web.Types/FluentAssertionsWebConfig.cs @@ -1,14 +1,29 @@ // ReSharper disable once CheckNamespace +#if AAV +namespace AwesomeAssertions; +#else namespace FluentAssertions; +#endif +#if AAV +/// +/// Holder of the global +/// +public static class AwesomeAssertionsWebConfig +#else /// /// Holder of the global /// public static class FluentAssertionsWebConfig +#endif { private static ISerializer? _serializer; +#if AAV + static AwesomeAssertionsWebConfig() => Serializer = new SystemTextJsonSerializer(); +#else static FluentAssertionsWebConfig() => Serializer = new SystemTextJsonSerializer(); +#endif /// /// The serializer instance used to deserialize the responses into a model of a specified typed diff --git a/src/FluentAssertions.Web.Types/ISerializer.cs b/src/FluentAssertions.Web.Types/ISerializer.cs index 55d966e..7131f50 100644 --- a/src/FluentAssertions.Web.Types/ISerializer.cs +++ b/src/FluentAssertions.Web.Types/ISerializer.cs @@ -3,7 +3,11 @@ using System.IO; using System.Threading.Tasks; +#if AAV +namespace AwesomeAssertions; +#else namespace FluentAssertions; +#endif /// /// Provides an abstraction to deserialize a Stream of binary data into a C# object. diff --git a/src/FluentAssertions.Web.Types/Internal/Serializers/SystemTextJsonSerializer.cs b/src/FluentAssertions.Web.Types/Internal/Serializers/SystemTextJsonSerializer.cs index 83e04d6..05cdb84 100644 --- a/src/FluentAssertions.Web.Types/Internal/Serializers/SystemTextJsonSerializer.cs +++ b/src/FluentAssertions.Web.Types/Internal/Serializers/SystemTextJsonSerializer.cs @@ -2,7 +2,11 @@ using System.Reflection; using System.Text.Json.Serialization; +#if AAV +namespace AwesomeAssertions.Web.Internal.Serializers; +#else namespace FluentAssertions.Web.Internal.Serializers; +#endif internal class SystemTextJsonSerializer : ISerializer { diff --git a/src/FluentAssertions.Web.Types/SystemTextJsonSerializerConfig.cs b/src/FluentAssertions.Web.Types/SystemTextJsonSerializerConfig.cs index d06b192..7ad0565 100644 --- a/src/FluentAssertions.Web.Types/SystemTextJsonSerializerConfig.cs +++ b/src/FluentAssertions.Web.Types/SystemTextJsonSerializerConfig.cs @@ -1,7 +1,11 @@ // ReSharper disable once CheckNamespace using System.Text.Json.Serialization; +#if AAV +namespace AwesomeAssertions; +#else namespace FluentAssertions; +#endif /// /// Holder of the global diff --git a/src/FluentAssertions.Web/BadRequestAssertions.cs b/src/FluentAssertions.Web/BadRequestAssertions.cs index be3b364..38cb273 100644 --- a/src/FluentAssertions.Web/BadRequestAssertions.cs +++ b/src/FluentAssertions.Web/BadRequestAssertions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web; +#if AAV +namespace AwesomeAssertions.Web; +#else +namespace FluentAssertions.Web; +#endif /// /// Contains a number of methods to assert that an is in the expected state related to HTTP Bad Request response diff --git a/src/FluentAssertions.Web/GlobalUsings.cs b/src/FluentAssertions.Web/GlobalUsings.cs index d6b1d98..35cb872 100644 --- a/src/FluentAssertions.Web/GlobalUsings.cs +++ b/src/FluentAssertions.Web/GlobalUsings.cs @@ -2,7 +2,6 @@ global using FluentAssertions.Execution; global using FluentAssertions.Web; global using FluentAssertions.Web.Internal; -global using FluentAssertions.Web.Internal.Serializers; global using System; global using System.Collections.Generic; global using System.Diagnostics; diff --git a/src/FluentAssertions.Web/HaveHeaderAssertions.cs b/src/FluentAssertions.Web/HaveHeaderAssertions.cs index bd8148f..d4c1b20 100644 --- a/src/FluentAssertions.Web/HaveHeaderAssertions.cs +++ b/src/FluentAssertions.Web/HaveHeaderAssertions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web; +#if AAV +namespace AwesomeAssertions.Web; +#else +namespace FluentAssertions.Web; +#endif /// /// Contains a number of methods to assert that an is in the expected state related to HTTP headers. diff --git a/src/FluentAssertions.Web/HttpResponseContentAssertions.cs b/src/FluentAssertions.Web/HttpResponseContentAssertions.cs index 1988475..0dcd8ce 100644 --- a/src/FluentAssertions.Web/HttpResponseContentAssertions.cs +++ b/src/FluentAssertions.Web/HttpResponseContentAssertions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web; +#if AAV +namespace AwesomeAssertions.Web; +#else +namespace FluentAssertions.Web; +#endif /// /// Contains a number of methods to assert that an is in the expected state related to the HTTP content. diff --git a/src/FluentAssertions.Web/HttpResponseMessageAssertions.cs b/src/FluentAssertions.Web/HttpResponseMessageAssertions.cs index 850d3a6..ffaf64f 100644 --- a/src/FluentAssertions.Web/HttpResponseMessageAssertions.cs +++ b/src/FluentAssertions.Web/HttpResponseMessageAssertions.cs @@ -1,7 +1,16 @@ -using FluentAssertions.Formatting; +#if AAV +using AwesomeAssertions.Formatting; +using AwesomeAssertions.Primitives; +#else +using FluentAssertions.Formatting; using FluentAssertions.Primitives; +#endif +#if AAV +namespace AwesomeAssertions.Web; +#else namespace FluentAssertions.Web; +#endif /// /// Contains a number of methods to assert that an is in the expected state. @@ -47,7 +56,13 @@ private protected (bool success, string? errorMessage) TryGetSubjectModel> readModel = () => Subject.Content.ReadAsAsync(modelType, FluentAssertionsWebConfig.Serializer); +#if AAV + var serializer = AwesomeAssertionsWebConfig.Serializer; +#else + var serializer = FluentAssertionsWebConfig.Serializer; +#endif + + Func> readModel = () => Subject.Content.ReadAsAsync(modelType, serializer); try { model = readModel.ExecuteInDefaultSynchronizationContext().GetAwaiter().GetResult(); diff --git a/src/FluentAssertions.Web/HttpResponseMessageFluentAssertionsExtensions.cs b/src/FluentAssertions.Web/HttpResponseMessageFluentAssertionsExtensions.cs index 6c2b29c..b9f43f9 100644 --- a/src/FluentAssertions.Web/HttpResponseMessageFluentAssertionsExtensions.cs +++ b/src/FluentAssertions.Web/HttpResponseMessageFluentAssertionsExtensions.cs @@ -1,19 +1,23 @@ -#if FAV8 -// ReSharper disable once CheckNamespace -namespace FluentAssertions +// ReSharper disable once CheckNamespace +#if AAV +namespace AwesomeAssertions; +#elif FAV8 +namespace FluentAssertions; +#else +#endif + +#if FAV8 +/// +/// Contains extension methods for custom assertions in unit tests. +/// +[DebuggerNonUserCode] +public static class HttpResponseMessageFluentAssertionsExtensions { /// - /// Contains extension methods for custom assertions in unit tests. + /// Returns an object that can be used to assert the + /// current . /// - [DebuggerNonUserCode] - public static class HttpResponseMessageFluentAssertionsExtensions - { - /// - /// Returns an object that can be used to assert the - /// current . - /// - public static HttpResponseMessageAssertions Should(this HttpResponseMessage? actual) - => new HttpResponseMessageAssertions(actual, AssertionChain.GetOrCreate()); - } + public static HttpResponseMessageAssertions Should(this HttpResponseMessage? actual) + => new HttpResponseMessageAssertions(actual, AssertionChain.GetOrCreate()); } #endif \ No newline at end of file diff --git a/src/FluentAssertions.Web/HttpResponseMessageFormatter.cs b/src/FluentAssertions.Web/HttpResponseMessageFormatter.cs index 33916f1..f7d9eab 100644 --- a/src/FluentAssertions.Web/HttpResponseMessageFormatter.cs +++ b/src/FluentAssertions.Web/HttpResponseMessageFormatter.cs @@ -1,8 +1,18 @@ -using FluentAssertions.Formatting; +#if AAV +using AwesomeAssertions.Formatting; +using AwesomeAssertions.Web.Internal.ContentProcessors; +#else +using FluentAssertions.Formatting; using FluentAssertions.Web.Internal.ContentProcessors; +#endif + using System.Text; +#if AAV +namespace AwesomeAssertions.Web; +#else namespace FluentAssertions.Web; +#endif internal class HttpResponseMessageFormatter : IValueFormatter { diff --git a/src/FluentAssertions.Web/HttpStatusCodeAssertions.cs b/src/FluentAssertions.Web/HttpStatusCodeAssertions.cs index ccbb073..4198025 100644 --- a/src/FluentAssertions.Web/HttpStatusCodeAssertions.cs +++ b/src/FluentAssertions.Web/HttpStatusCodeAssertions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web; +#if AAV +namespace AwesomeAssertions.Web; +#else +namespace FluentAssertions.Web; +#endif public partial class HttpResponseMessageAssertions { diff --git a/src/FluentAssertions.Web/Internal/AssertionsFailures.cs b/src/FluentAssertions.Web/Internal/AssertionsFailures.cs index 0525393..73957da 100644 --- a/src/FluentAssertions.Web/Internal/AssertionsFailures.cs +++ b/src/FluentAssertions.Web/Internal/AssertionsFailures.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Internal; +#if AAV +namespace AwesomeAssertions.Web.Internal; +#else +namespace FluentAssertions.Web.Internal; +#endif internal class AssertionsFailures { diff --git a/src/FluentAssertions.Web/Internal/AssertionsFailuresFormatter.cs b/src/FluentAssertions.Web/Internal/AssertionsFailuresFormatter.cs index e406849..3250fc8 100644 --- a/src/FluentAssertions.Web/Internal/AssertionsFailuresFormatter.cs +++ b/src/FluentAssertions.Web/Internal/AssertionsFailuresFormatter.cs @@ -1,7 +1,15 @@ -using FluentAssertions.Formatting; +#if AAV +using AwesomeAssertions.Formatting; +#else +using FluentAssertions.Formatting; +#endif using System.Text; +#if AAV +namespace AwesomeAssertions.Web.Internal; +#else namespace FluentAssertions.Web.Internal; +#endif internal class AssertionsFailuresFormatter : IValueFormatter { diff --git a/src/FluentAssertions.Web/Internal/ContentFormatterOptions.cs b/src/FluentAssertions.Web/Internal/ContentFormatterOptions.cs index 2ac2b1e..2d07f2b 100644 --- a/src/FluentAssertions.Web/Internal/ContentFormatterOptions.cs +++ b/src/FluentAssertions.Web/Internal/ContentFormatterOptions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Internal; +#if AAV +namespace AwesomeAssertions.Web.Internal; +#else +namespace FluentAssertions.Web.Internal; +#endif internal static class ContentFormatterOptions { diff --git a/src/FluentAssertions.Web/Internal/ContentProcessors/Appender.cs b/src/FluentAssertions.Web/Internal/ContentProcessors/Appender.cs index 929ef45..2151340 100644 --- a/src/FluentAssertions.Web/Internal/ContentProcessors/Appender.cs +++ b/src/FluentAssertions.Web/Internal/ContentProcessors/Appender.cs @@ -1,6 +1,10 @@ using System.Text; +#if AAV +namespace AwesomeAssertions.Web.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Internal.ContentProcessors; +#endif internal static class Appender { diff --git a/src/FluentAssertions.Web/Internal/ContentProcessors/BinaryProcessor.cs b/src/FluentAssertions.Web/Internal/ContentProcessors/BinaryProcessor.cs index 6c27286..df87e8e 100644 --- a/src/FluentAssertions.Web/Internal/ContentProcessors/BinaryProcessor.cs +++ b/src/FluentAssertions.Web/Internal/ContentProcessors/BinaryProcessor.cs @@ -1,6 +1,10 @@ using System.Text; +#if AAV +namespace AwesomeAssertions.Web.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Internal.ContentProcessors; +#endif internal class BinaryProcessor : ProcessorBase { diff --git a/src/FluentAssertions.Web/Internal/ContentProcessors/FallbackProcessor.cs b/src/FluentAssertions.Web/Internal/ContentProcessors/FallbackProcessor.cs index 2197bdf..6b844da 100644 --- a/src/FluentAssertions.Web/Internal/ContentProcessors/FallbackProcessor.cs +++ b/src/FluentAssertions.Web/Internal/ContentProcessors/FallbackProcessor.cs @@ -1,6 +1,10 @@ using System.Text; +#if AAV +namespace AwesomeAssertions.Web.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Internal.ContentProcessors; +#endif internal class FallbackProcessor : ProcessorBase { diff --git a/src/FluentAssertions.Web/Internal/ContentProcessors/IContentProcessor.cs b/src/FluentAssertions.Web/Internal/ContentProcessors/IContentProcessor.cs index 53567b4..899f987 100644 --- a/src/FluentAssertions.Web/Internal/ContentProcessors/IContentProcessor.cs +++ b/src/FluentAssertions.Web/Internal/ContentProcessors/IContentProcessor.cs @@ -1,6 +1,10 @@ using System.Text; +#if AAV +namespace AwesomeAssertions.Web.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Internal.ContentProcessors; +#endif internal interface IContentProcessor { diff --git a/src/FluentAssertions.Web/Internal/ContentProcessors/InternalServerErrorProcessor.cs b/src/FluentAssertions.Web/Internal/ContentProcessors/InternalServerErrorProcessor.cs index 1c6c813..4caabeb 100644 --- a/src/FluentAssertions.Web/Internal/ContentProcessors/InternalServerErrorProcessor.cs +++ b/src/FluentAssertions.Web/Internal/ContentProcessors/InternalServerErrorProcessor.cs @@ -1,6 +1,10 @@ using System.Text; +#if AAV +namespace AwesomeAssertions.Web.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Internal.ContentProcessors; +#endif internal class InternalServerErrorProcessor : ProcessorBase { diff --git a/src/FluentAssertions.Web/Internal/ContentProcessors/JsonProcessor.cs b/src/FluentAssertions.Web/Internal/ContentProcessors/JsonProcessor.cs index aa2e83a..732cd81 100644 --- a/src/FluentAssertions.Web/Internal/ContentProcessors/JsonProcessor.cs +++ b/src/FluentAssertions.Web/Internal/ContentProcessors/JsonProcessor.cs @@ -2,7 +2,11 @@ using System.Text.Encodings.Web; using System.Text.Unicode; +#if AAV +namespace AwesomeAssertions.Web.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Internal.ContentProcessors; +#endif internal class JsonProcessor : ProcessorBase { diff --git a/src/FluentAssertions.Web/Internal/ContentProcessors/MultipartProcessor.cs b/src/FluentAssertions.Web/Internal/ContentProcessors/MultipartProcessor.cs index a721ba1..e85ffb1 100644 --- a/src/FluentAssertions.Web/Internal/ContentProcessors/MultipartProcessor.cs +++ b/src/FluentAssertions.Web/Internal/ContentProcessors/MultipartProcessor.cs @@ -1,6 +1,10 @@ using System.Text; +#if AAV +namespace AwesomeAssertions.Web.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Internal.ContentProcessors; +#endif internal class MultipartProcessor : ProcessorBase { diff --git a/src/FluentAssertions.Web/Internal/ContentProcessors/ProcessorBase.cs b/src/FluentAssertions.Web/Internal/ContentProcessors/ProcessorBase.cs index f67e4ac..b664b9b 100644 --- a/src/FluentAssertions.Web/Internal/ContentProcessors/ProcessorBase.cs +++ b/src/FluentAssertions.Web/Internal/ContentProcessors/ProcessorBase.cs @@ -1,6 +1,10 @@ using System.Text; +#if AAV +namespace AwesomeAssertions.Web.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Internal.ContentProcessors; +#endif internal abstract class ProcessorBase : IContentProcessor { diff --git a/src/FluentAssertions.Web/Internal/ContentProcessors/ProcessorsRunner.cs b/src/FluentAssertions.Web/Internal/ContentProcessors/ProcessorsRunner.cs index 125a558..0907b1b 100644 --- a/src/FluentAssertions.Web/Internal/ContentProcessors/ProcessorsRunner.cs +++ b/src/FluentAssertions.Web/Internal/ContentProcessors/ProcessorsRunner.cs @@ -1,6 +1,10 @@ using System.Text; +#if AAV +namespace AwesomeAssertions.Web.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Internal.ContentProcessors; +#endif internal static class ProcessorsRunner { diff --git a/src/FluentAssertions.Web/Internal/Guard.cs b/src/FluentAssertions.Web/Internal/Guard.cs index 7b19163..c4877b9 100644 --- a/src/FluentAssertions.Web/Internal/Guard.cs +++ b/src/FluentAssertions.Web/Internal/Guard.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Internal; +#if AAV +namespace AwesomeAssertions.Web.Internal; +#else +namespace FluentAssertions.Web.Internal; +#endif internal static class Guard { diff --git a/src/FluentAssertions.Web/Internal/HttpContentExtensions.cs b/src/FluentAssertions.Web/Internal/HttpContentExtensions.cs index 7f4a144..67338f9 100644 --- a/src/FluentAssertions.Web/Internal/HttpContentExtensions.cs +++ b/src/FluentAssertions.Web/Internal/HttpContentExtensions.cs @@ -1,6 +1,10 @@ using System.Text; +#if AAV +namespace AwesomeAssertions.Web.Internal; +#else namespace FluentAssertions.Web.Internal; +#endif internal static class HttpContentExtensions { diff --git a/src/FluentAssertions.Web/Internal/HttpResponseMessageExtensions.cs b/src/FluentAssertions.Web/Internal/HttpResponseMessageExtensions.cs index d7f5c33..b170175 100644 --- a/src/FluentAssertions.Web/Internal/HttpResponseMessageExtensions.cs +++ b/src/FluentAssertions.Web/Internal/HttpResponseMessageExtensions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Internal; +#if AAV +namespace AwesomeAssertions.Web.Internal; +#else +namespace FluentAssertions.Web.Internal; +#endif internal static class HttpResponseMessageExtensions { diff --git a/src/FluentAssertions.Web/Internal/JsonExtensions.cs b/src/FluentAssertions.Web/Internal/JsonExtensions.cs index 27a6a05..abf0931 100644 --- a/src/FluentAssertions.Web/Internal/JsonExtensions.cs +++ b/src/FluentAssertions.Web/Internal/JsonExtensions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Internal; +#if AAV +namespace AwesomeAssertions.Web.Internal; +#else +namespace FluentAssertions.Web.Internal; +#endif internal static class JsonExtensions { diff --git a/src/FluentAssertions.Web/Internal/NoSynchronizationContextScope.cs b/src/FluentAssertions.Web/Internal/NoSynchronizationContextScope.cs index abcf1ab..8431af1 100644 --- a/src/FluentAssertions.Web/Internal/NoSynchronizationContextScope.cs +++ b/src/FluentAssertions.Web/Internal/NoSynchronizationContextScope.cs @@ -1,6 +1,10 @@ using System.Threading; +#if AAV +namespace AwesomeAssertions.Web.Internal; +#else namespace FluentAssertions.Web.Internal; +#endif internal static class NoSynchronizationContextScope { diff --git a/src/FluentAssertions.Web/Internal/ObjectExtensions.cs b/src/FluentAssertions.Web/Internal/ObjectExtensions.cs index e5abd94..3d37027 100644 --- a/src/FluentAssertions.Web/Internal/ObjectExtensions.cs +++ b/src/FluentAssertions.Web/Internal/ObjectExtensions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Internal; +#if AAV +namespace AwesomeAssertions.Web.Internal; +#else +namespace FluentAssertions.Web.Internal; +#endif internal static class ObjectExtensions { diff --git a/src/FluentAssertions.Web/Internal/StringExtensions.cs b/src/FluentAssertions.Web/Internal/StringExtensions.cs index 6eed275..a5ca4be 100644 --- a/src/FluentAssertions.Web/Internal/StringExtensions.cs +++ b/src/FluentAssertions.Web/Internal/StringExtensions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Internal; +#if AAV +namespace AwesomeAssertions.Web.Internal; +#else +namespace FluentAssertions.Web.Internal; +#endif internal static class StringExtensions { diff --git a/src/FluentAssertions.Web/Internal/TaskExtensions.cs b/src/FluentAssertions.Web/Internal/TaskExtensions.cs index 63bbf0d..deea8de 100644 --- a/src/FluentAssertions.Web/Internal/TaskExtensions.cs +++ b/src/FluentAssertions.Web/Internal/TaskExtensions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Internal; +#if AAV +namespace AwesomeAssertions.Web.Internal; +#else +namespace FluentAssertions.Web.Internal; +#endif /// /// Some unit test frameworks (like xUnit) have their own synchronization context diff --git a/src/FluentAssertions.Web/SatisfyHttpResponseMessageAssertions.cs b/src/FluentAssertions.Web/SatisfyHttpResponseMessageAssertions.cs index 0db346e..0840537 100644 --- a/src/FluentAssertions.Web/SatisfyHttpResponseMessageAssertions.cs +++ b/src/FluentAssertions.Web/SatisfyHttpResponseMessageAssertions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web; +#if AAV +namespace AwesomeAssertions.Web; +#else +namespace FluentAssertions.Web; +#endif public partial class HttpResponseMessageAssertions { diff --git a/src/FluentAssertions.Web/SatisfyModelAssertions.cs b/src/FluentAssertions.Web/SatisfyModelAssertions.cs index 7d32d62..9730875 100644 --- a/src/FluentAssertions.Web/SatisfyModelAssertions.cs +++ b/src/FluentAssertions.Web/SatisfyModelAssertions.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web; +#if AAV +namespace AwesomeAssertions.Web; +#else +namespace FluentAssertions.Web; +#endif public partial class HttpResponseMessageAssertions { diff --git a/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests.csproj b/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests.csproj new file mode 100644 index 0000000..b33bd52 --- /dev/null +++ b/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests.csproj @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + Always + + + + diff --git a/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/GlobalUsings.cs b/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/GlobalUsings.cs new file mode 100644 index 0000000..94d5252 --- /dev/null +++ b/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/GlobalUsings.cs @@ -0,0 +1,2 @@ +global using System; +global using Xunit; diff --git a/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/Serializers/NewtonsoftJsonSerializerTests.cs b/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/Serializers/NewtonsoftJsonSerializerTests.cs new file mode 100644 index 0000000..410be59 --- /dev/null +++ b/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/Serializers/NewtonsoftJsonSerializerTests.cs @@ -0,0 +1,29 @@ +namespace AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests.Serializers; + +[Collection("Serializers Tests")] +public sealed class NewtonsoftJsonSerializerTests : IDisposable +{ + private readonly ISerializer _initialSerializer; + public NewtonsoftJsonSerializerTests() + { + _initialSerializer = AwesomeAssertions.AwesomeAssertionsWebConfig.Serializer; + } + [Fact] + public void Serializer_Can_Be_Set_To_NewtonsoftJsonDeserializer() + { + AwesomeAssertions.AwesomeAssertionsWebConfig.Serializer = new NewtonsoftJsonSerializer(); + + AwesomeAssertions.AwesomeAssertionsWebConfig.Serializer.Should().BeOfType(); + } + + [Fact] + public void Options_Is_Not_Null() + { + NewtonsoftJsonSerializerConfig.Options.Should().NotBeNull(); + } + + public void Dispose() + { + AwesomeAssertions.AwesomeAssertionsWebConfig.Serializer = _initialSerializer; + } +} diff --git a/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/Serializers/SystemTextJsonSerializerTests.cs b/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/Serializers/SystemTextJsonSerializerTests.cs new file mode 100644 index 0000000..9b0291d --- /dev/null +++ b/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/Serializers/SystemTextJsonSerializerTests.cs @@ -0,0 +1,19 @@ +using AwesomeAssertions.Web.Internal.Serializers; + +namespace AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests.Serializers; + +[Collection("Serializers Tests")] +public class SystemTextJsonSerializerTests +{ + [Fact] + public void DefaultSerializer_IsOfSystemTextJsonSerializer_Type() + { + AwesomeAssertions.AwesomeAssertionsWebConfig.Serializer.Should().BeOfType(); + } + + [Fact] + public void Options_Is_Not_Null() + { + SystemTextJsonSerializerConfig.Options.Should().NotBeNull(); + } +} diff --git a/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/xunit.runner.json b/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/xunit.runner.json new file mode 100644 index 0000000..edb2321 --- /dev/null +++ b/test/AwesomeAssertions.Web.AwesomeAssertionsWebConfig.Tests/xunit.runner.json @@ -0,0 +1,3 @@ +{ + "parallelizeTestCollections": false +} \ No newline at end of file diff --git a/test/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests.csproj b/test/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests.csproj new file mode 100644 index 0000000..51d83a3 --- /dev/null +++ b/test/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests.csproj @@ -0,0 +1,24 @@ + + + + $(DefineConstants);FAV8;AAV + + + + + + + + + + + + + + + + %(RecursiveDir)%(Filename)%(Extension) + + + + diff --git a/test/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests/ConfigureAwesomeAssertionsWebFixture.cs b/test/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests/ConfigureAwesomeAssertionsWebFixture.cs new file mode 100644 index 0000000..e3cd6b7 --- /dev/null +++ b/test/AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests/ConfigureAwesomeAssertionsWebFixture.cs @@ -0,0 +1,12 @@ +[assembly: Xunit.TestFramework("AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests.ConfigureFluentAssertionsWebFixture", "AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests")] +namespace AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests; + +public class ConfigureFluentAssertionsWebFixture : XunitTestFramework +{ + public ConfigureFluentAssertionsWebFixture(IMessageSink messageSink) : base(messageSink) + { + NewtonsoftJsonSerializerConfig.Options.Converters.Add(new YesNoBooleanJsonConverter()); + + AwesomeAssertionsWebConfig.Serializer = new NewtonsoftJsonSerializer(); + } +} diff --git a/test/AwesomeAssertions.Web.Tests/AwesomeAssertions.Web.Tests.csproj b/test/AwesomeAssertions.Web.Tests/AwesomeAssertions.Web.Tests.csproj new file mode 100644 index 0000000..cc287ce --- /dev/null +++ b/test/AwesomeAssertions.Web.Tests/AwesomeAssertions.Web.Tests.csproj @@ -0,0 +1,24 @@ + + + + $(DefineConstants);FAV8;AAV + + + + + + + + + + + + + + + + %(RecursiveDir)%(Filename)%(Extension) + + + + diff --git a/test/AwesomeAssertions.Web.Tests/GlobalUsings.cs b/test/AwesomeAssertions.Web.Tests/GlobalUsings.cs new file mode 100644 index 0000000..6a4f445 --- /dev/null +++ b/test/AwesomeAssertions.Web.Tests/GlobalUsings.cs @@ -0,0 +1,16 @@ +global using AwesomeAssertions.Equivalency; +global using AwesomeAssertions.Execution; +global using AwesomeAssertions.Web.Internal; +global using AwesomeAssertions.Web.Internal.Serializers; +global using System; +global using System.Collections.Generic; +global using System.IO; +global using System.Linq; +global using System.Net; +global using System.Net.Http.Headers; +global using System.Net.Http; +global using System.Text; +global using System.Text.Json; +global using System.Threading.Tasks; +global using Xunit; +global using Xunit.Sdk; diff --git a/test/Directory.Build.props b/test/Directory.Build.props index dfc8e90..8dad70a 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -12,7 +12,6 @@ - diff --git a/test/FluentAssertions.Web.FluentAssertionsWebConfig.Tests/FluentAssertions.Web.FluentAssertionsWebConfig.Tests.csproj b/test/FluentAssertions.Web.FluentAssertionsWebConfig.Tests/FluentAssertions.Web.FluentAssertionsWebConfig.Tests.csproj index 712f4cd..0a20dfd 100644 --- a/test/FluentAssertions.Web.FluentAssertionsWebConfig.Tests/FluentAssertions.Web.FluentAssertionsWebConfig.Tests.csproj +++ b/test/FluentAssertions.Web.FluentAssertionsWebConfig.Tests/FluentAssertions.Web.FluentAssertionsWebConfig.Tests.csproj @@ -2,6 +2,7 @@ + diff --git a/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/ConfigureFluentAssertionsWebFixture.cs b/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/ConfigureFluentAssertionsWebFixture.cs new file mode 100644 index 0000000..a7442df --- /dev/null +++ b/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/ConfigureFluentAssertionsWebFixture.cs @@ -0,0 +1,12 @@ +[assembly: Xunit.TestFramework("FluentAssertions.Web.Serializers.NewtonsoftJson.Tests.ConfigureFluentAssertionsWebFixture", "FluentAssertions.Web.Serializers.NewtonsoftJson.Tests")] +namespace FluentAssertions.Web.Serializers.NewtonsoftJson.Tests; + +public class ConfigureFluentAssertionsWebFixture : XunitTestFramework +{ + public ConfigureFluentAssertionsWebFixture(IMessageSink messageSink) : base(messageSink) + { + NewtonsoftJsonSerializerConfig.Options.Converters.Add(new YesNoBooleanJsonConverter()); + + FluentAssertionsWebConfig.Serializer = new NewtonsoftJsonSerializer(); + } +} diff --git a/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests.csproj b/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests.csproj index 199deb2..1615c98 100644 --- a/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests.csproj +++ b/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests.csproj @@ -2,6 +2,7 @@ + diff --git a/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/NewtonsoftSerializerTests.cs b/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/NewtonsoftSerializerTests.cs index 2cd2c1b..bbaefea 100644 --- a/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/NewtonsoftSerializerTests.cs +++ b/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/NewtonsoftSerializerTests.cs @@ -1,16 +1,8 @@ -[assembly: Xunit.TestFramework("FluentAssertions.Web.Serializers.NewtonsoftJson.Tests.ConfigureFluentAssertionsWebFixture", "FluentAssertions.Web.Serializers.NewtonsoftJson.Tests")] - +#if AAV +namespace AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests; +#else namespace FluentAssertions.Web.Serializers.NewtonsoftJson.Tests; - -public class ConfigureFluentAssertionsWebFixture : XunitTestFramework -{ - public ConfigureFluentAssertionsWebFixture(IMessageSink messageSink) : base(messageSink) - { - NewtonsoftJsonSerializerConfig.Options.Converters.Add(new YesNoBooleanJsonConverter()); - - FluentAssertionsWebConfig.Serializer = new NewtonsoftJsonSerializer(); - } -} +#endif public class NewtonsoftSerializerTests { diff --git a/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/YesNoBooleanJsonConverter.cs b/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/YesNoBooleanJsonConverter.cs index 028cd46..6d3b7b9 100644 --- a/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/YesNoBooleanJsonConverter.cs +++ b/test/FluentAssertions.Web.Serializers.NewtonsoftJson.Tests/YesNoBooleanJsonConverter.cs @@ -1,6 +1,10 @@ using Newtonsoft.Json; +#if AAV +namespace AwesomeAssertions.Web.Serializers.NewtonsoftJson.Tests; +#else namespace FluentAssertions.Web.Serializers.NewtonsoftJson.Tests; +#endif public class YesNoBooleanJsonConverter : JsonConverter { diff --git a/test/FluentAssertions.Web.Tests/BadRequestAssertionsSpecs.cs b/test/FluentAssertions.Web.Tests/BadRequestAssertionsSpecs.cs index b334000..efde887 100644 --- a/test/FluentAssertions.Web.Tests/BadRequestAssertionsSpecs.cs +++ b/test/FluentAssertions.Web.Tests/BadRequestAssertionsSpecs.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Tests; +#if AAV +namespace AwesomeAssertions.Web.Tests; +#else +namespace FluentAssertions.Web.Tests; +#endif public class BadRequestAssertionsSpecs { diff --git a/test/FluentAssertions.Web.Tests/DeserializationExceptionTests.cs b/test/FluentAssertions.Web.Tests/DeserializationExceptionTests.cs index e1aa93d..911993d 100644 --- a/test/FluentAssertions.Web.Tests/DeserializationExceptionTests.cs +++ b/test/FluentAssertions.Web.Tests/DeserializationExceptionTests.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Tests; +#if AAV +namespace AwesomeAssertions.Web.Tests; +#else +namespace FluentAssertions.Web.Tests; +#endif public class DeserializationExceptionTests { diff --git a/test/FluentAssertions.Web.Tests/FluentAssertions.Web.Tests.csproj b/test/FluentAssertions.Web.Tests/FluentAssertions.Web.Tests.csproj index 340a883..4ba1473 100644 --- a/test/FluentAssertions.Web.Tests/FluentAssertions.Web.Tests.csproj +++ b/test/FluentAssertions.Web.Tests/FluentAssertions.Web.Tests.csproj @@ -2,6 +2,7 @@ + diff --git a/test/FluentAssertions.Web.Tests/HeadersAssertionsSpecs.cs b/test/FluentAssertions.Web.Tests/HeadersAssertionsSpecs.cs index 0d78619..bb07268 100644 --- a/test/FluentAssertions.Web.Tests/HeadersAssertionsSpecs.cs +++ b/test/FluentAssertions.Web.Tests/HeadersAssertionsSpecs.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Tests; +#if AAV +namespace AwesomeAssertions.Web.Tests; +#else +namespace FluentAssertions.Web.Tests; +#endif public class HeadersAssertionsSpecs { diff --git a/test/FluentAssertions.Web.Tests/HttpResponseContentAssertionsSpecs.cs b/test/FluentAssertions.Web.Tests/HttpResponseContentAssertionsSpecs.cs index d4b58b8..31e0ab0 100644 --- a/test/FluentAssertions.Web.Tests/HttpResponseContentAssertionsSpecs.cs +++ b/test/FluentAssertions.Web.Tests/HttpResponseContentAssertionsSpecs.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Tests; +#if AAV +namespace AwesomeAssertions.Web.Tests; +#else +namespace FluentAssertions.Web.Tests; +#endif public class HttpResponseContentAssertionsSpecs { diff --git a/test/FluentAssertions.Web.Tests/HttpResponseMessageFormatterSpecs.cs b/test/FluentAssertions.Web.Tests/HttpResponseMessageFormatterSpecs.cs index 3ac9b12..e44aa8f 100644 --- a/test/FluentAssertions.Web.Tests/HttpResponseMessageFormatterSpecs.cs +++ b/test/FluentAssertions.Web.Tests/HttpResponseMessageFormatterSpecs.cs @@ -1,6 +1,15 @@ +#if AAV +using AwesomeAssertions.Formatting; +#else using FluentAssertions.Formatting; +#endif + +#if AAV +namespace AwesomeAssertions.Web.Tests; +#else namespace FluentAssertions.Web.Tests; +#endif public class HttpResponseMessageFormatterSpecs { diff --git a/test/FluentAssertions.Web.Tests/HttpStatusCodeAssertionsSpecs.cs b/test/FluentAssertions.Web.Tests/HttpStatusCodeAssertionsSpecs.cs index 6b338db..4e7683f 100644 --- a/test/FluentAssertions.Web.Tests/HttpStatusCodeAssertionsSpecs.cs +++ b/test/FluentAssertions.Web.Tests/HttpStatusCodeAssertionsSpecs.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Tests; +#if AAV +namespace AwesomeAssertions.Web.Tests; +#else +namespace FluentAssertions.Web.Tests; +#endif public class HttpStatusCodeAssertionsSpecs { diff --git a/test/FluentAssertions.Web.Tests/Internal/ApiAccessibilityTests.cs b/test/FluentAssertions.Web.Tests/Internal/ApiAccessibilityTests.cs index 838e228..d14a2c5 100644 --- a/test/FluentAssertions.Web.Tests/Internal/ApiAccessibilityTests.cs +++ b/test/FluentAssertions.Web.Tests/Internal/ApiAccessibilityTests.cs @@ -1,7 +1,15 @@ -using FluentAssertions.Primitives; +#if AAV +using AwesomeAssertions.Primitives; +#else +using FluentAssertions.Primitives; +#endif using System.Reflection; +#if AAV +namespace AwesomeAssertions.Web.Tests.Internal; +#else namespace FluentAssertions.Web.Tests.Internal; +#endif public class ApiAccessibilityTests { @@ -22,18 +30,27 @@ public void GivenTypesFromTheInternalNamespace_ThenShouldBeInternalOrLessThanInt } [Fact] +#if AAV + public void GivenAssertionsExtensions_ThenShouldHaveAwesomeAssertionsNamespaceOnly() +#else public void GivenAssertionsExtensions_ThenShouldHaveFluentAssertionsNamespaceOnly() +#endif { // Arrange var assertionsExtensionsTypes = typeof(HttpResponseMessageAssertions).Assembly .GetTypes() .Where(c => c.Name.EndsWith("AssertionsExtensions")); +#if AAV + var expectedNamespace = "AwesomeAssertions"; +#else + var expectedNamespace = "FluentAssertions"; +#endif // Assert using (new AssertionScope()) foreach (var type in assertionsExtensionsTypes) { - type.Namespace.Should().Be("FluentAssertions", "because we want to make sure {0} has the FluentAssertions namespace", type.Name); + type.Namespace.Should().Be(expectedNamespace, $"because we want to make sure {{0}} has the {expectedNamespace} namespace", type.Name); } } @@ -75,9 +92,15 @@ public void Each_HttpResponseMessage_Assertion_Extension_Should_Be_In_The_Fluent .Where(c => c.Name.EndsWith("AssertionsExtensions")) .ToList(); +#if AAV + var expectedNamespace = "AwesomeAssertions"; +#else + var expectedNamespace = "FluentAssertions"; +#endif + // Assert httpResponseMessageAssertionsExtensionsTypes - .Should().OnlyContain(type => type.Namespace == "FluentAssertions"); + .Should().OnlyContain(type => type.Namespace == expectedNamespace); } #if !FAV8 diff --git a/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/FallbackProcessorTests.cs b/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/FallbackProcessorTests.cs index c485074..b359caa 100644 --- a/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/FallbackProcessorTests.cs +++ b/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/FallbackProcessorTests.cs @@ -1,6 +1,14 @@ -using FluentAssertions.Web.Internal.ContentProcessors; - +#if AAV +using AwesomeAssertions.Web.Internal.ContentProcessors; +#else +using FluentAssertions.Web.Internal.ContentProcessors; +#endif + +#if AAV +namespace AwesomeAssertions.Web.Tests.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Tests.Internal.ContentProcessors; +#endif public class FallbackProcessorTests { diff --git a/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/InternalServerErrorProcessorTests.cs b/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/InternalServerErrorProcessorTests.cs index f82af85..6b967ec 100644 --- a/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/InternalServerErrorProcessorTests.cs +++ b/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/InternalServerErrorProcessorTests.cs @@ -1,6 +1,14 @@ -using FluentAssertions.Web.Internal.ContentProcessors; - +#if AAV +using AwesomeAssertions.Web.Internal.ContentProcessors; +#else +using FluentAssertions.Web.Internal.ContentProcessors; +#endif + +#if AAV +namespace AwesomeAssertions.Web.Tests.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Tests.Internal.ContentProcessors; +#endif public class InternalServerErrorProcessorTests { diff --git a/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/JsonProcessorTests.cs b/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/JsonProcessorTests.cs index 3622026..15618c5 100644 --- a/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/JsonProcessorTests.cs +++ b/test/FluentAssertions.Web.Tests/Internal/ContentProcessors/JsonProcessorTests.cs @@ -1,6 +1,14 @@ -using FluentAssertions.Web.Internal.ContentProcessors; - +#if AAV +using AwesomeAssertions.Web.Internal.ContentProcessors; +#else +using FluentAssertions.Web.Internal.ContentProcessors; +#endif + +#if AAV +namespace AwesomeAssertions.Web.Tests.Internal.ContentProcessors; +#else namespace FluentAssertions.Web.Tests.Internal.ContentProcessors; +#endif public class JsonProcessorTests { diff --git a/test/FluentAssertions.Web.Tests/Internal/HttpContentExtensionsTests.cs b/test/FluentAssertions.Web.Tests/Internal/HttpContentExtensionsTests.cs index 37e7f89..5cae7d9 100644 --- a/test/FluentAssertions.Web.Tests/Internal/HttpContentExtensionsTests.cs +++ b/test/FluentAssertions.Web.Tests/Internal/HttpContentExtensionsTests.cs @@ -1,6 +1,14 @@ -using FluentAssertions.Web.Tests.TestModels; - +#if AAV +using AwesomeAssertions.Web.Tests.TestModels; +#else +using FluentAssertions.Web.Tests.TestModels; +#endif + +#if AAV +namespace AwesomeAssertions.Web.Tests.Internal; +#else namespace FluentAssertions.Web.Tests.Internal; +#endif public class HttpContentExtensionsTests { diff --git a/test/FluentAssertions.Web.Tests/Internal/JsonExtensionsTests.cs b/test/FluentAssertions.Web.Tests/Internal/JsonExtensionsTests.cs index 0765727..b36d523 100644 --- a/test/FluentAssertions.Web.Tests/Internal/JsonExtensionsTests.cs +++ b/test/FluentAssertions.Web.Tests/Internal/JsonExtensionsTests.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Tests.Internal; +#if AAV +namespace AwesomeAssertions.Web.Tests.Internal; +#else +namespace FluentAssertions.Web.Tests.Internal; +#endif public class JsonExtensionsTests { diff --git a/test/FluentAssertions.Web.Tests/SatisfyHttpResponseMessageAssertionsAsyncSpecs.cs b/test/FluentAssertions.Web.Tests/SatisfyHttpResponseMessageAssertionsAsyncSpecs.cs index 888e53a..5b54351 100644 --- a/test/FluentAssertions.Web.Tests/SatisfyHttpResponseMessageAssertionsAsyncSpecs.cs +++ b/test/FluentAssertions.Web.Tests/SatisfyHttpResponseMessageAssertionsAsyncSpecs.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Tests; +#if AAV +namespace AwesomeAssertions.Web.Tests; +#else +namespace FluentAssertions.Web.Tests; +#endif public class SatisfyHttpResponseMessageAssertionsAsyncSpecs { diff --git a/test/FluentAssertions.Web.Tests/SatisfyHttpResponseMessageAssertionsSpecs.cs b/test/FluentAssertions.Web.Tests/SatisfyHttpResponseMessageAssertionsSpecs.cs index c27bc3c..61838fa 100644 --- a/test/FluentAssertions.Web.Tests/SatisfyHttpResponseMessageAssertionsSpecs.cs +++ b/test/FluentAssertions.Web.Tests/SatisfyHttpResponseMessageAssertionsSpecs.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Tests; +#if AAV +namespace AwesomeAssertions.Web.Tests; +#else +namespace FluentAssertions.Web.Tests; +#endif public class SatisfyHttpResponseMessageAssertionsSpecs { diff --git a/test/FluentAssertions.Web.Tests/SatisfyModelAssertionsAsyncSpecs.cs b/test/FluentAssertions.Web.Tests/SatisfyModelAssertionsAsyncSpecs.cs index 198533b..42fe1bf 100644 --- a/test/FluentAssertions.Web.Tests/SatisfyModelAssertionsAsyncSpecs.cs +++ b/test/FluentAssertions.Web.Tests/SatisfyModelAssertionsAsyncSpecs.cs @@ -1,6 +1,14 @@ -using FluentAssertions.Web.Tests.TestModels; - +#if AAV +using AwesomeAssertions.Web.Tests.TestModels; +#else +using FluentAssertions.Web.Tests.TestModels; +#endif + +#if AAV +namespace AwesomeAssertions.Web.Tests; +#else namespace FluentAssertions.Web.Tests; +#endif public class SatisfyModelAssertionsAsyncSpecs { diff --git a/test/FluentAssertions.Web.Tests/SatisfyModelAssertionsSpecs.cs b/test/FluentAssertions.Web.Tests/SatisfyModelAssertionsSpecs.cs index 26961f2..ffd549e 100644 --- a/test/FluentAssertions.Web.Tests/SatisfyModelAssertionsSpecs.cs +++ b/test/FluentAssertions.Web.Tests/SatisfyModelAssertionsSpecs.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Tests; +#if AAV +namespace AwesomeAssertions.Web.Tests; +#else +namespace FluentAssertions.Web.Tests; +#endif public class SatisfyModelAssertionsSpecs { diff --git a/test/FluentAssertions.Web.Tests/TestModels/TestEnum.cs b/test/FluentAssertions.Web.Tests/TestModels/TestEnum.cs index d07a600..d72b582 100644 --- a/test/FluentAssertions.Web.Tests/TestModels/TestEnum.cs +++ b/test/FluentAssertions.Web.Tests/TestModels/TestEnum.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Tests.TestModels; +#if AAV +namespace AwesomeAssertions.Web.Tests.TestModels; +#else +namespace FluentAssertions.Web.Tests.TestModels; +#endif internal enum TestEnum { diff --git a/test/FluentAssertions.Web.Tests/TestModels/TestModel.cs b/test/FluentAssertions.Web.Tests/TestModels/TestModel.cs index 7445e39..d02a397 100644 --- a/test/FluentAssertions.Web.Tests/TestModels/TestModel.cs +++ b/test/FluentAssertions.Web.Tests/TestModels/TestModel.cs @@ -1,4 +1,8 @@ -namespace FluentAssertions.Web.Tests.TestModels; +#if AAV +namespace AwesomeAssertions.Web.Tests.TestModels; +#else +namespace FluentAssertions.Web.Tests.TestModels; +#endif internal class TestModel { diff --git a/test/FluentAssertions.Web.v8.Tests/FluentAssertions.Web.v8.Tests.csproj b/test/FluentAssertions.Web.v8.Tests/FluentAssertions.Web.v8.Tests.csproj index 2203747..856c966 100644 --- a/test/FluentAssertions.Web.v8.Tests/FluentAssertions.Web.v8.Tests.csproj +++ b/test/FluentAssertions.Web.v8.Tests/FluentAssertions.Web.v8.Tests.csproj @@ -6,6 +6,7 @@ + diff --git a/test/Sample.Api.AwesomeAssertions.Tests/Sample.Api.AwesomeAssertions.Tests.csproj b/test/Sample.Api.AwesomeAssertions.Tests/Sample.Api.AwesomeAssertions.Tests.csproj new file mode 100644 index 0000000..44f4ae6 --- /dev/null +++ b/test/Sample.Api.AwesomeAssertions.Tests/Sample.Api.AwesomeAssertions.Tests.csproj @@ -0,0 +1,35 @@ + + + + net8.0;net9.0 + $(DefineConstants);FAV8;AAV + + + + + + + + + + + + + + + + + + + + + + + + + %(RecursiveDir)%(Filename)%(Extension) + PreserveNewest + + + + diff --git a/test/Sample.Api.Tests/CommentsControllerTests.cs b/test/Sample.Api.Tests/CommentsControllerTests.cs index 3b14267..07ba33f 100644 --- a/test/Sample.Api.Tests/CommentsControllerTests.cs +++ b/test/Sample.Api.Tests/CommentsControllerTests.cs @@ -1,4 +1,8 @@ +#if AAV +using AwesomeAssertions; +#else using FluentAssertions; +#endif using Microsoft.AspNetCore.Mvc.Testing; using Sample.Api.Controllers; using System.Collections.Generic; diff --git a/test/Sample.Api.Tests/CustomStartupConfigurationsTests.cs b/test/Sample.Api.Tests/CustomStartupConfigurationsTests.cs index 12af530..c855ee5 100644 --- a/test/Sample.Api.Tests/CustomStartupConfigurationsTests.cs +++ b/test/Sample.Api.Tests/CustomStartupConfigurationsTests.cs @@ -1,4 +1,8 @@ -using FluentAssertions; +#if AAV +using AwesomeAssertions; +#else +using FluentAssertions; +#endif using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.TestHost; diff --git a/test/Sample.Api.Tests/FilesControllerTests.cs b/test/Sample.Api.Tests/FilesControllerTests.cs index 45a27ed..5ad194e 100644 --- a/test/Sample.Api.Tests/FilesControllerTests.cs +++ b/test/Sample.Api.Tests/FilesControllerTests.cs @@ -1,4 +1,8 @@ -using FluentAssertions; +#if AAV +using AwesomeAssertions; +#else +using FluentAssertions; +#endif using Microsoft.AspNetCore.Mvc.Testing; using System.Threading.Tasks; using Xunit; diff --git a/test/Sample.Api.Tests/Sample.Api.Tests.csproj b/test/Sample.Api.Tests/Sample.Api.Tests.csproj index 5e3eb61..f5fade0 100644 --- a/test/Sample.Api.Tests/Sample.Api.Tests.csproj +++ b/test/Sample.Api.Tests/Sample.Api.Tests.csproj @@ -4,6 +4,10 @@ net8.0;net9.0 + + + + diff --git a/test/Sample.Api.Tests/ValuesControllerTests.cs b/test/Sample.Api.Tests/ValuesControllerTests.cs index e59b434..c3f1600 100644 --- a/test/Sample.Api.Tests/ValuesControllerTests.cs +++ b/test/Sample.Api.Tests/ValuesControllerTests.cs @@ -1,4 +1,8 @@ +#if AAV +using AwesomeAssertions; +#else using FluentAssertions; +#endif using Microsoft.AspNetCore.Mvc.Testing; using System.Net.Http; using System.Net.Http.Headers; diff --git a/test/Sample.Api.v8.Tests/Sample.Api.v8.Tests.csproj b/test/Sample.Api.v8.Tests/Sample.Api.v8.Tests.csproj index 81d90e8..bdfcb75 100644 --- a/test/Sample.Api.v8.Tests/Sample.Api.v8.Tests.csproj +++ b/test/Sample.Api.v8.Tests/Sample.Api.v8.Tests.csproj @@ -7,6 +7,7 @@ + From f98903c70b586acd469b43b3b57d251b910d40b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Sm=C3=B3=C5=82ka?= Date: Mon, 9 Jun 2025 14:03:46 +0200 Subject: [PATCH 2/2] Fix PR comments --- src/AwesomeAssertions.Web/AwesomeAssertions.Web.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/AwesomeAssertions.Web/AwesomeAssertions.Web.csproj b/src/AwesomeAssertions.Web/AwesomeAssertions.Web.csproj index 3e76859..6f02c9c 100644 --- a/src/AwesomeAssertions.Web/AwesomeAssertions.Web.csproj +++ b/src/AwesomeAssertions.Web/AwesomeAssertions.Web.csproj @@ -4,7 +4,6 @@ This is a AwesomeAssertions extension over the HttpResponseMessage object. It provides specific assertions and outputs rich erros messages that include the HTTP Request and Response. - This version depends on the commercial version of the FluentAssertions library (>= 8.0.0). readme.md