diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 7d43d58..8411bd2 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -25,10 +25,9 @@ jobs: - name: Run Unit Tests run: | echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}" - dotnet test "MessagingService.BusinessLogic.Tests\MessagingService.BusinessLogic.Tests.csproj" --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=businesslogic-test-results.trx" - dotnet test "MessagingService.EmailAggregate.Tests\MessagingService.EmailAggregate.Tests.csproj" --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=email-aggregate-test-results.trx" - dotnet test "MessagingService.SMSAggregate.Tests\MessagingService.SMSAggregate.Tests.csproj" --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=sms-aggregate-test-results.trx" - #dotnet test "MessagingService.Tests\MessagingService.Tests.csproj" --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=service-test-results.trx" + dotnet test "MessagingService.BusinessLogic.Tests/MessagingService.BusinessLogic.Tests.csproj" --configuration Release --verbosity normal -- --report-trx + dotnet test "MessagingService.EmailAggregate.Tests/MessagingService.EmailAggregate.Tests.csproj" --configuration Release --verbosity normal -- --report-trx + dotnet test "MessagingService.SMSAggregate.Tests/MessagingService.SMSAggregate.Tests.csproj" --configuration Release --verbosity normal -- --report-trx - name: Build Docker Image env: @@ -36,14 +35,14 @@ jobs: run: docker build . --file MessagingService/Dockerfile --tag messagingservice:latest --build-arg NUGET_TOKEN=${{ secrets.PRIVATEFEED_APIKEY }} - name: Run Integration Tests - run: dotnet test "MessagingService.IntegrationTests\MessagingService.IntegrationTests.csproj" --filter Category=PRTest --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=integration-test-results.trx" + run: dotnet test "MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj" --filter Category=PRTest --configuration Release --verbosity normal --results-directory "${{ github.workspace }}/TestResults" --settings "MessagingService.IntegrationTests/Integration.runsettings" - uses: actions/upload-artifact@v4.4.0 with: name: tracelogs path: /home/runner/trace/ - - name: Publish test results + - name: Publish unit test results uses: dorny/test-reporter@v1 if: always() with: @@ -51,7 +50,16 @@ jobs: path: '**/TestResults/*.trx' reporter: dotnet-trx fail-on-error: true - + + - name: Publish integration test results + uses: dorny/test-reporter@v1 + if: always() + with: + name: Integration Test Results + path: 'TestResults/MessagingService.IntegrationTests.xml' + reporter: dotnet-nunit + fail-on-error: true + - name: Upload test results uses: actions/upload-artifact@v4 if: always() @@ -59,3 +67,11 @@ jobs: name: test-results path: '**/TestResults/*.trx' retention-days: 30 + + - name: Upload integration test results + uses: actions/upload-artifact@v4 + if: always() + with: + name: integration-test-results + path: 'TestResults/MessagingService.IntegrationTests.xml' + retention-days: 30 diff --git a/Directory.Packages.props b/Directory.Packages.props index 0f76735..21ecfcb 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,61 +3,62 @@ true - - - - - - - + + + + + + + - - + + + - - + + - - - - - - + + + + + + - - - + + + - - + + - - + + - - - + + + - - + + - - - - - + + + + + - - + + - \ No newline at end of file + diff --git a/MessagingService.BusinessLogic.Tests/MessagingService.BusinessLogic.Tests.csproj b/MessagingService.BusinessLogic.Tests/MessagingService.BusinessLogic.Tests.csproj index 5263111..e1aeab2 100644 --- a/MessagingService.BusinessLogic.Tests/MessagingService.BusinessLogic.Tests.csproj +++ b/MessagingService.BusinessLogic.Tests/MessagingService.BusinessLogic.Tests.csproj @@ -4,12 +4,14 @@ net10.0 None false + Exe + diff --git a/MessagingService.EmailAggregate.Tests/MessagingService.EmailAggregate.Tests.csproj b/MessagingService.EmailAggregate.Tests/MessagingService.EmailAggregate.Tests.csproj index 093dd98..8aefbf0 100644 --- a/MessagingService.EmailAggregate.Tests/MessagingService.EmailAggregate.Tests.csproj +++ b/MessagingService.EmailAggregate.Tests/MessagingService.EmailAggregate.Tests.csproj @@ -4,10 +4,12 @@ net10.0 None false + Exe + diff --git a/MessagingService.IntegrationTests/Integration.runsettings b/MessagingService.IntegrationTests/Integration.runsettings new file mode 100644 index 0000000..baf0194 --- /dev/null +++ b/MessagingService.IntegrationTests/Integration.runsettings @@ -0,0 +1,6 @@ + + + Integration + UseResultDirectory + + diff --git a/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj b/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj index 5de79ba..76f726b 100644 --- a/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj +++ b/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj @@ -3,6 +3,8 @@ net10.0 false + true + Exe diff --git a/MessagingService.SMSAggregate.Tests/MessagingService.SMSAggregate.Tests.csproj b/MessagingService.SMSAggregate.Tests/MessagingService.SMSAggregate.Tests.csproj index 6a64d96..0dbd025 100644 --- a/MessagingService.SMSAggregate.Tests/MessagingService.SMSAggregate.Tests.csproj +++ b/MessagingService.SMSAggregate.Tests/MessagingService.SMSAggregate.Tests.csproj @@ -4,10 +4,12 @@ net10.0 None false + Exe + diff --git a/MessagingService.Tests/MessagingService.Tests.csproj b/MessagingService.Tests/MessagingService.Tests.csproj index 4adcaee..9f0c969 100644 --- a/MessagingService.Tests/MessagingService.Tests.csproj +++ b/MessagingService.Tests/MessagingService.Tests.csproj @@ -4,6 +4,7 @@ net10.0 None false + Exe @@ -11,6 +12,7 @@ + diff --git a/MessagingService/Bootstrapper/SerialiserRegistry.cs b/MessagingService/Bootstrapper/SerialiserRegistry.cs index 315f07d..e82def1 100644 --- a/MessagingService/Bootstrapper/SerialiserRegistry.cs +++ b/MessagingService/Bootstrapper/SerialiserRegistry.cs @@ -2,6 +2,7 @@ using System.Diagnostics.CodeAnalysis; using Lamar; using Microsoft.Extensions.DependencyInjection; +using Shared.EventStore.SubscriptionWorker; using Shared.Serialisation; namespace MessagingService.Bootstrapper; @@ -14,6 +15,13 @@ public SerialiserRegistry() this.AddSingleton(); this.AddSingleton>(_ => obj => StringSerialiser.Serialise(obj)); this.AddSingleton>(_ => (str, type) => StringSerialiser.DeserializeObject(str, type)); - this.AddSingleton(SystemTextJsonSerializer.GetDefaultJsonSerializerOptions()); + var serialiserSettings = SystemTextJsonSerializer.GetDefaultJsonSerializerOptions().AddModifier(JsonTypeInfoModifierExtensions.ForType(typeInfo => { + typeInfo.RenameProperty(x => x.StreamName, "eventStreamId"); + })); + + this.AddSingleton(serialiserSettings); + + + } } \ No newline at end of file diff --git a/global.json b/global.json new file mode 100644 index 0000000..3140116 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +}