diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50b5f0f6cf..24a2d8e43a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,9 +57,9 @@ jobs: run: dotnet build --configuration Release - name: Core Tests run: | - dotnet test tests/Paramore.Brighter.Core.Tests/Paramore.Brighter.Core.Tests.csproj --filter "Fragile!=CI" -c Release --logger GitHubActions --no-restore --no-build --verbosity d - dotnet test tests/Paramore.Brighter.Extensions.Tests/Paramore.Brighter.Extensions.Tests.csproj -c Release --no-restore --logger GitHubActions --no-build --verbosity d - dotnet test tests/Paramore.Brighter.Transforms.Adaptors.Tests/Paramore.Brighter.Transforms.Adaptors.Tests.csproj -c Release --no-restore --logger GitHubActions --no-build --verbosity d + dotnet test tests/Paramore.Brighter.Core.Tests/Paramore.Brighter.Core.Tests.csproj --filter "Fragile!=CI" -c Release --logger GitHubActions --no-restore --no-build + dotnet test tests/Paramore.Brighter.Extensions.Tests/Paramore.Brighter.Extensions.Tests.csproj -c Release --no-restore --logger GitHubActions --no-build + dotnet test tests/Paramore.Brighter.Transforms.Adaptors.Tests/Paramore.Brighter.Transforms.Adaptors.Tests.csproj -c Release --no-restore --logger GitHubActions --no-build - name: Upload packages as artifacts uses: actions/upload-artifact@v4 @@ -101,7 +101,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: In Memory Transport Tests - run: dotnet test ./tests/Paramore.Brighter.InMemory.Tests/Paramore.Brighter.InMemory.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.InMemory.Tests/Paramore.Brighter.InMemory.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions hangfire: runs-on: ubuntu-latest @@ -119,7 +119,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: Hangfire Tests - run: dotnet test ./tests/Paramore.Brighter.Hangfire.Tests/Paramore.Brighter.Hangfire.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.Hangfire.Tests/Paramore.Brighter.Hangfire.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions quartz: runs-on: ubuntu-latest @@ -137,7 +137,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: Quartz Tests - run: dotnet test ./tests/Paramore.Brighter.Quartz.Tests/Paramore.Brighter.Quartz.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.Quartz.Tests/Paramore.Brighter.Quartz.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions redis-ci: runs-on: ubuntu-latest @@ -166,7 +166,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: Redis Transport Tests - run: dotnet test ./tests/Paramore.Brighter.Redis.Tests/Paramore.Brighter.Redis.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.Redis.Tests/Paramore.Brighter.Redis.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions mqtt-ci: runs-on: ubuntu-latest @@ -191,7 +191,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: MQTT Transport Tests - run: dotnet test ./tests/Paramore.Brighter.MQTT.Tests/Paramore.Brighter.MQTT.Tests.csproj --filter "Category=MQTT&Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.MQTT.Tests/Paramore.Brighter.MQTT.Tests.csproj --filter "Category=MQTT&Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions rabbitmq-ci: runs-on: ubuntu-latest @@ -221,9 +221,9 @@ jobs: - name: Install dependencies run: dotnet restore - name: RMQ Async Transport Tests - run: dotnet test ./tests/Paramore.Brighter.RMQ.Async.Tests/Paramore.Brighter.RMQ.Async.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.RMQ.Async.Tests/Paramore.Brighter.RMQ.Async.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions - name: RMQ Sync Transport Tests - run: dotnet test ./tests/Paramore.Brighter.RMQ.Sync.Tests/Paramore.Brighter.RMQ.Sync.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.RMQ.Sync.Tests/Paramore.Brighter.RMQ.Sync.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions kafka-ci: runs-on: ubuntu-latest @@ -286,7 +286,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: Kafka Transport Tests - run: dotnet test ./tests/Paramore.Brighter.Kafka.Tests/Paramore.Brighter.Kafka.Tests.csproj --filter "Category=Kafka&Category!=Confluent&Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.Kafka.Tests/Paramore.Brighter.Kafka.Tests.csproj --filter "Category=Kafka&Category!=Confluent&Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions postgres-ci: runs-on: ubuntu-latest @@ -316,7 +316,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: Postgres Tests - run: dotnet test ./tests/Paramore.Brighter.PostgresSQL.Tests/Paramore.Brighter.PostgresSQL.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.PostgresSQL.Tests/Paramore.Brighter.PostgresSQL.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions sqlserver-ci: runs-on: ubuntu-latest @@ -342,7 +342,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: MSSQL Tests - run: dotnet test ./tests/Paramore.Brighter.MSSQL.Tests/Paramore.Brighter.MSSQL.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.MSSQL.Tests/Paramore.Brighter.MSSQL.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions mysql-ci: runs-on: ubuntu-latest @@ -377,7 +377,7 @@ jobs: sleep 1 done - name: MySQL Tests - run: dotnet test ./tests/Paramore.Brighter.MySQL.Tests/Paramore.Brighter.MySQL.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.MySQL.Tests/Paramore.Brighter.MySQL.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions dynamo-ci: runs-on: ubuntu-latest @@ -402,8 +402,8 @@ jobs: run: dotnet restore - name: DynamoDB Tests run: | - dotnet test ./tests/Paramore.Brighter.DynamoDB.Tests/Paramore.Brighter.DynamoDB.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n - dotnet test ./tests/Paramore.Brighter.DynamoDB.V4.Tests/Paramore.Brighter.DynamoDB.V4.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + dotnet test ./tests/Paramore.Brighter.DynamoDB.Tests/Paramore.Brighter.DynamoDB.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions + dotnet test ./tests/Paramore.Brighter.DynamoDB.V4.Tests/Paramore.Brighter.DynamoDB.V4.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions localstack-ci: runs-on: ubuntu-latest @@ -440,8 +440,8 @@ jobs: Linux-nuget- - name: AWS Tests run: | - dotnet test ./tests/Paramore.Brighter.AWS.Tests/Paramore.Brighter.AWS.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n - dotnet test ./tests/Paramore.Brighter.AWS.V4.Tests/Paramore.Brighter.AWS.V4.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + dotnet test ./tests/Paramore.Brighter.AWS.Tests/Paramore.Brighter.AWS.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions + dotnet test ./tests/Paramore.Brighter.AWS.V4.Tests/Paramore.Brighter.AWS.V4.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions aws-ci: runs-on: ubuntu-latest @@ -474,8 +474,8 @@ jobs: aws-region: eu-west-1 - name: AWS SNS, SQS and S3 Tests run: | - dotnet test ./tests/Paramore.Brighter.AWS.Tests/Paramore.Brighter.AWS.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n - dotnet test ./tests/Paramore.Brighter.AWS.V4.Tests/Paramore.Brighter.AWS.V4.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + dotnet test ./tests/Paramore.Brighter.AWS.Tests/Paramore.Brighter.AWS.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions + dotnet test ./tests/Paramore.Brighter.AWS.V4.Tests/Paramore.Brighter.AWS.V4.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions aws-scheduler-ci: runs-on: ubuntu-latest @@ -508,8 +508,8 @@ jobs: aws-region: eu-west-1 - name: Scheduler Tests run: | - dotnet test ./tests/Paramore.Brighter.AWSScheduler.Tests/Paramore.Brighter.AWSScheduler.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n - dotnet test ./tests/Paramore.Brighter.AWSScheduler.V4.Tests/Paramore.Brighter.AWSScheduler.V4.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + dotnet test ./tests/Paramore.Brighter.AWSScheduler.Tests/Paramore.Brighter.AWSScheduler.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions + dotnet test ./tests/Paramore.Brighter.AWSScheduler.V4.Tests/Paramore.Brighter.AWSScheduler.V4.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions sqlite-ci: runs-on: ubuntu-latest @@ -527,7 +527,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: Sqlite Tests - run: dotnet test ./tests/Paramore.Brighter.Sqlite.Tests/Paramore.Brighter.Sqlite.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.Sqlite.Tests/Paramore.Brighter.Sqlite.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions azure-ci: runs-on: ubuntu-latest @@ -544,7 +544,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: Azure Tests - run: dotnet test ./tests/Paramore.Brighter.AzureServiceBus.Tests/Paramore.Brighter.AzureServiceBus.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.AzureServiceBus.Tests/Paramore.Brighter.AzureServiceBus.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions mongodb-ci: runs-on: ubuntu-latest @@ -576,7 +576,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: MongoDB Tests - run: dotnet test ./tests/Paramore.Brighter.MongoDb.Tests/Paramore.Brighter.MongoDb.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.MongoDb.Tests/Paramore.Brighter.MongoDb.Tests.csproj --filter "Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions gcp-ci: runs-on: ubuntu-latest @@ -613,7 +613,7 @@ jobs: run: dotnet restore - name: GCP Tests - run: dotnet test ./tests/Paramore.Brighter.Gcp.Tests/Paramore.Brighter.Gcp.Tests.csproj --filter "Category!=Spanner&Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions --blame -v n + run: dotnet test ./tests/Paramore.Brighter.Gcp.Tests/Paramore.Brighter.Gcp.Tests.csproj --filter "Category!=Spanner&Fragile!=CI" --configuration Release --logger "console;verbosity=normal" --logger GitHubActions # TODO: Rafael Andrade is working on how to run RocketMQ on GHA # rocketmq-ci: diff --git a/Brighter.sln b/Brighter.sln index 4dbdc76537..ca8e05ed18 100644 --- a/Brighter.sln +++ b/Brighter.sln @@ -376,8 +376,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Greetings", "samples\Transf EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreetingsSender", "samples\Transforms\AWSTransfomers\CloudEvents\GreetingsSender\GreetingsSender.csproj", "{01EEF2C9-2573-4EFD-B3D9-C3CC5CDA42A6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paramore.Test.Helpers", "tests\Paramore.Test.Helpers\Paramore.Test.Helpers.csproj", "{9F6C87BB-8024-441B-A534-BF600667D52A}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paramore.Brighter.AWSScheduler.Tests", "tests\Paramore.Brighter.AWSScheduler.Tests\Paramore.Brighter.AWSScheduler.Tests.csproj", "{26821A25-B96D-4390-8988-A3EC4CE34C85}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paramore.Brighter.MessagingGateway.GcpPubSub", "src\Paramore.Brighter.MessagingGateway.GcpPubSub\Paramore.Brighter.MessagingGateway.GcpPubSub.csproj", "{FD94511E-2F3E-40D8-8001-407FC40243D1}" @@ -2234,18 +2232,6 @@ Global {01EEF2C9-2573-4EFD-B3D9-C3CC5CDA42A6}.Release|Mixed Platforms.Build.0 = Release|Any CPU {01EEF2C9-2573-4EFD-B3D9-C3CC5CDA42A6}.Release|x86.ActiveCfg = Release|Any CPU {01EEF2C9-2573-4EFD-B3D9-C3CC5CDA42A6}.Release|x86.Build.0 = Release|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Debug|x86.ActiveCfg = Debug|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Debug|x86.Build.0 = Debug|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Release|Any CPU.Build.0 = Release|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Release|x86.ActiveCfg = Release|Any CPU - {9F6C87BB-8024-441B-A534-BF600667D52A}.Release|x86.Build.0 = Release|Any CPU {26821A25-B96D-4390-8988-A3EC4CE34C85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {26821A25-B96D-4390-8988-A3EC4CE34C85}.Debug|Any CPU.Build.0 = Debug|Any CPU {26821A25-B96D-4390-8988-A3EC4CE34C85}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -2808,7 +2794,6 @@ Global {2EF35305-F1CC-4F48-9E25-DC6B93C1B5C2} = {203A75AC-667D-456F-818B-2525C87C9AE0} {36985093-8C96-4408-AB70-F2B940E43219} = {203A75AC-667D-456F-818B-2525C87C9AE0} {01EEF2C9-2573-4EFD-B3D9-C3CC5CDA42A6} = {203A75AC-667D-456F-818B-2525C87C9AE0} - {9F6C87BB-8024-441B-A534-BF600667D52A} = {329736D2-BF92-4D06-A7BF-19F4B6B64EDD} {26821A25-B96D-4390-8988-A3EC4CE34C85} = {329736D2-BF92-4D06-A7BF-19F4B6B64EDD} {C39A4B9B-95CB-4FE5-A7A6-E0577C634573} = {329736D2-BF92-4D06-A7BF-19F4B6B64EDD} {B8E3A0E3-9AA4-4AB1-B84C-15F16842DEAA} = {9A06FC18-50E3-40AE-8631-8A262AF6FB21} diff --git a/Directory.Packages.props b/Directory.Packages.props index 4db5519759..6c249b4d39 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -129,12 +129,13 @@ - - + all runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/tests/Paramore.Brighter.AWS.Tests/Paramore.Brighter.AWS.Tests.csproj b/tests/Paramore.Brighter.AWS.Tests/Paramore.Brighter.AWS.Tests.csproj index 7ea80ae547..4b18cd138b 100644 --- a/tests/Paramore.Brighter.AWS.Tests/Paramore.Brighter.AWS.Tests.csproj +++ b/tests/Paramore.Brighter.AWS.Tests/Paramore.Brighter.AWS.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -17,11 +18,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.AWS.V4.Tests/Paramore.Brighter.AWS.V4.Tests.csproj b/tests/Paramore.Brighter.AWS.V4.Tests/Paramore.Brighter.AWS.V4.Tests.csproj index 155c8838b3..5e1d660bc3 100644 --- a/tests/Paramore.Brighter.AWS.V4.Tests/Paramore.Brighter.AWS.V4.Tests.csproj +++ b/tests/Paramore.Brighter.AWS.V4.Tests/Paramore.Brighter.AWS.V4.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -16,11 +17,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.AWSScheduler.Tests/Paramore.Brighter.AWSScheduler.Tests.csproj b/tests/Paramore.Brighter.AWSScheduler.Tests/Paramore.Brighter.AWSScheduler.Tests.csproj index aeaa644128..ea61343965 100644 --- a/tests/Paramore.Brighter.AWSScheduler.Tests/Paramore.Brighter.AWSScheduler.Tests.csproj +++ b/tests/Paramore.Brighter.AWSScheduler.Tests/Paramore.Brighter.AWSScheduler.Tests.csproj @@ -1,6 +1,7 @@  + Exe $(BrighterTestTargetFrameworks) enable enable @@ -16,8 +17,8 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/tests/Paramore.Brighter.AWSScheduler.V4.Tests/Paramore.Brighter.AWSScheduler.V4.Tests.csproj b/tests/Paramore.Brighter.AWSScheduler.V4.Tests/Paramore.Brighter.AWSScheduler.V4.Tests.csproj index 85fbda9838..73a7b04621 100644 --- a/tests/Paramore.Brighter.AWSScheduler.V4.Tests/Paramore.Brighter.AWSScheduler.V4.Tests.csproj +++ b/tests/Paramore.Brighter.AWSScheduler.V4.Tests/Paramore.Brighter.AWSScheduler.V4.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) enable enable @@ -14,8 +15,8 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/tests/Paramore.Brighter.AzureServiceBus.Tests/Paramore.Brighter.AzureServiceBus.Tests.csproj b/tests/Paramore.Brighter.AzureServiceBus.Tests/Paramore.Brighter.AzureServiceBus.Tests.csproj index bacf3fbe1f..1fe672def9 100644 --- a/tests/Paramore.Brighter.AzureServiceBus.Tests/Paramore.Brighter.AzureServiceBus.Tests.csproj +++ b/tests/Paramore.Brighter.AzureServiceBus.Tests/Paramore.Brighter.AzureServiceBus.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -11,11 +12,11 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - runtime; build; native; contentfiles; analyzers; buildtransitive all + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Paramore.Brighter.Core.Tests/Logging/When_A_Request_Logger_Is_In_The_Pipeline.cs b/tests/Paramore.Brighter.Core.Tests/Logging/When_A_Request_Logger_Is_In_The_Pipeline.cs index f17153661c..1711e17d56 100644 --- a/tests/Paramore.Brighter.Core.Tests/Logging/When_A_Request_Logger_Is_In_The_Pipeline.cs +++ b/tests/Paramore.Brighter.Core.Tests/Logging/When_A_Request_Logger_Is_In_The_Pipeline.cs @@ -9,7 +9,6 @@ using Serilog; using Serilog.Sinks.TestCorrelator; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Logging { diff --git a/tests/Paramore.Brighter.Core.Tests/Logging/When_A_Request_Logger_Is_In_The_Pipeline_Async.cs b/tests/Paramore.Brighter.Core.Tests/Logging/When_A_Request_Logger_Is_In_The_Pipeline_Async.cs index 8a6ac57da6..14700eba7f 100644 --- a/tests/Paramore.Brighter.Core.Tests/Logging/When_A_Request_Logger_Is_In_The_Pipeline_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/Logging/When_A_Request_Logger_Is_In_The_Pipeline_Async.cs @@ -10,7 +10,6 @@ using Serilog; using Serilog.Sinks.TestCorrelator; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Logging { diff --git a/tests/Paramore.Brighter.Core.Tests/Paramore.Brighter.Core.Tests.csproj b/tests/Paramore.Brighter.Core.Tests/Paramore.Brighter.Core.Tests.csproj index 150ba5eab9..b4a39a6f6c 100644 --- a/tests/Paramore.Brighter.Core.Tests/Paramore.Brighter.Core.Tests.csproj +++ b/tests/Paramore.Brighter.Core.Tests/Paramore.Brighter.Core.Tests.csproj @@ -1,5 +1,6 @@ + Exe false $(BrighterTestTargetFrameworks) @@ -27,11 +28,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_blocking_wait_workflow.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_blocking_wait_workflow.cs index d855d4488f..309a01b189 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_blocking_wait_workflow.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_blocking_wait_workflow.cs @@ -6,7 +6,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Workflows; diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_change_workflow.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_change_workflow.cs index 05630f2258..6669f7b339 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_change_workflow.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_change_workflow.cs @@ -5,7 +5,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Workflows; diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_failing_choice_workflow_step.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_failing_choice_workflow_step.cs index 07d7870f53..abb1393a19 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_failing_choice_workflow_step.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_failing_choice_workflow_step.cs @@ -6,7 +6,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Workflows; diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_multistep_workflow_with_reply.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_multistep_workflow_with_reply.cs index aae9ac317f..b501bf26ef 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_multistep_workflow_with_reply.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_multistep_workflow_with_reply.cs @@ -5,7 +5,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Workflows; diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_passing_choice_workflow_step.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_passing_choice_workflow_step.cs index 457119aca6..69b3e43025 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_passing_choice_workflow_step.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_passing_choice_workflow_step.cs @@ -6,7 +6,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Workflows; diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_single_step_workflow.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_single_step_workflow.cs index 56dc753f03..a263f23c65 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_single_step_workflow.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_single_step_workflow.cs @@ -5,7 +5,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Workflows; diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_two_step_workflow.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_two_step_workflow.cs index 626022ac06..7674d08650 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_two_step_workflow.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_two_step_workflow.cs @@ -5,7 +5,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Workflows; diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_a_parallel_split.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_a_parallel_split.cs index 23a79ac708..4a1bd60234 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_a_parallel_split.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_a_parallel_split.cs @@ -5,7 +5,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Workflows; diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_reply.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_reply.cs index adf0f8124d..d27a02fef7 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_reply.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_reply.cs @@ -5,7 +5,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; using MyCommand = Paramore.Brighter.Core.Tests.Workflows.TestDoubles.MyCommand; using MyCommandHandlerAsync = Paramore.Brighter.Core.Tests.Workflows.TestDoubles.MyCommandHandlerAsync; using MyEvent = Paramore.Brighter.Core.Tests.Workflows.TestDoubles.MyEvent; diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_robust_reply_nofault.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_robust_reply_nofault.cs index 6865ae3e64..15e1545ffc 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_robust_reply_nofault.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_robust_reply_nofault.cs @@ -5,7 +5,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Workflows; diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_robust_reply_with_fault.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_robust_reply_with_fault.cs index 11b7da28dc..ae4e61bf40 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_robust_reply_with_fault.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_a_workflow_with_robust_reply_with_fault.cs @@ -5,7 +5,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Workflows; diff --git a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_multiple_workflows.cs b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_multiple_workflows.cs index 7068e8c85c..c6649e1bec 100644 --- a/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_multiple_workflows.cs +++ b/tests/Paramore.Brighter.Core.Tests/Workflows/When_running_multiple_workflows.cs @@ -5,7 +5,6 @@ using Paramore.Brighter.Mediator; using Polly.Registry; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Core.Tests.Workflows; diff --git a/tests/Paramore.Brighter.DynamoDB.Tests/Outbox/When_there_is_a_transaction_between_outbox_and_entity.cs b/tests/Paramore.Brighter.DynamoDB.Tests/Outbox/When_there_is_a_transaction_between_outbox_and_entity.cs index abc6df7c8f..1b0ce6a49a 100644 --- a/tests/Paramore.Brighter.DynamoDB.Tests/Outbox/When_there_is_a_transaction_between_outbox_and_entity.cs +++ b/tests/Paramore.Brighter.DynamoDB.Tests/Outbox/When_there_is_a_transaction_between_outbox_and_entity.cs @@ -11,7 +11,6 @@ using Paramore.Brighter.DynamoDB.Tests.TestDoubles; using Paramore.Brighter.Outbox.DynamoDB; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.DynamoDB.Tests.Outbox; diff --git a/tests/Paramore.Brighter.DynamoDB.Tests/Paramore.Brighter.DynamoDB.Tests.csproj b/tests/Paramore.Brighter.DynamoDB.Tests/Paramore.Brighter.DynamoDB.Tests.csproj index 2ed0ae893a..4edb597303 100644 --- a/tests/Paramore.Brighter.DynamoDB.Tests/Paramore.Brighter.DynamoDB.Tests.csproj +++ b/tests/Paramore.Brighter.DynamoDB.Tests/Paramore.Brighter.DynamoDB.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -16,11 +17,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.DynamoDB.V4.Tests/Outbox/When_there_is_a_transaction_between_outbox_and_entity.cs b/tests/Paramore.Brighter.DynamoDB.V4.Tests/Outbox/When_there_is_a_transaction_between_outbox_and_entity.cs index 4777fa7bab..ed669511e6 100644 --- a/tests/Paramore.Brighter.DynamoDB.V4.Tests/Outbox/When_there_is_a_transaction_between_outbox_and_entity.cs +++ b/tests/Paramore.Brighter.DynamoDB.V4.Tests/Outbox/When_there_is_a_transaction_between_outbox_and_entity.cs @@ -13,7 +13,6 @@ using Paramore.Brighter.Outbox.DynamoDB; using Paramore.Brighter.Outbox.DynamoDB.V4; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.DynamoDB.V4.Tests.Outbox; diff --git a/tests/Paramore.Brighter.DynamoDB.V4.Tests/Paramore.Brighter.DynamoDB.V4.Tests.csproj b/tests/Paramore.Brighter.DynamoDB.V4.Tests/Paramore.Brighter.DynamoDB.V4.Tests.csproj index 3a697bea79..acbef65e10 100644 --- a/tests/Paramore.Brighter.DynamoDB.V4.Tests/Paramore.Brighter.DynamoDB.V4.Tests.csproj +++ b/tests/Paramore.Brighter.DynamoDB.V4.Tests/Paramore.Brighter.DynamoDB.V4.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -16,11 +17,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.Extensions.Tests/Paramore.Brighter.Extensions.Tests.csproj b/tests/Paramore.Brighter.Extensions.Tests/Paramore.Brighter.Extensions.Tests.csproj index de101fbf53..b373892b5a 100644 --- a/tests/Paramore.Brighter.Extensions.Tests/Paramore.Brighter.Extensions.Tests.csproj +++ b/tests/Paramore.Brighter.Extensions.Tests/Paramore.Brighter.Extensions.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -15,11 +16,11 @@ - all runtime; build; native; contentfiles; analyzers + diff --git a/tests/Paramore.Brighter.Gcp.Tests/Paramore.Brighter.Gcp.Tests.csproj b/tests/Paramore.Brighter.Gcp.Tests/Paramore.Brighter.Gcp.Tests.csproj index 2963887034..96824f13cf 100644 --- a/tests/Paramore.Brighter.Gcp.Tests/Paramore.Brighter.Gcp.Tests.csproj +++ b/tests/Paramore.Brighter.Gcp.Tests/Paramore.Brighter.Gcp.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -18,11 +19,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.Hangfire.Tests/Paramore.Brighter.Hangfire.Tests.csproj b/tests/Paramore.Brighter.Hangfire.Tests/Paramore.Brighter.Hangfire.Tests.csproj index 8b1a9e7a23..eb295e52de 100644 --- a/tests/Paramore.Brighter.Hangfire.Tests/Paramore.Brighter.Hangfire.Tests.csproj +++ b/tests/Paramore.Brighter.Hangfire.Tests/Paramore.Brighter.Hangfire.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) enable enable @@ -21,11 +22,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.InMemory.Tests/Paramore.Brighter.InMemory.Tests.csproj b/tests/Paramore.Brighter.InMemory.Tests/Paramore.Brighter.InMemory.Tests.csproj index f0b83afadc..aae9990db0 100644 --- a/tests/Paramore.Brighter.InMemory.Tests/Paramore.Brighter.InMemory.Tests.csproj +++ b/tests/Paramore.Brighter.InMemory.Tests/Paramore.Brighter.InMemory.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -17,11 +18,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_a_message_is_acknowledged_update_offset_async.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_a_message_is_acknowledged_update_offset_async.cs index 9c027baaef..693bc5f024 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_a_message_is_acknowledged_update_offset_async.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_a_message_is_acknowledged_update_offset_async.cs @@ -6,7 +6,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Proactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_a_set_of_messages_is_sent_preserve_order_async.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_a_set_of_messages_is_sent_preserve_order_async.cs index 736f0d47bb..ed4ecc7070 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_a_set_of_messages_is_sent_preserve_order_async.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_a_set_of_messages_is_sent_preserve_order_async.cs @@ -6,7 +6,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Proactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_consumer_assumes_topic_but_missing_async.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_consumer_assumes_topic_but_missing_async.cs index d3f3b84dd4..55491b8ef6 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_consumer_assumes_topic_but_missing_async.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_consumer_assumes_topic_but_missing_async.cs @@ -2,7 +2,6 @@ using System.Threading.Tasks; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Proactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_consumer_declares_topic_async.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_consumer_declares_topic_async.cs index 5c18b8df6c..151265ae24 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_consumer_declares_topic_async.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_consumer_declares_topic_async.cs @@ -3,7 +3,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Proactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_offsets_awaiting_next_acknowledge_sweep_them_async.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_offsets_awaiting_next_acknowledge_sweep_them_async.cs index 7f91ce0d41..f5225ccb2b 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_offsets_awaiting_next_acknowledge_sweep_them_async.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_offsets_awaiting_next_acknowledge_sweep_them_async.cs @@ -4,7 +4,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Proactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_posting_a_message_async.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_posting_a_message_async.cs index 71e02c8a1a..e89c106516 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_posting_a_message_async.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_posting_a_message_async.cs @@ -7,7 +7,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Proactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_posting_a_message_with_header_bytes_async.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_posting_a_message_with_header_bytes_async.cs index d96045bbaf..62e377ec3a 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_posting_a_message_with_header_bytes_async.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_posting_a_message_with_header_bytes_async.cs @@ -9,7 +9,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Proactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_recieving_a_message_without_partition_key_header_async.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_recieving_a_message_without_partition_key_header_async.cs index c4fafb781c..89094ee90b 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_recieving_a_message_without_partition_key_header_async.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Proactor/When_recieving_a_message_without_partition_key_header_async.cs @@ -7,7 +7,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; using Acks = Confluent.Kafka.Acks; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Proactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_a_message_is_acknowledged_update_offset.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_a_message_is_acknowledged_update_offset.cs index d8762ce589..487952f980 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_a_message_is_acknowledged_update_offset.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_a_message_is_acknowledged_update_offset.cs @@ -5,7 +5,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Reactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_a_set_of_messages_is_sent_preserve_order.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_a_set_of_messages_is_sent_preserve_order.cs index d712c8e71c..774fbad480 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_a_set_of_messages_is_sent_preserve_order.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_a_set_of_messages_is_sent_preserve_order.cs @@ -6,7 +6,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Reactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_consumer_assumes_topic_but_missing.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_consumer_assumes_topic_but_missing.cs index 3ba92b625d..f5079630b5 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_consumer_assumes_topic_but_missing.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_consumer_assumes_topic_but_missing.cs @@ -2,7 +2,6 @@ using System.Threading.Tasks; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Reactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_consumer_declares_topic.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_consumer_declares_topic.cs index e7b684645f..bd6ba225d0 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_consumer_declares_topic.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_consumer_declares_topic.cs @@ -3,7 +3,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Reactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_offsets_awaiting_next_acknowledge_sweep_them.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_offsets_awaiting_next_acknowledge_sweep_them.cs index c6ea867553..3d9d998a53 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_offsets_awaiting_next_acknowledge_sweep_them.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_offsets_awaiting_next_acknowledge_sweep_them.cs @@ -4,7 +4,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Reactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_posting_a_message.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_posting_a_message.cs index d177e6f70f..bdf5ca1df7 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_posting_a_message.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_posting_a_message.cs @@ -9,7 +9,6 @@ using Paramore.Brighter.MessagingGateway.Kafka; using Paramore.Brighter.Observability; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Reactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_posting_a_message_with_header_bytes.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_posting_a_message_with_header_bytes.cs index a5beed4a41..e043efac62 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_posting_a_message_with_header_bytes.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_posting_a_message_with_header_bytes.cs @@ -9,7 +9,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Reactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_recieving_a_message_without_partition_key_header.cs b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_recieving_a_message_without_partition_key_header.cs index 2d102e852a..60608c8290 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_recieving_a_message_without_partition_key_header.cs +++ b/tests/Paramore.Brighter.Kafka.Tests/MessagingGateway/Reactor/When_recieving_a_message_without_partition_key_header.cs @@ -7,7 +7,6 @@ using Paramore.Brighter.Kafka.Tests.TestDoubles; using Paramore.Brighter.MessagingGateway.Kafka; using Xunit; -using Xunit.Abstractions; using Acks = Confluent.Kafka.Acks; namespace Paramore.Brighter.Kafka.Tests.MessagingGateway.Reactor; diff --git a/tests/Paramore.Brighter.Kafka.Tests/Paramore.Brighter.Kafka.Tests.csproj b/tests/Paramore.Brighter.Kafka.Tests/Paramore.Brighter.Kafka.Tests.csproj index a02ec7a1b9..46730e24be 100644 --- a/tests/Paramore.Brighter.Kafka.Tests/Paramore.Brighter.Kafka.Tests.csproj +++ b/tests/Paramore.Brighter.Kafka.Tests/Paramore.Brighter.Kafka.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -16,11 +17,11 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Helpers/Base/MqttTestClassBase.cs b/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Helpers/Base/MqttTestClassBase.cs index 08c80a4668..bdf091da7d 100644 --- a/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Helpers/Base/MqttTestClassBase.cs +++ b/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Helpers/Base/MqttTestClassBase.cs @@ -1,14 +1,9 @@ -using System.Net; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.Extensions.Logging; +using System; +using System.Net; using MQTTnet; using Paramore.Brighter.Logging; using Paramore.Brighter.MessagingGateway.MQTT; using Paramore.Brighter.MQTT.Tests.MessagingGateway.Helpers.Server; -using Paramore.Test.Helpers.Base; -using Paramore.Test.Helpers.Loggers; -using Xunit.Abstractions; namespace Paramore.Brighter.MQTT.Tests.MessagingGateway.Helpers.Base { @@ -23,40 +18,29 @@ namespace Paramore.Brighter.MQTT.Tests.MessagingGateway.Helpers.Base /// This class initializes an MQTT test server, configures message producers and consumers, and provides /// utility methods for managing the lifecycle of these components during tests. /// - public abstract class MqttTestClassBase : TestClassBase + public abstract class MqttTestClassBase : IDisposable where T : class { - protected static readonly MqttFactory s_mqttFactory = new(); + private static readonly MqttFactory s_mqttFactory = new(); protected readonly Message _noopMessage = new(); - protected readonly MqttTestServer? MqttTestServer; + private readonly MqttTestServer? _mqttTestServer; /// /// Initializes a new instance of the class with the specified client ID, topic prefix, and test output helper. /// - /// The unique identifier for the MQTT client. + /// The unique identifier for the MQTT client. /// The prefix for MQTT topics used in the test. - /// The output helper for capturing test output during execution. /// /// This constructor sets up the necessary MQTT test server and configurations for messaging gateway tests. /// It also configures logging to integrate with the test output helper. /// - protected MqttTestClassBase(string clientID, string topicPrefix, ITestOutputHelper testOutputHelper) - : base(testOutputHelper) + protected MqttTestClassBase(string clientId, string topicPrefix) { - ApplicationLogging.LoggerFactory = LoggerFactory.Create(configure => - { - configure.Services.AddSingleton(TestOutputHelper); - configure.Services.AddSingleton(); - configure.Services.AddSingleton(sp => sp.GetRequiredService()); - configure.Services.TryAdd(ServiceDescriptor.Singleton(typeof(ILogger), typeof(TestOutputLogger))); - configure.Services.TryAdd(ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(TestOutputLogger<>))); - }); - - IPAddress serverIPAddress = IPAddress.Any; + IPAddress serverIpAddress = IPAddress.Any; int serverPort = MqttTestServer.GetRandomServerPort(); - MqttTestServer = MqttTestServer.CreateTestMqttServer(s_mqttFactory, true, ApplicationLogging.CreateLogger(), serverIPAddress, serverPort, null, TestDisplayName); + _mqttTestServer = MqttTestServer.CreateTestMqttServer(s_mqttFactory, true, ApplicationLogging.CreateLogger(), serverIpAddress, serverPort); var mqttProducerConfig = new MqttMessagingGatewayProducerConfiguration { @@ -73,7 +57,7 @@ protected MqttTestClassBase(string clientID, string topicPrefix, ITestOutputHelp Hostname = IPAddress.Loopback.ToString(), Port = serverPort, TopicPrefix = topicPrefix, - ClientID = clientID + ClientID = clientId }; MessageConsumerAsync = new MqttMessageConsumer(mqttConsumerConfig); @@ -106,30 +90,11 @@ protected MqttTestClassBase(string clientID, string topicPrefix, ITestOutputHelp /// protected IAmAMessageConsumerAsync MessageConsumerAsync { get; } - /// - /// Releases the resources used by the instance. - /// - /// - /// A boolean value indicating whether the method is being called explicitly - /// to release both managed and unmanaged resources (true), - /// or by the finalizer to release only unmanaged resources (false). - /// - /// - /// This method ensures that all disposable components, such as the message producer, - /// message consumer, and MQTT test server, are properly disposed of when no longer needed. - /// It also calls the base class's method to - /// perform additional cleanup operations. - /// - protected override void Dispose(bool disposing) + public void Dispose() { - if (disposing) - { - ((IAmAMessageProducerSync)MessageProducerAsync).Dispose(); - ((IAmAMessageConsumerSync)MessageConsumerAsync).Dispose(); - MqttTestServer?.Dispose(); - } - - base.Dispose(disposing); + ((IAmAMessageProducerSync)MessageProducerAsync).Dispose(); + ((IAmAMessageConsumerSync)MessageConsumerAsync).Dispose(); + _mqttTestServer?.Dispose(); } } } diff --git a/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Proactor/When_posting_multiples_message_via_the_messaging_gateway_async.cs b/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Proactor/When_posting_multiples_message_via_the_messaging_gateway_async.cs index 1c855a0a99..ac5e76f8a0 100644 --- a/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Proactor/When_posting_multiples_message_via_the_messaging_gateway_async.cs +++ b/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Proactor/When_posting_multiples_message_via_the_messaging_gateway_async.cs @@ -4,7 +4,6 @@ using System.Threading.Tasks; using Paramore.Brighter.MQTT.Tests.MessagingGateway.Helpers.Base; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.MQTT.Tests.MessagingGateway.Proactor { @@ -18,14 +17,13 @@ public class MqttMessageProducerSendMessageTestsAsync : MqttTestClassBase /// Initializes a new instance of the class. /// - /// The output helper for capturing test output during execution. /// /// This constructor sets up the MQTT messaging gateway test environment by configuring the client ID, topic prefix, /// and test output helper. It leverages the base class to initialize the necessary /// MQTT configurations and logging mechanisms. /// - public MqttMessageProducerSendMessageTestsAsync(ITestOutputHelper testOutputHelper) - : base(ClientId, TopicPrefix, testOutputHelper) + public MqttMessageProducerSendMessageTestsAsync() + : base(ClientId, TopicPrefix) { } diff --git a/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Proactor/When_queue_is_purged_async.cs b/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Proactor/When_queue_is_purged_async.cs index 739d78c659..2d35c5c8c4 100644 --- a/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Proactor/When_queue_is_purged_async.cs +++ b/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Proactor/When_queue_is_purged_async.cs @@ -2,22 +2,16 @@ using System.Threading.Tasks; using Paramore.Brighter.MQTT.Tests.MessagingGateway.Helpers.Base; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.MQTT.Tests.MessagingGateway.Proactor { [Trait("Category", "MQTT")] [Collection("MQTT")] - public class WhenQueueIsPurgedAsync : MqttTestClassBase + public class WhenQueueIsPurgedAsync() : MqttTestClassBase(ClientId, TopicPrefix) { private const string ClientId = "BrighterIntegrationTests-Purge"; private const string TopicPrefix = "BrighterIntegrationTests/PurgeTests"; - public WhenQueueIsPurgedAsync(ITestOutputHelper testOutputHelper) - : base(ClientId, TopicPrefix, testOutputHelper) - { - } - [Fact] public async Task WhenPurgingTheQueueOnTheMessagingGatewayAsync() { diff --git a/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Reactor/When_posting_multiples_message_via_the_messaging_gateway.cs b/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Reactor/When_posting_multiples_message_via_the_messaging_gateway.cs index 3913053fed..ff6327fc9a 100644 --- a/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Reactor/When_posting_multiples_message_via_the_messaging_gateway.cs +++ b/tests/Paramore.Brighter.MQTT.Tests/MessagingGateway/Reactor/When_posting_multiples_message_via_the_messaging_gateway.cs @@ -24,10 +24,8 @@ THE SOFTWARE. */ using System; using System.Collections.Generic; -using System.Threading.Tasks; using Paramore.Brighter.MQTT.Tests.MessagingGateway.Helpers.Base; using Xunit; -using Xunit.Abstractions; namespace Paramore.Brighter.MQTT.Tests.MessagingGateway.Reactor { @@ -38,8 +36,8 @@ public class MqttMessageProducerSendMessageTests : MqttTestClassBase private const string ClientId = "BrighterIntegrationTests-Purge"; private const string TopicPrefix = "BrighterIntegrationTests/PurgeTests"; - public When_queue_is_Purged(ITestOutputHelper testOutputHelper) - : base(ClientId, TopicPrefix, testOutputHelper) + public When_queue_is_Purged() + : base(ClientId, TopicPrefix) { } diff --git a/tests/Paramore.Brighter.MQTT.Tests/Paramore.Brighter.MQTT.Tests.csproj b/tests/Paramore.Brighter.MQTT.Tests/Paramore.Brighter.MQTT.Tests.csproj index 95a01c2674..38853f1816 100644 --- a/tests/Paramore.Brighter.MQTT.Tests/Paramore.Brighter.MQTT.Tests.csproj +++ b/tests/Paramore.Brighter.MQTT.Tests/Paramore.Brighter.MQTT.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -12,11 +13,11 @@ - runtime; build; native; contentfiles; analyzers; buildtransitive all + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -28,7 +29,6 @@ - diff --git a/tests/Paramore.Brighter.MSSQL.Tests/Paramore.Brighter.MSSQL.Tests.csproj b/tests/Paramore.Brighter.MSSQL.Tests/Paramore.Brighter.MSSQL.Tests.csproj index c533cb2266..4527f9e1ae 100644 --- a/tests/Paramore.Brighter.MSSQL.Tests/Paramore.Brighter.MSSQL.Tests.csproj +++ b/tests/Paramore.Brighter.MSSQL.Tests/Paramore.Brighter.MSSQL.Tests.csproj @@ -1,8 +1,8 @@ + Exe $(BrighterTestTargetFrameworks) - false @@ -18,11 +18,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.MongoDb.Tests/Paramore.Brighter.MongoDb.Tests.csproj b/tests/Paramore.Brighter.MongoDb.Tests/Paramore.Brighter.MongoDb.Tests.csproj index 0f9f0a7e25..bac26911f0 100644 --- a/tests/Paramore.Brighter.MongoDb.Tests/Paramore.Brighter.MongoDb.Tests.csproj +++ b/tests/Paramore.Brighter.MongoDb.Tests/Paramore.Brighter.MongoDb.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -16,11 +17,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.MySQL.Tests/Paramore.Brighter.MySQL.Tests.csproj b/tests/Paramore.Brighter.MySQL.Tests/Paramore.Brighter.MySQL.Tests.csproj index bf7a0a3967..2b6605cc74 100644 --- a/tests/Paramore.Brighter.MySQL.Tests/Paramore.Brighter.MySQL.Tests.csproj +++ b/tests/Paramore.Brighter.MySQL.Tests/Paramore.Brighter.MySQL.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -17,11 +18,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.PostgresSQL.Tests/Paramore.Brighter.PostgresSQL.Tests.csproj b/tests/Paramore.Brighter.PostgresSQL.Tests/Paramore.Brighter.PostgresSQL.Tests.csproj index 5195fe0fc7..24d0cc8d81 100644 --- a/tests/Paramore.Brighter.PostgresSQL.Tests/Paramore.Brighter.PostgresSQL.Tests.csproj +++ b/tests/Paramore.Brighter.PostgresSQL.Tests/Paramore.Brighter.PostgresSQL.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -17,11 +18,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.Quartz.Tests/Paramore.Brighter.Quartz.Tests.csproj b/tests/Paramore.Brighter.Quartz.Tests/Paramore.Brighter.Quartz.Tests.csproj index 4c51f70b4a..25ea4634a8 100644 --- a/tests/Paramore.Brighter.Quartz.Tests/Paramore.Brighter.Quartz.Tests.csproj +++ b/tests/Paramore.Brighter.Quartz.Tests/Paramore.Brighter.Quartz.Tests.csproj @@ -1,13 +1,12 @@ + Exe $(BrighterTestTargetFrameworks) enable enable - false true - ParamoreBrighter.Quartz.Tests @@ -23,11 +22,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.RMQ.Async.Tests/Paramore.Brighter.RMQ.Async.Tests.csproj b/tests/Paramore.Brighter.RMQ.Async.Tests/Paramore.Brighter.RMQ.Async.Tests.csproj index 8b64f58205..ce03ee54cc 100644 --- a/tests/Paramore.Brighter.RMQ.Async.Tests/Paramore.Brighter.RMQ.Async.Tests.csproj +++ b/tests/Paramore.Brighter.RMQ.Async.Tests/Paramore.Brighter.RMQ.Async.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -16,11 +17,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.RMQ.Sync.Tests/Paramore.Brighter.RMQ.Sync.Tests.csproj b/tests/Paramore.Brighter.RMQ.Sync.Tests/Paramore.Brighter.RMQ.Sync.Tests.csproj index 7a5833a817..47a76c080a 100644 --- a/tests/Paramore.Brighter.RMQ.Sync.Tests/Paramore.Brighter.RMQ.Sync.Tests.csproj +++ b/tests/Paramore.Brighter.RMQ.Sync.Tests/Paramore.Brighter.RMQ.Sync.Tests.csproj @@ -1,6 +1,7 @@  + Exe $(BrighterTestTargetFrameworks) false @@ -16,11 +17,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.Redis.Tests/Paramore.Brighter.Redis.Tests.csproj b/tests/Paramore.Brighter.Redis.Tests/Paramore.Brighter.Redis.Tests.csproj index 7a00207b22..4dacfd720a 100644 --- a/tests/Paramore.Brighter.Redis.Tests/Paramore.Brighter.Redis.Tests.csproj +++ b/tests/Paramore.Brighter.Redis.Tests/Paramore.Brighter.Redis.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -15,11 +16,11 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.RocketMQ.Tests/Paramore.Brighter.RocketMQ.Tests/Paramore.Brighter.RocketMQ.Tests.csproj b/tests/Paramore.Brighter.RocketMQ.Tests/Paramore.Brighter.RocketMQ.Tests/Paramore.Brighter.RocketMQ.Tests.csproj index 1b017a43a4..51c45db482 100644 --- a/tests/Paramore.Brighter.RocketMQ.Tests/Paramore.Brighter.RocketMQ.Tests/Paramore.Brighter.RocketMQ.Tests.csproj +++ b/tests/Paramore.Brighter.RocketMQ.Tests/Paramore.Brighter.RocketMQ.Tests/Paramore.Brighter.RocketMQ.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) enable enable @@ -14,11 +15,11 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.Sqlite.Tests/Paramore.Brighter.Sqlite.Tests.csproj b/tests/Paramore.Brighter.Sqlite.Tests/Paramore.Brighter.Sqlite.Tests.csproj index 9a1e686124..857380fb4d 100644 --- a/tests/Paramore.Brighter.Sqlite.Tests/Paramore.Brighter.Sqlite.Tests.csproj +++ b/tests/Paramore.Brighter.Sqlite.Tests/Paramore.Brighter.Sqlite.Tests.csproj @@ -1,6 +1,7 @@ + Exe $(BrighterTestTargetFrameworks) false @@ -21,11 +22,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Brighter.Transforms.Adaptors.Tests/Paramore.Brighter.Transforms.Adaptors.Tests.csproj b/tests/Paramore.Brighter.Transforms.Adaptors.Tests/Paramore.Brighter.Transforms.Adaptors.Tests.csproj index 4c59877c06..ff68a0ed8b 100644 --- a/tests/Paramore.Brighter.Transforms.Adaptors.Tests/Paramore.Brighter.Transforms.Adaptors.Tests.csproj +++ b/tests/Paramore.Brighter.Transforms.Adaptors.Tests/Paramore.Brighter.Transforms.Adaptors.Tests.csproj @@ -1,6 +1,7 @@  + Exe $(BrighterTestTargetFrameworks) enable false @@ -17,11 +18,11 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Paramore.Test.Helpers/Base/ITestClassBase.cs b/tests/Paramore.Test.Helpers/Base/ITestClassBase.cs deleted file mode 100644 index 3f0f63c6db..0000000000 --- a/tests/Paramore.Test.Helpers/Base/ITestClassBase.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using Paramore.Test.Helpers.TestOutput; -using Xunit.Abstractions; - -namespace Paramore.Test.Helpers.Base -{ - /// - /// Defines the base interface for test classes in the AOT test suite. - /// Provides essential properties and functionality required for test execution and setup. - /// - public interface ITestClassBase : IDisposable - { - /// - /// Gets the test output helper used for capturing and managing test output during execution. - /// - /// - /// An instance of - /// that provides functionality for writing and managing test output. - /// - ICoreTestOutputHelper TestOutputHelper { get; } - - /// - /// Gets the instance used for resolving dependencies - /// within the test class. This property provides access to the service container - /// configured for the test environment. - /// - IServiceProvider ServiceProvider { get; } - - /// - /// Gets the current xUnit test instance associated with the test execution. - /// - /// - /// An instance of representing the current test, - /// or null if no test is associated. - /// - /// - /// This property provides access to the xUnit test metadata, such as the test's display name - /// and other related information. It may return null if the test context is not initialized. - /// - ITest? XunitTest { get; } - - /// - /// Gets the fully qualified name of the test, including its namespace and class name. - /// This property is useful for uniquely identifying a test within the test suite. - /// - string TestQualifiedName { get; } - - /// - /// Gets the display name of the test, excluding its namespace. - /// This property provides a simplified and readable name for the test, - /// which is particularly useful for logging and output purposes. - /// - string TestDisplayName { get; } - } -} diff --git a/tests/Paramore.Test.Helpers/Base/TestClassBase.cs b/tests/Paramore.Test.Helpers/Base/TestClassBase.cs deleted file mode 100644 index cd4f4f9ff4..0000000000 --- a/tests/Paramore.Test.Helpers/Base/TestClassBase.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Reflection; -using Microsoft.Extensions.DependencyInjection; -using Paramore.Test.Helpers.Extensions; -using Paramore.Test.Helpers.TestOutput; -using Xunit.Abstractions; - -namespace Paramore.Test.Helpers.Base -{ - /// - /// Serves as a base class for test classes in the AOT test suite. - /// This abstract class provides shared setup and utility functionality for derived test classes. - /// Implements the interface to support shared test context. - /// - /// - /// The type parameter representing the specific test class deriving from this base class. - /// - public abstract class TestClassBase : ITestClassBase - { - private bool _disposedValue; - private readonly Lazy _serviceProviderLazy; - - /// - /// Initializes a new instance of the class. - /// This constructor is used to set up the shared test context and output helper for derived test classes. - /// - /// - /// An instance of used to capture test output during execution. - /// - protected TestClassBase(ITestOutputHelper testOutputHelper) - { - if (testOutputHelper is null) - { - throw new ArgumentNullException(nameof(testOutputHelper)); - } - - TestOutputHelper = new CoreTestOutputHelper(this, testOutputHelper); - _serviceProviderLazy = new Lazy(() => BuildServiceProvider(new ServiceCollection(), TestOutputHelper)); - } - - /// - public IServiceProvider ServiceProvider => _serviceProviderLazy.Value; - - /// - public ICoreTestOutputHelper TestOutputHelper { get; } - - /// - public ITest? XunitTest => (ITest?)GetTestField(TestOutputHelper.WrappedTestOutputHelper)?.GetValue(TestOutputHelper.WrappedTestOutputHelper); - - /// - public string TestQualifiedName => XunitTest?.DisplayName ?? typeof(T).GetLoggerCategoryName(); - - /// - public string TestDisplayName => TestQualifiedName.RemoveNamespace(); - - protected virtual IServiceProvider BuildServiceProvider(IServiceCollection services, ICoreTestOutputHelper testOutputHelper) - { - return services.BuildServiceProvider(); - } - - /// - /// Releases all resources used by the instance. - /// - /// - /// This method is responsible for performing cleanup operations for the current instance of the class. - /// It ensures that any unmanaged resources are released and any disposable objects are properly disposed. - /// - protected virtual void Dispose(bool disposing) - { - if (!_disposedValue) - { - if (disposing) - { - TestOutputHelper.Dispose(); - } - - _disposedValue = true; - } - } - - /// - public void Dispose() - { - // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method - Dispose(disposing: true); - GC.SuppressFinalize(this); - } - - /// - /// Retrieves the private field named 'test' from the specified instance. - /// - /// - /// An instance of from which the private field is to be retrieved. - /// - /// - /// A object representing the 'test' field if it exists; otherwise, null. - /// - /// - /// This method uses reflection to access a private field named 'test' within the provided - /// instance. The field is expected to exist in the implementation. - /// - /// - /// Thrown if the parameter is null. - /// - [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2075", Justification = "The field 'test' is known to exist in the ITestOutputHelper implementation.")] - private static FieldInfo? GetTestField(ITestOutputHelper testOutputHelper) - { - return testOutputHelper.GetType().GetField("test", BindingFlags.Instance | BindingFlags.NonPublic); - } - } -} diff --git a/tests/Paramore.Test.Helpers/Extensions/StringExtensions.cs b/tests/Paramore.Test.Helpers/Extensions/StringExtensions.cs deleted file mode 100644 index 43c21be12f..0000000000 --- a/tests/Paramore.Test.Helpers/Extensions/StringExtensions.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Paramore.Test.Helpers.Extensions -{ - public static class StringExtensions - { - /// - /// Centers the specified title string within a field of a specified width, padded with a specified character. - /// - /// The title string to be centered. - /// The character used to pad the title string on both sides. - /// The character used to pad the title string on both sides, inside the title character padding. - /// The number of padding characters to add to each side of the title string. - /// A new string that represents the centered title string, padded with the specified characters. - public static string? CenterTitle(this string? titleString, char titleChar, char indentChar, int indent) - { - if (string.IsNullOrEmpty(titleString)) - { - return string.Empty; - } - - int titleLength = titleString!.Length + ((1 + indent) * 2); - StringBuilder sb = new(); - sb.Append(titleChar, titleLength); - sb.AppendLine(); - sb.Append(indentChar); - sb.Append(' ', indent); - sb.Append(titleString); - sb.Append(' ', indent); - sb.Append(indentChar); - sb.AppendLine(); - sb.Append(titleChar, titleLength); - - return sb.ToString(); - } - - /// - /// Centers the specified title strings within a field of a specified width, padded with specified characters. - /// - /// The collection of title strings to be centered. - /// The character used to pad the title string on both sides. - /// The character used to pad the title string within the specified width. - /// The number of padding characters to add to each side of the title string. - /// A new string that represents the centered title strings, padded with the specified characters. - public static string? CenterTitles(this IEnumerable? titleStrings, char titleChar, char indentChar, int indent) - { - if (titleStrings is null) - { - return string.Empty; - } - - IList titleList = titleStrings.ToList(); - - if (!titleList.Any()) - { - return string.Empty; - } - - int maxTitleLength = titleList.Max(s => s.Length + ((1 + indent) * 2)); - var sb = new StringBuilder(); - sb.Append(titleChar, maxTitleLength); - sb.AppendLine(); - - // Calculate the total length of the longest title string. - foreach (string titleString in titleList) - { - int stringIndent = ((maxTitleLength - titleString.Length) / 2) - 1; - sb.Append(indentChar); - sb.Append(' ', stringIndent); - sb.Append(titleString); - sb.Append(' ', maxTitleLength - titleString.Length - stringIndent - 2); - sb.Append(indentChar); - sb.AppendLine(); - } - - sb.Append(titleChar, maxTitleLength); - return sb.ToString(); - } - - /// - /// Centers a title string within a decorative border, using specified characters for the title border and indentation. - /// - /// The title string to be centered. If or empty, a default centered title will be generated. - /// - /// A formatted string where the title is centered within a decorative border. - /// - /// - /// This overload uses default characters for the title border and indentation. - /// - public static string? CenterTitle(this string? titleString) - => CenterTitle(titleString, '*', ' ', 5); - - /// - /// Removes the namespace from a fully qualified type or member name, returning only the simple name. - /// - /// The fully qualified name of the type or member. - /// - /// A string containing the simple name without the namespace. - /// If is or empty, an empty string is returned. - /// - /// - /// For input "System.Collections.Generic.List", the method returns "List". - /// - public static string RemoveNamespace(this string displayName) - { - if (string.IsNullOrEmpty(displayName)) - { - return string.Empty; - } - int lastPeriod = displayName.LastIndexOf('.'); - return lastPeriod > 0 ? displayName[(lastPeriod + 1)..] : displayName; - } - } -} diff --git a/tests/Paramore.Test.Helpers/Extensions/TypeExtensions.cs b/tests/Paramore.Test.Helpers/Extensions/TypeExtensions.cs deleted file mode 100644 index df2371ab2e..0000000000 --- a/tests/Paramore.Test.Helpers/Extensions/TypeExtensions.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace Paramore.Test.Helpers.Extensions -{ - public static class TypeExtensions - { - /// - /// The built in type names. Extensions to System Type class. - /// - private static readonly Dictionary BuiltInTypeNames = new() - { - { typeof(bool), "bool" }, - { typeof(byte), "byte" }, - { typeof(char), "char" }, - { typeof(decimal), "decimal" }, - { typeof(double), "double" }, - { typeof(float), "float" }, - { typeof(int), "int" }, - { typeof(long), "long" }, - { typeof(object), "object" }, - { typeof(sbyte), "sbyte" }, - { typeof(short), "short" }, - { typeof(string), "string" }, - { typeof(uint), "uint" }, - { typeof(ulong), "ulong" }, - { typeof(ushort), "ushort" }, - }; - - /// - /// Gets the display name of the full. - /// - /// The type. - /// System.String. - public static string GetDisplayFullName(this Type? type) - { - if (type is null) - { - throw new ArgumentNullException(nameof(type)); - } - - if (type.GetTypeInfo().IsGenericType) - { - string? genericFullName = type.GetGenericTypeDefinition().FullName; - - // Nested types (public or private) have a '+' in their full name - string[]? parts = genericFullName?.Split('+'); - - parts ??= []; - - // Handle nested generic types - // Examples: - // ConsoleApp.Program+Foo`1+Bar - // ConsoleApp.Program+Foo`1+Bar`1 - for (int i = 0; i < parts.Length; i++) - { - string partName = parts[i]; - - int backTickIndex = partName.IndexOf('`'); - if (backTickIndex >= 0) - { - // Since '.' is typically used to filter log messages in a hierarchy kind of scenario, - // do not include any generic type information as part of the name. - // Example: - // Microsoft.AspNetCore.Mvc -> log level set as Warning - // Microsoft.AspNetCore.Mvc.ModelBinding -> log level set as Verbose - partName = partName.Substring(0, backTickIndex); - } - - parts[i] = partName; - } - - return string.Join(".", parts); - } - - if (BuiltInTypeNames.TryGetValue(type, out var displayFullName)) - { - return displayFullName; - } - - string? fullName = type.FullName; - - if (type.IsNested) - { - fullName = fullName?.Replace('+', '.') ?? string.Empty; - } - - return fullName ?? string.Empty; - } - - /// - /// Gets the logger category name for the specified type. - /// - /// The type for which to get the logger category name. - /// The logger category name as a . - /// Thrown when the is null. - public static string GetLoggerCategoryName(this Type? type) - { - return type.GetDisplayFullName(); - } - } -} diff --git a/tests/Paramore.Test.Helpers/Loggers/CoreJsonConsoleFormatterOptions.shared.cs b/tests/Paramore.Test.Helpers/Loggers/CoreJsonConsoleFormatterOptions.shared.cs deleted file mode 100644 index 92d47c806a..0000000000 --- a/tests/Paramore.Test.Helpers/Loggers/CoreJsonConsoleFormatterOptions.shared.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System.Collections.Generic; -using Microsoft.Extensions.Logging.Console; - -namespace Paramore.Test.Helpers.Loggers -{ - /// - /// Provides configuration options for the which formats log messages in JSON format for console output. - /// - public class CoreJsonConsoleFormatterOptions : JsonConsoleFormatterOptions - { - /// - /// Represents the minimum set of fields included in the JSON console formatter output. - /// - /// - /// The minimum fields include:. - /// - public static readonly IList FormatterFieldsMinimum = - [ - CoreLoggingFormatterOptions.Timestamp, - CoreLoggingFormatterOptions.Message, - CoreLoggingFormatterOptions.Exception, - ]; - - /// - /// Represents the default set of formatter fields used for normal logging output - /// in the class. - /// - /// - /// This field includes the following formatter fields:. - /// - public static readonly IList FormatterFieldsNormal = - [ - CoreLoggingFormatterOptions.Timestamp, - CoreLoggingFormatterOptions.Category, - CoreLoggingFormatterOptions.Message, - CoreLoggingFormatterOptions.Exception, - ]; - - /// - /// Represents the default set of formatter fields with scope used for normal logging output - /// in the class. - /// - /// - /// This field includes the following formatter fields:. - /// - public static readonly IList FormatterFieldsNormalWithScope = - [ - CoreLoggingFormatterOptions.Timestamp, - CoreLoggingFormatterOptions.Category, - CoreLoggingFormatterOptions.Message, - CoreLoggingFormatterOptions.Exception, - CoreLoggingFormatterOptions.ScopeProperties, - ]; - - /// - /// Represents a predefined list of formatter fields that are included in verbose logging output. - /// - /// - /// This field specifies the set of that are used - /// when verbose logging is enabled. It includes fields such as timestamp, event ID, log level, - /// category, message, exception, scope message, and scope properties. - /// - public static readonly IList FormatterFieldsVerbose = - [ - CoreLoggingFormatterOptions.Timestamp, - CoreLoggingFormatterOptions.EventId, - CoreLoggingFormatterOptions.LogLevel, - CoreLoggingFormatterOptions.Category, - CoreLoggingFormatterOptions.Message, - CoreLoggingFormatterOptions.Exception, - CoreLoggingFormatterOptions.ScopeMessage, - CoreLoggingFormatterOptions.ScopeProperties, - ]; - - /// - /// Initializes a new instance of the class with the specified formatter fields. - /// - /// - /// The fields to be included in the JSON console formatter. - /// - public CoreJsonConsoleFormatterOptions(CoreLoggingFormatterOptions formatterOptions) - { - FormatterFields = GetFieldList(formatterOptions); - } - - /// - /// Initializes a new instance of the class. - /// - public CoreJsonConsoleFormatterOptions() - : this(CoreLoggingFormatterOptions.Default) - { - } - - /// - /// Gets the set of state keys that should be excluded from the log output. - /// - /// - /// This property allows you to specify which state keys should be omitted when formatting log messages. - /// - public HashSet StateKeysToExclude { get; } = []; - - /// - /// Gets or sets the collection of fields to include in the JSON output when formatting log messages. - /// - /// - /// A list of that specifies the fields to be included in the formatted output. - /// - public IList FormatterFields { get; set; } - - /// - /// Retrieves a list of based on the specified logging detail level. - /// - /// - /// The value that specifies the desired logging detail level. - /// - /// - /// A list of corresponding to the specified logging detail level. - /// - public static IList GetFieldList(CoreLoggingFormatterOptions formatterOptions) - { - if (formatterOptions.HasFlag(CoreLoggingFormatterOptions.LoggingDetailMinimum)) - { - return FormatterFieldsMinimum; - } - - return formatterOptions.HasFlag(CoreLoggingFormatterOptions.LoggingDetailNormalWithScope) - ? FormatterFieldsNormalWithScope - : formatterOptions.HasFlag(CoreLoggingFormatterOptions.LoggingDetailVerbose) ? FormatterFieldsVerbose : FormatterFieldsNormal; - } - } -} diff --git a/tests/Paramore.Test.Helpers/Loggers/CoreLoggingFormatterOptions.shared.cs b/tests/Paramore.Test.Helpers/Loggers/CoreLoggingFormatterOptions.shared.cs deleted file mode 100644 index 19b546eae0..0000000000 --- a/tests/Paramore.Test.Helpers/Loggers/CoreLoggingFormatterOptions.shared.cs +++ /dev/null @@ -1,189 +0,0 @@ -using System; - -namespace Paramore.Test.Helpers.Loggers -{ - /// - /// Specifies the fields that can be included in the JSON output when formatting log messages - /// using the . - /// - /// - /// This enumeration is marked with the , allowing a combination of - /// multiple fields to be specified. - /// - [Flags] - public enum CoreLoggingFormatterOptions - { - /// - /// Includes the timestamp of the log entry. - /// - FormatIndented = 1 << 1, - - /// - /// Specifies that log messages should be formatted as a single line in the JSON output. - /// - /// - /// This field is useful for scenarios where compact, single-line log entries are preferred, - /// such as when logs are being processed by systems that expect single-line JSON objects. - /// - FormatSingleLine = 1 << 2, - - /// - /// Includes the scopes in the JSON output when formatting log messages. - /// - /// - /// Scopes provide additional contextual information about the log message, - /// such as operation names or other metadata. This field can be combined - /// with other fields using the . - /// - FormatIncludeScopes = 1 << 3, - - /// - /// Indicates that the JSON output should include timestamps in UTC format when formatting log messages. - /// - /// - /// This field is part of the enumeration and can be combined - /// with other fields using bitwise operations due to the applied to the enumeration. - /// - FormatUseUtcTimestamp = 1 << 4, - - /// - /// Indicates that the JSON output should skip validation when formatting log messages. - /// - /// - /// This field is part of the enumeration and can be combined - /// with other fields using bitwise operations due to the applied to the enumeration. - /// - FormatSkipValidation = 1 << 5, - - /// - /// Represents a mask used to filter or include specific fields in the JSON output - /// when formatting log messages using the . - /// - /// - /// The field is a predefined value that can be used to - /// isolate or combine fields within the - /// enumeration. It is particularly useful for scenarios where a subset of fields - /// needs to be included in the formatted output. - /// - FormatMask = 0x000000FF, - - /// - /// Represents the default set of fields for the enumeration. - /// - /// - /// The default configuration includes the following fields: - /// - /// - /// - /// - /// - /// - /// - Default = LoggingFormatJson | FormatIndented | FormatUseUtcTimestamp | FormatIncludeScopes | LoggingDetailNormalWithScope, - - /// - /// Specifies that the logging output should be formatted as plain text. - /// - LoggingFormatText = 1 << 8, - - /// - /// Specifies that the logging output should be formatted as JSON. - /// - /// - /// This flag is used to indicate that the log entries will be serialized in JSON format. - /// It can be combined with other flags to customize the logging behavior further. - /// - LoggingFormatJson = 1 << 9, - - /// - /// Represents the minimum level of logging detail to be included in the JSON output - /// when formatting log messages using the . - /// - /// - /// This field is part of the enumeration and can be - /// combined with other fields to customize the logging output. - /// - LoggingDetailMinimum = 1 << 12, - - /// - /// Represents a logging detail level that provides normal verbosity. - /// This level includes a moderate amount of information suitable for general logging purposes. - /// - LoggingDetailNormal = 1 << 13, - - /// - /// Represents a logging detail level that provides normal verbosity with scope. - /// This level includes a moderate amount of information suitable for general logging purposes. - /// - LoggingDetailNormalWithScope = 1 << 14, - - /// - /// Specifies a verbose level of logging detail for the enumeration. - /// - /// - /// This flag is used to enable the most detailed level of logging output, providing comprehensive information - /// about the logging events. It is typically used for debugging or in scenarios where maximum logging detail is required. - /// - LoggingDetailVerbose = 1 << 15, - - /// - /// Represents a mask used to filter logging details in the enumeration. - /// - /// - /// The value is a bitmask (0x00FF00) that can be used to isolate or combine - /// logging detail levels, such as , , - /// and . - /// - LoggingDetailMask = 0x0000FF00, - - /// - /// Includes the timestamp of the log entry. - /// - Timestamp = 1 << 16, - - /// - /// Includes the event ID associated with the log entry. - /// - EventId = 1 << 17, - - /// - /// Includes the log level (e.g., Information, Warning, Error) of the log entry. - /// - LogLevel = 1 << 18, - - /// - /// Includes the category name associated with the log entry. - /// - Category = 1 << 19, - - /// - /// Includes the main message of the log entry. - /// - Message = 1 << 20, - - /// - /// Includes exception details, if any, associated with the log entry. - /// - Exception = 1 << 21, - - /// - /// Includes the scope message, if any, associated with the log entry. - /// - ScopeMessage = 1 << 22, - - /// - /// Includes the scope properties, if any, associated with the log entry. - /// - ScopeProperties = 1 << 23, - - /// - /// Represents a combination of the and fields. - /// - /// - /// When this field is included in the formatter configuration, both the scope message and its associated - /// properties will be included in the JSON output. This is useful for scenarios where detailed context - /// information is required in log entries. - /// - ScopeMessageWithProperties = ScopeMessage | ScopeProperties, - } -} diff --git a/tests/Paramore.Test.Helpers/Loggers/CorePooledByteBufferWriter.shared.cs b/tests/Paramore.Test.Helpers/Loggers/CorePooledByteBufferWriter.shared.cs deleted file mode 100644 index 4c8757875b..0000000000 --- a/tests/Paramore.Test.Helpers/Loggers/CorePooledByteBufferWriter.shared.cs +++ /dev/null @@ -1,400 +0,0 @@ -using System; -using System.Buffers; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; - -namespace Paramore.Test.Helpers.Loggers -{ - /// - /// Provides a pooled buffer writer for bytes, implementing and . - /// - /// - /// This class is designed to efficiently manage a buffer of bytes using a pool to minimize allocations. - /// It supports writing to the buffer, advancing the position, and retrieving the written data. - /// - public class CorePooledByteBufferWriter : IBufferWriter, IDisposable - { - /// - /// Represents the maximum buffer size that can be allocated by the . - /// - /// - /// This value is derived from Array.MaxLength in the .NET runtime, ensuring that the buffer size does not exceed the maximum allowable length for arrays. - /// - public const int MaximumBufferSize = 0X7FFFFFC7; - private const int MinimumBufferSize = 256; - - // This class allows two possible configurations: if rentedBuffer is not null then - // it can be used as an IBufferWriter and holds a buffer that should eventually be - // returned to the shared pool. If rentedBuffer is null, then the instance is in a - // cleared/disposed state and it must re-rent a buffer before it can be used again. - private byte[]? _rentedBuffer; - private int _index; - - /// - /// Initializes a new instance of the class with the specified initial capacity. - /// - /// The initial capacity of the buffer to rent from the pool. - /// - /// The constructor ensures that the initial capacity is greater than zero and rents a buffer of the specified size from the shared pool. - /// - /// Thrown when is less than or equal to zero. - public CorePooledByteBufferWriter(int initialCapacity) - : this() - { - Debug.Assert(initialCapacity > 0, "initialCapacity > 0"); - - _rentedBuffer = ArrayPool.Shared.Rent(initialCapacity); - _index = 0; - } - - private CorePooledByteBufferWriter() - { -#if !NETSTANDARD2_0_OR_GREATER - // Ensure we are in sync with the Array.MaxLength implementation. - Debug.Assert(Array.MaxLength == MaximumBufferSize, "Array.MaxLength == MaximumBufferSize"); -#endif - } - - /// - /// Gets the memory region that has been written to. - /// - /// - /// A of bytes representing the written portion of the buffer. - /// - /// - /// This property returns a read-only view of the buffer that contains the data written so far. - /// It is useful for retrieving the data without modifying the underlying buffer. - /// - public ReadOnlyMemory WrittenMemory - { - get - { - Debug.Assert(_rentedBuffer is not null, "this._rentedBuffer != null"); - Debug.Assert(_index <= _rentedBuffer!.Length, "this._index <= this._rentedBuffer.Length"); - return _rentedBuffer.AsMemory(0, _index); - } - } - - /// - /// Gets the number of bytes written to the buffer. - /// - /// - /// The total count of bytes that have been written to the buffer so far. - /// - /// - /// This property returns the current position in the buffer, which represents the number of bytes written. - /// - public int WrittenCount - { - get - { - Debug.Assert(_rentedBuffer is not null, "this._rentedBuffer is not null"); - return _index; - } - } - - /// - /// Gets the total capacity of the underlying rented buffer. - /// - /// - /// The total capacity of the buffer in bytes. - /// - /// - /// The capacity represents the total size of the buffer rented from the pool. - /// It is the maximum amount of data that can be written to the buffer before it needs to be resized. - /// - public int Capacity - { - get - { - Debug.Assert(_rentedBuffer is not null, "this._rentedBuffer is not null"); - return _rentedBuffer!.Length; - } - } - - /// - /// Gets the amount of free capacity available in the rented buffer. - /// - /// - /// The number of bytes that can still be written to the buffer before it needs to be resized. - /// - /// - /// This property calculates the difference between the total length of the rented buffer and the current position, - /// indicating how much more data can be written without requiring a new buffer allocation. - /// - public int FreeCapacity - { - get - { - Debug.Assert(_rentedBuffer is not null, "this._rentedBuffer is not null"); - return _rentedBuffer!.Length - _index; - } - } - - /// - /// Creates an empty instance of the class for caching purposes. - /// - /// A new instance of . - /// - /// This method is intended to be used for creating an instance of - /// that can be cached and reused to minimize allocations. - /// - public static CorePooledByteBufferWriter CreateEmptyInstanceForCaching() - { - return new(); - } - - /// - /// Clears the contents of the buffer, resetting the writer to its initial state. - /// - /// - /// This method clears the current buffer by resetting the internal index to zero and clearing the contents of the buffer. - /// It does not return the buffer to the pool. - /// - public void Clear() - { - ClearHelper(); - } - - /// - /// Clears the current buffer and returns it to the shared pool. - /// - /// - /// This method ensures that the buffer is cleared and returned to the shared pool for reuse, - /// effectively resetting the state of the instance. - /// - /// Thrown if the buffer is already null. - public void ClearAndReturnBuffers() - { - Debug.Assert(_rentedBuffer is not null, "this._rentedBuffer is not null"); - - ClearHelper(); - byte[] toReturn = _rentedBuffer!; - _rentedBuffer = null; - ArrayPool.Shared.Return(toReturn); - } - - /// - /// Releases the resources used by the instance. - /// - /// - /// This method returns the rented buffer back to the shared pool and sets the internal buffer to null. - /// - public void Dispose() - { - if (_rentedBuffer is null) - { - return; - } - - ClearHelper(); - byte[] toReturn = _rentedBuffer; - _rentedBuffer = null; - ArrayPool.Shared.Return(toReturn); - } - - /// - /// Initializes the current instance of the class with a new buffer of the specified initial capacity. - /// - /// The initial capacity of the buffer to rent from the pool. - /// - /// This method is intended to reinitialize an existing instance of that is in a cleared or disposed state. - /// It ensures that the initial capacity is greater than zero and rents a buffer of the specified size from the shared pool. - /// - /// Thrown when is less than or equal to zero. - public void InitializeEmptyInstance(int initialCapacity) - { - Debug.Assert(initialCapacity > 0, "initialCapacity > 0"); - Debug.Assert(_rentedBuffer is null, "this._rentedBuffer is null"); - - _rentedBuffer = ArrayPool.Shared.Rent(initialCapacity); - _index = 0; - } - - /// - /// Advances the writer's position by the specified count of bytes. - /// - /// The number of bytes to advance the writer's position by. Must be non-negative. - /// Thrown when is negative or exceeds the available capacity. - /// - /// This method updates the internal index to reflect the new position in the buffer. - /// It ensures that the buffer has sufficient capacity to accommodate the advance. - /// - public void Advance(int count) - { - Debug.Assert(_rentedBuffer is not null, "this._rentedBuffer is not null"); - Debug.Assert(count >= 0, "count >= 0"); - Debug.Assert(_index <= _rentedBuffer!.Length - count, "this._index <= this._rentedBuffer.Length - count"); - _index += count; - } - - /// - /// Provides a of bytes to write to, ensuring there is enough space for the specified size hint. - /// - /// The minimum number of bytes required. If 0, a default minimum size is used. - /// A of bytes to write to. - /// - /// This method checks the current buffer and resizes it if necessary to accommodate the specified size hint. - /// - public Memory GetMemory(int sizeHint = MinimumBufferSize) - { - CheckAndResizeBuffer(sizeHint); - return _rentedBuffer.AsMemory(_index); - } - - /// - /// Provides a span of bytes from the underlying rented buffer, ensuring that there is enough space for the specified size hint. - /// - /// The minimum size of the span requested. If the size hint is not specified, a default value is used. - /// A of bytes from the underlying buffer. - /// - /// This method checks the current buffer and resizes it if necessary to accommodate the requested size hint. - /// The returned span starts from the current position in the buffer. - /// - public Span GetSpan(int sizeHint = MinimumBufferSize) - { - CheckAndResizeBuffer(sizeHint); - return _rentedBuffer.AsSpan(_index); - } - -#if NETCOREAPP - /// - /// Asynchronously writes the contents of the buffer to the specified . - /// - /// The to which the buffer will be written. - /// A to observe while waiting for the task to complete. - /// A that represents the asynchronous write operation. - /// Thrown if the buffer has been disposed. - /// Thrown if the buffer is in an invalid state. - internal ValueTask WriteToStreamAsync(Stream destination, CancellationToken cancellationToken) - { - return destination.WriteAsync(WrittenMemory, cancellationToken); - } - - /// - /// Writes the contents of the buffer to the specified . - /// - /// The to which the buffer will be written. - /// Thrown if the buffer has been disposed. - /// Thrown if the buffer is in an invalid state. - internal void WriteToStream(Stream destination) - { - destination.Write(WrittenMemory.Span); - } -#else - /// - /// Asynchronously writes the contents of the buffer to the specified stream. - /// - /// The stream to which the buffer contents will be written. - /// A token to monitor for cancellation requests. - /// A task that represents the asynchronous write operation. - /// Thrown if the is null. - /// Thrown if the buffer has been disposed. - /// Thrown if the buffer is in an invalid state. - internal Task WriteToStreamAsync(Stream destination, CancellationToken cancellationToken) - { - Debug.Assert(this._rentedBuffer is not null, "_rentedBuffer is not null"); - return destination.WriteAsync(this._rentedBuffer, 0, this._index, cancellationToken); - } - - /// - /// Writes the contents of the buffer to the specified stream. - /// - /// The stream to which the buffer contents will be written. - /// Thrown if the is null. - /// Thrown if the buffer has been disposed. - /// Thrown if the buffer is in an invalid state. - internal void WriteToStream(Stream destination) - { - Debug.Assert(this._rentedBuffer is not null, "_rentedBuffer is not null"); - destination.Write(this._rentedBuffer!, 0, this._index); - } -#endif - - private void CheckAndResizeBuffer(int sizeHint) - { - Debug.Assert(_rentedBuffer is not null, "this._rentedBuffer is not null"); - Debug.Assert(sizeHint > 0, "sizeHint > 0"); - - int currentLength = _rentedBuffer!.Length; - int availableSpace = currentLength - _index; - - // If we've reached ~1GB written, grow to the maximum buffer - // length to avoid incessant minimal growths causing perf issues. - if (_index >= MaximumBufferSize / 2) - { - sizeHint = Math.Max(sizeHint, MaximumBufferSize - currentLength); - } - - if (sizeHint > availableSpace) - { - int growBy = Math.Max(sizeHint, currentLength); - - int newSize = currentLength + growBy; - - if ((uint)newSize > MaximumBufferSize) - { - newSize = currentLength + sizeHint; - if ((uint)newSize > MaximumBufferSize) - { - ThrowHelper.ThrowOutOfMemoryException_BufferMaximumSizeExceeded((uint)newSize); - } - } - - byte[] oldBuffer = _rentedBuffer; - - _rentedBuffer = ArrayPool.Shared.Rent(newSize); - - Debug.Assert(oldBuffer.Length >= _index, "oldBuffer.Length >= this._index"); - Debug.Assert(_rentedBuffer.Length >= _index, "this._rentedBuffer.Length >= this._index"); - - Span oldBufferAsSpan = oldBuffer.AsSpan(0, _index); - oldBufferAsSpan.CopyTo(_rentedBuffer); - oldBufferAsSpan.Clear(); - ArrayPool.Shared.Return(oldBuffer); - } - - Debug.Assert(_rentedBuffer.Length - _index > 0, "this._rentedBuffer.Length - this._index > 0"); - Debug.Assert(_rentedBuffer.Length - _index >= sizeHint, "this._rentedBuffer.Length - this._index >= sizeHint"); - } - - private void ClearHelper() - { - Debug.Assert(_rentedBuffer is not null, "this._rentedBuffer is not null"); - Debug.Assert(_index <= _rentedBuffer!.Length, "this._index <= this._rentedBuffer.Length"); - - _rentedBuffer.AsSpan(0, _index).Clear(); - _index = 0; - } - - /// - /// Provides helper methods for throwing exceptions within the class. - /// - /// - /// This class contains methods that throw specific exceptions used by the - /// to handle error conditions, such as exceeding the maximum buffer size. - /// - internal static partial class ThrowHelper - { - /// - /// Throws an when the buffer exceeds the maximum allowed size. - /// - /// The capacity that was attempted to be allocated, which exceeds the maximum buffer size. - /// Thrown when the buffer exceeds the maximum allowed size. - /// - /// This method is used internally by the class to handle scenarios where - /// an attempt is made to allocate a buffer larger than the maximum allowed size. - /// - [DoesNotReturn] - [MethodImpl(MethodImplOptions.NoInlining)] - public static void ThrowOutOfMemoryException_BufferMaximumSizeExceeded(uint capacity) - { - throw new OutOfMemoryException($"Buffer exceeded maximum capacity of {capacity}"); - } - } - } -} diff --git a/tests/Paramore.Test.Helpers/Loggers/ITestOutputLogger.cs b/tests/Paramore.Test.Helpers/Loggers/ITestOutputLogger.cs deleted file mode 100644 index 8288331029..0000000000 --- a/tests/Paramore.Test.Helpers/Loggers/ITestOutputLogger.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Microsoft.Extensions.Logging; -using Paramore.Test.Helpers.TestOutput; - -namespace Paramore.Test.Helpers.Loggers -{ - /// - /// Represents a logger interface that integrates with test output mechanisms. - /// This interface extends and provides additional properties - /// for test output logging, such as and - /// . - /// - public interface ITestOutputLogger : ILogger - { - /// - /// Gets the logging provider that integrates with test output mechanisms. - /// This property provides access to an instance of , - /// which enables logging with external scope support and test output capabilities. - /// - ITestOutputLoggingProvider TestOutputLoggingProvider { get; } - - /// - /// Gets the core test output helper associated with this logger. - /// - /// - /// This property provides access to an instance of , - /// which facilitates writing test output and log messages during test execution. - /// - ICoreTestOutputHelper TestOutputHelper { get; } - - /// - /// Gets or sets the minimum that will be logged by this logger. - /// - /// - /// This property determines the threshold for logging messages. Messages with a - /// lower than the specified value will not be logged. - /// - LogLevel LogLevel { get; set; } - - /// - /// Gets or sets the category name associated with the logger. - /// This property is used to identify the source or category of log messages, - /// enabling better organization and filtering of logs. - /// - string LoggerCategoryName { get; set; } - } - - /// - /// Represents a generic logger interface that integrates with test output mechanisms. - /// This interface extends and , - /// providing logging capabilities specific to a category type and test output. - /// - /// - /// The type used to categorize the logger. Typically, this is the type of the class using the logger. - /// - public interface ITestOutputLogger : ILogger, ITestOutputLogger; -} diff --git a/tests/Paramore.Test.Helpers/Loggers/ITestOutputLoggingProvider.cs b/tests/Paramore.Test.Helpers/Loggers/ITestOutputLoggingProvider.cs deleted file mode 100644 index efbab2f623..0000000000 --- a/tests/Paramore.Test.Helpers/Loggers/ITestOutputLoggingProvider.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Microsoft.Extensions.Logging; -using Paramore.Test.Helpers.TestOutput; - -namespace Paramore.Test.Helpers.Loggers -{ - /// - /// Provides an interface for a logging provider that integrates with test output mechanisms. - /// This interface extends and , - /// enabling the creation of loggers with external scope support and test output capabilities. - /// - public interface ITestOutputLoggingProvider : ILoggerProvider, ISupportExternalScope - { - /// - /// Gets the core test output helper used for writing test output. - /// - /// - /// This property provides access to an instance of , - /// which facilitates writing test output and managing test-related logging. - /// - ICoreTestOutputHelper TestOutputHelper { get; } - - /// - /// Gets or sets the external scope provider used to manage logging scopes. - /// - /// - /// The allows for managing and propagating - /// logging scopes across different loggers. This property is essential for - /// enabling structured logging with contextual information. - /// - IExternalScopeProvider ScopeProvider { get; set; } - - /// - /// Gets or sets the used for formatting log entries. - /// - /// - /// The formatter is responsible for converting log entries into a structured JSON format, - /// enabling enhanced readability and integration with structured logging systems. - /// - JsonConsoleFormatter Formatter { get; set; } - } -} diff --git a/tests/Paramore.Test.Helpers/Loggers/JsonConsoleFormatter.shared.cs b/tests/Paramore.Test.Helpers/Loggers/JsonConsoleFormatter.shared.cs deleted file mode 100644 index 5789dc985f..0000000000 --- a/tests/Paramore.Test.Helpers/Loggers/JsonConsoleFormatter.shared.cs +++ /dev/null @@ -1,502 +0,0 @@ -using System; -using System.Buffers; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Text.Json; -using System.Text.RegularExpressions; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; -using Microsoft.Extensions.Logging.Console; -using Microsoft.Extensions.Options; - -namespace Paramore.Test.Helpers.Loggers -{ - /// - /// Provides a JSON console formatter for logging, inheriting from . - /// - /// - /// This formatter outputs log entries in JSON format, making it suitable for structured logging scenarios. - /// It supports reloading of options and implements for resource management. - /// - public class JsonConsoleFormatter : ConsoleFormatter, IDisposable - { - /// - /// Represents the key used to format the original message in the logging system. - /// - /// - /// This constant is used within the logging infrastructure to identify and format the original message content. - /// - public const string KeyOriginalFormat = "{OriginalFormat}"; - - /// - /// Represents the key used to format the scope in the JSON console formatter. - /// - /// - /// This constant is used to identify and format the scope information in log entries - /// when using the . - /// - public const string KeyFormattedScope = "FormattedScope"; - - /// - /// The default timestamp format used by the . - /// - /// - /// This format follows the ISO 8601 standard with high precision, suitable for logging scenarios - /// where precise timestamps are required. The format is "yyyy-MM-ddTHH:mm:ss.fffffffZ". - /// - public const string DefaultTimestampFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - private readonly IDisposable? _optionsReloadToken; - private bool disposedValue; - - /// - /// Initializes a new instance of the class. - /// - /// The options monitor used to retrieve and manage . - /// Thrown when the parameter is null. - /// - /// This constructor sets up the formatter with the provided options and subscribes to changes in the options. - /// - public JsonConsoleFormatter(IOptionsMonitor options) - : base(ConsoleFormatterNames.Json) - { - if (options is null) - { - throw new ArgumentNullException(nameof(options)); - } - - ReloadLoggerOptions(options.CurrentValue); - _optionsReloadToken = options.OnChange(ReloadLoggerOptions); - } - - /// - /// Initializes a new instance of the class. - /// - /// The options monitor used to retrieve and manage . - /// Thrown when the parameter is null. - /// - /// This constructor sets up the formatter with the provided options and subscribes to changes in the options. - /// - public JsonConsoleFormatter(CoreJsonConsoleFormatterOptions options) - : base(ConsoleFormatterNames.Json) - { - if (options is null) - { - throw new ArgumentNullException(nameof(options)); - } - - ReloadLoggerOptions(options); - } - - /// - /// Gets or sets the options for configuring the JSON console formatter. - /// - /// - /// The used to configure the formatter. - /// - public CoreJsonConsoleFormatterOptions FormatterOptions { get; set; } - - /// - /// Formats a log message string by replacing placeholders with corresponding values from the provided dictionary. - /// - /// The format string containing placeholders in the form of {key}. - /// A dictionary containing key-value pairs to replace the placeholders in the format string. - /// - /// A formatted string where placeholders are replaced with corresponding values from the dictionary. - /// If the format string is null or empty, or if the values dictionary is null, the method returns "null". - /// - /// Thrown when the parameter is null. - public static string FormatLogString(string? format, IDictionary values) - { - if (string.IsNullOrEmpty(format) || values is null) - { - return "null"; - } - - string pattern = @"\{(\w+)\}"; - - return Regex.Replace(format, pattern, match => - { - string key = match.Groups[1].Value; - return (values.TryGetValue(key, out object? value) ? value : match.Value)?.ToString() ?? "null"; - }); - } - - /// - /// Writes a log entry in JSON format to the specified . - /// - /// The type of the state object associated with the log entry. - /// The log entry to write. - /// The provider of scope data. - /// The writer to which the log entry will be written. - /// - /// This method formats the log entry as a JSON object and writes it to the provided . - /// It includes details such as the log level, category, event ID, timestamp, message, exception (if any), - /// and state properties. - /// - public override void Write(in LogEntry logEntry, IExternalScopeProvider? scopeProvider, TextWriter textWriter) - { - if (textWriter is null) - { - throw new ArgumentNullException(nameof(textWriter)); - } - - string message = logEntry.Formatter(logEntry.State, logEntry.Exception); - - if (logEntry.Exception is null && string.IsNullOrEmpty(message)) - { - return; - } - - DateTimeOffset stamp = FormatterOptions.TimestampFormat is not null - ? (FormatterOptions.UseUtcTimestamp ? DateTimeOffset.UtcNow : DateTimeOffset.Now) - : DateTimeOffset.MinValue; - - // We extract most of the work into a non-generic method to save code size. If this was left in the generic - // method, we'd get generic specialization for all TState parameters, but that's unnecessary. - WriteInternal(scopeProvider, textWriter, message, logEntry.LogLevel, logEntry.Category, logEntry.EventId.Id, logEntry.Exception?.ToString(), logEntry.State is not null, logEntry.State?.ToString(), logEntry.State as IReadOnlyList>, stamp, FormatterOptions); - } - - /// - public void Dispose() - { - // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method - Dispose(disposing: true); - GC.SuppressFinalize(this); - } - - /// - /// Releases the resources used by the class. - /// - /// - /// This method is called to clean up any resources being used by the formatter, such as - /// the options reload token. It is part of the implementation of the interface. - /// - /// - /// A boolean value indicating whether the method has been called directly or indirectly by a user's code. - /// If true, both managed and unmanaged resources can be disposed; if false, only unmanaged resources can be disposed. - /// - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) - { - _optionsReloadToken?.Dispose(); - } - - disposedValue = true; - } - } - - private static string GetLogLevelString(LogLevel logLevel) - { - return logLevel switch - { - LogLevel.Trace => "Trace", - LogLevel.Debug => "Debug", - LogLevel.Information => "Information", - LogLevel.Warning => "Warning", - LogLevel.Error => "Error", - LogLevel.Critical => "Critical", - _ => throw new ArgumentOutOfRangeException(nameof(logLevel)), - }; - } - - private static void WriteItem(Utf8JsonWriter writer, KeyValuePair item) - { - var key = item.Key; - switch (item.Value) - { - case bool boolValue: - writer.WriteBoolean(key, boolValue); - break; - case byte byteValue: - writer.WriteNumber(key, byteValue); - break; - case sbyte sbyteValue: - writer.WriteNumber(key, sbyteValue); - break; - case char charValue: -#if NETCOREAPP - writer.WriteString(key, MemoryMarshal.CreateSpan(ref charValue, 1)); -#else - writer.WriteString(key, charValue.ToString()); -#endif - break; - case decimal decimalValue: - writer.WriteNumber(key, decimalValue); - break; - case double doubleValue: - writer.WriteNumber(key, doubleValue); - break; - case float floatValue: - writer.WriteNumber(key, floatValue); - break; - case int intValue: - writer.WriteNumber(key, intValue); - break; - case uint uintValue: - writer.WriteNumber(key, uintValue); - break; - case long longValue: - writer.WriteNumber(key, longValue); - break; - case ulong ulongValue: - writer.WriteNumber(key, ulongValue); - break; - case short shortValue: - writer.WriteNumber(key, shortValue); - break; - case ushort ushortValue: - writer.WriteNumber(key, ushortValue); - break; - case null: - writer.WriteNull(key); - break; - default: - writer.WriteString(key, ToInvariantString(item.Value)); - break; - } - } - - private static string? ToInvariantString(object? obj) - { - return Convert.ToString(obj, CultureInfo.InvariantCulture); - } - - private void WriteInternal( - IExternalScopeProvider? scopeProvider, - TextWriter textWriter, - string? message, - LogLevel logLevel, - string category, - int eventId, - string? exception, - bool hasState, - string? stateMessage, - IReadOnlyList>? stateProperties, - DateTimeOffset stamp, - CoreJsonConsoleFormatterOptions formatterOptions) - { - if (textWriter is null) - { - throw new ArgumentNullException(nameof(textWriter)); - } - - const int DefaultBufferSize = 1024; - - using (var output = new CorePooledByteBufferWriter(DefaultBufferSize)) - { - using (var writer = new Utf8JsonWriter(output, FormatterOptions.JsonWriterOptions)) - { - writer.WriteStartObject(); - - foreach (CoreLoggingFormatterOptions formatField in FormatterOptions.FormatterFields) - { - switch (formatField) - { - case CoreLoggingFormatterOptions.Timestamp: - { - string? timestampFormat = FormatterOptions.TimestampFormat; - - if (timestampFormat is not null) - { - writer.WriteString("Timestamp", stamp.ToString(timestampFormat)); - } - - break; - } - - case CoreLoggingFormatterOptions.EventId: - { - writer.WriteNumber(nameof(LogEntry.EventId), eventId); - break; - } - - case CoreLoggingFormatterOptions.LogLevel: - { - writer.WriteString(nameof(LogEntry.LogLevel), GetLogLevelString(logLevel)); - break; - } - - case CoreLoggingFormatterOptions.Category: - { - writer.WriteString(nameof(LogEntry.Category), category); - break; - } - - case CoreLoggingFormatterOptions.Message: - { - writer.WriteString("Message", message); - break; - } - - case CoreLoggingFormatterOptions.Exception: - { - if (exception is not null) - { - writer.WriteString(nameof(Exception), exception); - } - - break; - } - - case CoreLoggingFormatterOptions.ScopeMessageWithProperties: - case CoreLoggingFormatterOptions.ScopeProperties: - case CoreLoggingFormatterOptions.ScopeMessage: - { - bool writtenState = false; - - if (hasState) - { - if (formatField.HasFlag(CoreLoggingFormatterOptions.ScopeMessage)) - { - writer.WriteStartObject(nameof(LogEntry.State)); - writer.WriteString("Message", stateMessage); - writtenState = true; - } - - if (stateProperties is not null && formatField.HasFlag(CoreLoggingFormatterOptions.ScopeProperties)) - { - foreach (KeyValuePair item in stateProperties) - { - if (formatterOptions.StateKeysToExclude.Contains(item.Key)) - { - continue; - } - - if (!writtenState) - { - writer.WriteStartObject(nameof(LogEntry.State)); - writtenState = true; - } - - WriteItem(writer, item); - } - } - - if (writtenState) - { - writer.WriteEndObject(); - } - } - - WriteScopeInformation(writer, scopeProvider, formatterOptions.StateKeysToExclude); - - break; - } - - default: - { - break; - } - } - } - - writer.WriteEndObject(); - writer.Flush(); - } - - ReadOnlySpan messageBytes = output.WrittenMemory.Span; - var logMessageBuffer = ArrayPool.Shared.Rent(Encoding.UTF8.GetMaxCharCount(messageBytes.Length)); - - try - { -#if NETSTANDARD2_0_OR_GREATER - textWriter.Write(Encoding.UTF8.GetString(output.WrittenMemory.Span.ToArray())); -#else - var charsWritten = Encoding.UTF8.GetChars(messageBytes, logMessageBuffer); - textWriter.Write(logMessageBuffer, 0, charsWritten); -#endif - } - finally - { - ArrayPool.Shared.Return(logMessageBuffer); - } - } - - textWriter.Write(","); - } - - private void WriteScopeInformation(Utf8JsonWriter writer, IExternalScopeProvider? scopeProvider, HashSet stateKeysToExclude) - { - bool scopeWritten = false; - if (FormatterOptions.IncludeScopes && scopeProvider is not null) - { - scopeProvider.ForEachScope( - (scope, scopeWriter) => - { - if (!scopeWritten) - { - writer.WriteStartArray("Scopes"); - scopeWritten = true; - } - - var dictionaryKvp = scope as IDictionary; - - if (dictionaryKvp is null) - { - if (scope is IDictionary dictionary) - { - dictionaryKvp = new Dictionary(); - - foreach (object? itemKey in dictionary.Keys) - { - string? itemKeyString = itemKey?.ToString(); - - if (itemKey is not null && !string.IsNullOrEmpty(itemKeyString)) - { - dictionaryKvp.Add(new KeyValuePair(itemKeyString!, dictionary[itemKey])); - } - } - } - else if (scope is IEnumerable> scopeItems) - { - dictionaryKvp = scopeItems.ToDictionary(); - } - } - - if (dictionaryKvp is not null && dictionaryKvp.Any()) - { - scopeWriter.WriteStartObject(); - - foreach (KeyValuePair kvp in dictionaryKvp) - { - if (kvp.Key.Equals(KeyOriginalFormat, StringComparison.InvariantCultureIgnoreCase)) - { - WriteItem(scopeWriter, new KeyValuePair(KeyFormattedScope, FormatLogString(kvp.Value?.ToString(), dictionaryKvp))); - continue; - } - - WriteItem(scopeWriter, kvp); - } - - scopeWriter.WriteEndObject(); - } - else - { - scopeWriter.WriteStringValue(ToInvariantString(scope)); - } - }, - writer); - - if (scopeWritten) - { - writer.WriteEndArray(); - } - } - } - - [MemberNotNull(nameof(FormatterOptions))] - private void ReloadLoggerOptions(CoreJsonConsoleFormatterOptions options) - { - FormatterOptions = options; - } - } -} diff --git a/tests/Paramore.Test.Helpers/Loggers/TestOutputLogger.cs b/tests/Paramore.Test.Helpers/Loggers/TestOutputLogger.cs deleted file mode 100644 index 7477dd2658..0000000000 --- a/tests/Paramore.Test.Helpers/Loggers/TestOutputLogger.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.IO; -using System.Text; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; -using Paramore.Test.Helpers.Extensions; -using Paramore.Test.Helpers.TestOutput; - -namespace Paramore.Test.Helpers.Loggers -{ - public class TestOutputLogger : ITestOutputLogger - { - [ThreadStatic] - private static StringWriter? _threadStringWriter; - - public TestOutputLogger(ITestOutputLoggingProvider testOutputLoggingProvider, string loggerCategoryName, LogLevel logLevel = LogLevel.Debug) - { - TestOutputLoggingProvider = testOutputLoggingProvider ?? throw new ArgumentNullException(nameof(testOutputLoggingProvider)); - LoggerCategoryName = loggerCategoryName; - LogLevel = logLevel; - } - - /// - public ITestOutputLoggingProvider TestOutputLoggingProvider { get; } - - /// - public ICoreTestOutputHelper TestOutputHelper => TestOutputLoggingProvider.TestOutputHelper; - - /// - public LogLevel LogLevel { get; set; } - - /// - public string LoggerCategoryName { get; set; } - - /// - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) - { - if (formatter is null) - { - throw new ArgumentNullException(nameof(formatter)); - } - - if (IsEnabled(logLevel)) - { - _threadStringWriter ??= new StringWriter(); - LogEntry logEntry = new(logLevel, LoggerCategoryName, eventId, state, exception, formatter); - - TestOutputLoggingProvider.Formatter.Write(in logEntry, TestOutputLoggingProvider.ScopeProvider, _threadStringWriter); - - StringBuilder sb = _threadStringWriter.GetStringBuilder(); - - if (sb.Length == 0) - { - return; - } - - string computedAnsiString = sb.ToString(); - - sb.Clear(); - - if (sb.Capacity > 1024) - { - sb.Capacity = 1024; - } - - TestOutputHelper.WriteLogLine(computedAnsiString); - } - } - - /// - public bool IsEnabled(LogLevel logLevel) - { - return LogLevel != LogLevel.None && logLevel >= LogLevel; - } - - /// - public IDisposable? BeginScope(TState state) where TState : notnull - { - return TestOutputLoggingProvider.ScopeProvider?.Push(state); - } - } - - /// - /// A generic implementation of that provides logging capabilities - /// for a specific category type, integrating with test output mechanisms. - /// - /// - /// The type used to categorize the logger. Typically, this is the type of the class using the logger. - /// - public class TestOutputLogger : TestOutputLogger, ITestOutputLogger - { - /// - /// Initializes a new instance of the class. - /// This constructor sets up a logger for the specified category type, integrating with test output mechanisms. - /// - /// - /// The instance used to provide test output logging capabilities. - /// - /// - /// The minimum for messages to be logged. Defaults to . - /// - /// - /// Thrown when is null. - /// - public TestOutputLogger(ITestOutputLoggingProvider testOutputLoggingProvider, LogLevel logLevel = LogLevel.Debug) - : base(testOutputLoggingProvider, typeof(TCategoryName).GetLoggerCategoryName(), logLevel) - { - } - } -} diff --git a/tests/Paramore.Test.Helpers/Loggers/TestOutputLoggingProvider.cs b/tests/Paramore.Test.Helpers/Loggers/TestOutputLoggingProvider.cs deleted file mode 100644 index f82e891e1a..0000000000 --- a/tests/Paramore.Test.Helpers/Loggers/TestOutputLoggingProvider.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Text.Json; -using Microsoft.Extensions.Logging; -using Paramore.Test.Helpers.TestOutput; - -namespace Paramore.Test.Helpers.Loggers -{ - public class TestOutputLoggingProvider : ITestOutputLoggingProvider - { - public TestOutputLoggingProvider(ICoreTestOutputHelper testOutputHelper) - { - TestOutputHelper = testOutputHelper ?? throw new ArgumentNullException(nameof(testOutputHelper)); - Formatter = new JsonConsoleFormatter(SetDefaultOptions(new CoreJsonConsoleFormatterOptions())); - } - - public ICoreTestOutputHelper TestOutputHelper { get; } - - public IExternalScopeProvider ScopeProvider { get; set; } = new LoggerExternalScopeProvider(); - - public JsonConsoleFormatter Formatter { get; set; } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - public ILogger CreateLogger(string categoryName) - { - return new TestOutputLogger(this, categoryName); - } - - public void SetScopeProvider(IExternalScopeProvider scopeProvider) - { - ScopeProvider = scopeProvider; - } - - protected virtual void Dispose(bool disposing) - { - if (disposing) - { - // TODO release managed resources here - } - } - - /// - /// Configures the default options for the . - /// - /// The options to configure. Cannot be . - private static CoreJsonConsoleFormatterOptions SetDefaultOptions(CoreJsonConsoleFormatterOptions options) - { - if (options is null) - { - throw new ArgumentNullException(nameof(options)); - } - - options.JsonWriterOptions = new JsonWriterOptions() { Indented = true, }; - options.IncludeScopes = true; - options.UseUtcTimestamp = true; - options.TimestampFormat = JsonConsoleFormatter.DefaultTimestampFormat; - options.StateKeysToExclude.Add(JsonConsoleFormatter.KeyOriginalFormat); - - return options; - } - } - -} diff --git a/tests/Paramore.Test.Helpers/Paramore.Test.Helpers.csproj b/tests/Paramore.Test.Helpers/Paramore.Test.Helpers.csproj deleted file mode 100644 index 551f2387eb..0000000000 --- a/tests/Paramore.Test.Helpers/Paramore.Test.Helpers.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - $(BrighterTestTargetFrameworks) - enable - false - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/Paramore.Test.Helpers/TestOutput/CoreTestOutputHelper.cs b/tests/Paramore.Test.Helpers/TestOutput/CoreTestOutputHelper.cs deleted file mode 100644 index 15158a5c33..0000000000 --- a/tests/Paramore.Test.Helpers/TestOutput/CoreTestOutputHelper.cs +++ /dev/null @@ -1,229 +0,0 @@ -using System; -using System.Globalization; -using System.Text; -using System.Threading; -using Paramore.Test.Helpers.Base; -using Paramore.Test.Helpers.Extensions; -using Xunit.Abstractions; - -namespace Paramore.Test.Helpers.TestOutput -{ - /// - /// Class CoreTestOutputHelper. Base class for all xUnit tests. - /// - public class CoreTestOutputHelper : ICoreTestOutputHelper - { - private readonly ReaderWriterLockSlim _rwlsTestOutput = new(LockRecursionPolicy.SupportsRecursion); - private readonly StringBuilder sbTestOutput = new(128); - private bool isDisposed; - private bool wroteLog = false; - - /// - /// Initializes a new instance of the class. - /// - /// The test output helper instance. - public CoreTestOutputHelper(ITestClassBase testCase, ITestOutputHelper testOutputHelper) - { - TestCase = testCase; - WrappedTestOutputHelper = testOutputHelper ?? throw new ArgumentNullException(nameof(testOutputHelper)); - } - - public ITestClassBase TestCase { get; } - - /// - public ITestOutputHelper WrappedTestOutputHelper { get; } - - /// - public DateTime DateTimeStart { get; } = DateTime.UtcNow; - - /// - public string Output => sbTestOutput.ToString(); - - /// - public void Write(string message) - { - _rwlsTestOutput.EnterWriteLock(); - - try - { - sbTestOutput.Append($"{message}"); - } - finally - { - _rwlsTestOutput.ExitWriteLock(); - } - } - - /// - public void Write(string format, params object[] args) - { - Write($"{string.Format(format, args)}"); - } - - /// - public void WriteLine(string message) - { - _rwlsTestOutput.EnterWriteLock(); - - try - { - sbTestOutput.AppendLine($"{message}"); - } - finally - { - _rwlsTestOutput.ExitWriteLock(); - } - } - - /// - public void WriteLine(string format, params object[] args) - { - WriteLine($"{string.Format(format, args)}"); - } - - /// - public void WriteLine() - { - WriteLine(string.Empty); - } - - /// - public void WriteLine(bool value) - { - WriteLine(value.ToString()); - } - - /// - public void WriteLine(char value) - { - WriteLine(value.ToString()); - } - - /// - public void WriteLine(decimal value) - { - WriteLine(value.ToString(CultureInfo.InvariantCulture)); - } - - /// - public void WriteLine(double value) - { - WriteLine(value.ToString(CultureInfo.InvariantCulture)); - } - - /// - public void WriteLine(float value) - { - WriteLine(value.ToString(CultureInfo.InvariantCulture)); - } - - /// - public void WriteLine(int value) - { - WriteLine(value.ToString()); - } - - /// - public void WriteLine(uint value) - { - WriteLine(value.ToString()); - } - - /// - public void WriteLine(long value) - { - WriteLine(value.ToString()); - } - - /// - public void WriteLine(ulong value) - { - WriteLine(value.ToString()); - } - - /// - public void WriteLine(object? value) - { - WriteLine(value?.ToString() ?? string.Empty); - } - - /// - public void WriteLogLine(string message) - { - _rwlsTestOutput.EnterWriteLock(); - try - { - if (!wroteLog) - { - wroteLog = true; - WrappedTestOutputHelper.WriteLine("["); - } - - WrappedTestOutputHelper.WriteLine(message); - } - catch (Exception ex) - { - Console.WriteLine($"Exception: {ex.Message}\tMessage: {message}"); - } - finally - { - _rwlsTestOutput.ExitWriteLock(); - } - } - - /// - /// Dispose method. - /// - public void Dispose() - { - // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method - Dispose(disposing: true); - GC.SuppressFinalize(this); - } - - - - /// - /// Disposes and flushes buffer. - /// - /// - protected virtual void Dispose(bool disposing) - { - if (isDisposed) - { - return; - } - - isDisposed = true; - - if (disposing) - { - _rwlsTestOutput.EnterUpgradeableReadLock(); - DateTime dateTimeNow = DateTime.UtcNow; - string logEnding = wroteLog ? "]\n" : string.Empty; - - string[] testOutputStrings = - [ - $"{TestCase.TestDisplayName}", - //$"{this.TestCase.TestClassType.GetTraitOperatingSystem()} {this.TestCase.TestClassType.GetTraitTestType()} {this.TestCase.TestAssembly.GetFrameworkDisplayName()} ({RuntimeInformation.OSArchitecture})", - $"S: {DateTimeStart:o}", - $"C: {dateTimeNow:o}", - $"D: {dateTimeNow - DateTimeStart:c}" - ]; - - try - { - WrappedTestOutputHelper.WriteLine($"{logEnding}{testOutputStrings.CenterTitles('=', ' ', 2)}\n{sbTestOutput}"); - } - catch (Exception ex) - { - Console.WriteLine($"Exception:\n{ex.Message}\n{testOutputStrings.CenterTitles('=', ' ', 2)}\n{sbTestOutput}"); - } - finally - { - _rwlsTestOutput.ExitUpgradeableReadLock(); - } - } - } - } -} diff --git a/tests/Paramore.Test.Helpers/TestOutput/ICoreTestOutputHelper.cs b/tests/Paramore.Test.Helpers/TestOutput/ICoreTestOutputHelper.cs deleted file mode 100644 index 8736ad8aed..0000000000 --- a/tests/Paramore.Test.Helpers/TestOutput/ICoreTestOutputHelper.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System; -using Paramore.Test.Helpers.Base; -using Xunit.Abstractions; - -namespace Paramore.Test.Helpers.TestOutput -{ - public interface ICoreTestOutputHelper : ITestOutputHelper, IDisposable - { - /// - /// Gets the test case associated with the current test output helper. - /// - /// - /// This property provides access to the - /// instance representing the test case. It is used to retrieve information and dependencies - /// related to the test being executed. - /// - ITestClassBase TestCase { get; } - - /// - /// Gets the wrapped instance of used for test output handling. - /// - ITestOutputHelper WrappedTestOutputHelper { get; } - - /// - /// Gets the UTC date and time when the test output helper was initialized. - /// - /// - /// A representing the start time of the test output helper. - /// - DateTime DateTimeStart { get; } - - /// - /// Gets the accumulated output written by the test output helper. - /// - /// - /// A containing the concatenated output messages. - /// - string Output { get; } - - /// - /// Writes a message to the test output. - /// - /// The message to write. - void Write(string message); - - /// - /// Writes a formatted message to the test output. - /// - /// A composite format string. - /// An array of objects to format. - /// - /// This method formats the specified string and arguments, then writes the resulting message to the test output. - /// - void Write(string format, params object[] args); - - /// - /// Writes an empty line to the test output. - /// - void WriteLine(); - - /// - /// Writes a log message to the test output. If it is the first log message, it also writes an opening bracket. - /// - /// The log message to write. - /// - /// This method ensures thread safety when writing log messages and handles exceptions gracefully. - /// - void WriteLogLine(string message); - - /// - /// Writes a boolean value followed by a line terminator to the test output. - /// - /// The boolean value to write. - void WriteLine(bool value); - - /// - /// Writes a character followed by a line terminator to the test output. - /// - /// The character to write. - void WriteLine(char value); - - /// - /// Writes a decimal value followed by a line terminator to the test output. - /// - /// The decimal value to write. - /// - /// This method ensures thread safety when writing the value to the test output. - /// - void WriteLine(decimal value); - - /// - /// Writes a double-precision floating-point number followed by a line terminator to the test output. - /// - /// The double-precision floating-point number to write. - /// - /// This method inherits its behavior from the base implementation and ensures thread safety when writing the value. - /// - void WriteLine(double value); - - /// - /// Writes a single-precision floating-point number followed by a line terminator to the test output. - /// - /// The single-precision floating-point number to write. - /// - /// This method inherits its behavior from the base implementation and ensures thread safety when writing the value. - /// - void WriteLine(float value); - - /// - /// Writes a 32-bit signed integer followed by a line terminator to the test output. - /// - /// The 32-bit signed integer to write. - /// - /// This method ensures thread safety when writing the value to the test output. - /// - void WriteLine(int value); - - /// - /// Writes an unsigned integer value followed by a line terminator to the test output. - /// - /// The unsigned integer value to write. - /// - /// This method utilizes the string representation of the unsigned integer value - /// and ensures thread safety when writing to the test output. - /// - void WriteLine(uint value); - - /// - /// Writes a 64-bit signed integer followed by a line terminator to the test output. - /// - /// The 64-bit signed integer to write. - /// - /// This method delegates the writing operation to the string-based method. - /// - void WriteLine(long value); - - /// - /// Writes an unsigned long integer value followed by a line terminator to the test output. - /// - /// The unsigned long integer value to write. - /// - /// This method delegates the conversion of the value to its string representation - /// and writes it to the test output. - /// - void WriteLine(ulong value); - - /// - /// Writes the string representation of the specified object, followed by a line terminator, to the test output. - /// - /// The object whose string representation is to be written. If null, an empty string is written. - /// - /// This method ensures that null values are handled gracefully by converting them to an empty string before writing. - /// - void WriteLine(object? value); - } -}