From ea5a4ae5365564f3c771f38ce09751b7203dc82e Mon Sep 17 00:00:00 2001 From: Hans Christian Winther-Sorensen Date: Mon, 24 Jun 2024 01:11:47 +0200 Subject: [PATCH] TEST-0003 Fix test issue --- .github/workflows/backend-ci.yml | 5 +++-- .../WebApi.Tests/Controllers/BloggingControllerTests.cs | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index 319b0fd1..dcbf6097 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -139,12 +139,13 @@ jobs: run: dotnet test ../../tests/backend/WebApi.Tests --no-restore --collect:"XPlat Code Coverage" --logger "trx;LogFileName=test-results.trx" /p:CollectCoverage=true /p:CoverletOutput="../../tests/backend/WebApi.Tests/TestResults/" /p:CoverletOutputFormat=cobertura continue-on-error: true - - uses: hwinther/test-reporter@dotnet-nunit # TODO: set back to original once nunit is supported: dorny/test-reporter@v1 + #- uses: hwinther/test-reporter@dotnet-nunit # TODO: set back to original once nunit is supported: dorny/test-reporter@v1 + - uses: dorny/test-reporter@v1 id: test-reporter with: name: "WebApi Tests" path: "tests/backend/WebApi.Tests/TestResults/test-results.trx" - reporter: dotnet-nunit + reporter: dotnet-trx # dotnet-nunit fail-on-error: false - name: Generate report for all tests diff --git a/tests/backend/WebApi.Tests/Controllers/BloggingControllerTests.cs b/tests/backend/WebApi.Tests/Controllers/BloggingControllerTests.cs index 765a2fc9..1e366709 100644 --- a/tests/backend/WebApi.Tests/Controllers/BloggingControllerTests.cs +++ b/tests/backend/WebApi.Tests/Controllers/BloggingControllerTests.cs @@ -73,9 +73,7 @@ public async Task GetBlog_ValidId_ReturnsBlog() // Assert Assert.That(result, Is.InstanceOf>()); - var okResult = result.Result as OkObjectResult; - Assert.That(okResult, Is.Not.Null); - var returnedBlog = okResult.Value as BlogDto; + var returnedBlog = result.Value; Assert.That(returnedBlog, Is.Not.Null); Assert.Multiple(() => {