Skip to content

[Repo Assist] test: add Garage.ApiService.Tests with WinnerMapper unit tests #455

@github-actions

Description

@github-actions

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Adds the first .NET test project to the solution: Garage.ApiService.Tests. This addresses the improvement idea tracked in memory to add test coverage to the .NET codebase.

Changes

  • New project: src/Garage.ApiService.Tests/Garage.ApiService.Tests.csproj — xUnit test project referencing Garage.ApiService
  • New tests: Mappers/WinnerMapperTests.cs — 3 unit tests covering WinnerMapper:
    • All properties are mapped correctly from DataModels.WinnerSharedModels.Winner
    • Image is null (not present in the database model; mapper target ignores it)
    • Empty Drivers array is handled correctly
  • Directory.Packages.props: Added coverlet.collector, Microsoft.NET.Test.Sdk, xunit, and xunit.runner.visualstudio version entries
  • Garage.slnx: Added new test project to the solution
  • .github/workflows/ci.yml: Uncommented the dotnet test step and added src/Garage.ApiService.Tests/** to the dotnet path filter

Test Status

✅ Build: dotnet build --configuration Release — succeeded with 0 warnings, 0 errors
✅ Tests: dotnet test — 3/3 passed

Trade-offs

The WinnersService itself is not yet tested because it depends on GarageDbContext (EF Core) and IFeatureClient (OpenFeature), which require additional mocking infrastructure. WinnerMapper was chosen as the first test target because it has no external dependencies and the mapping logic is non-trivial enough to be worth covering.

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@b466f28f0f65b68d6f2b10b15b44f51d787b93be

Note

This was originally intended as a pull request, but the git push operation failed.

Workflow Run: View run details and download patch artifact

The patch file is available in the agent-artifacts artifact in the workflow run linked above.

To create a pull request with the changes:

# Download the artifact from the workflow run
gh run download 22716871790 -n agent-artifacts -D /tmp/agent-artifacts-22716871790

# Create a new branch
git checkout -b repo-assist/add-api-service-tests-3a145b99dfbe30ef

# Apply the patch (--3way handles cross-repo patches where files may already exist)
git am --3way /tmp/agent-artifacts-22716871790/aw-repo-assist-add-api-service-tests.patch

# Push the branch to origin
git push origin repo-assist/add-api-service-tests-3a145b99dfbe30ef

# Create the pull request
gh pr create --title '[Repo Assist] test: add Garage.ApiService.Tests with WinnerMapper unit tests' --base main --head repo-assist/add-api-service-tests-3a145b99dfbe30ef --repo askpt/openfeature-aspire-sample
Show patch preview (170 of 170 lines)
From 052dc6fbedceee02cc29da74237bedbb64e3dc11 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Thu, 5 Mar 2026 12:06:44 +0000
Subject: [PATCH] test: add Garage.ApiService.Tests project with WinnerMapper
 tests

Add a new xUnit test project Garage.ApiService.Tests covering the
WinnerMapper (Riok.Mapperly) mapping from the database model to the
shared DTO model:
- All properties are mapped correctly
- Image field is null (not present in the database model)
- Empty drivers array is handled correctly

Also:
- Add test package versions to Directory.Packages.props
- Add project to Garage.slnx solution
- Enable 'dotnet test' step in CI workflow (was commented out)
- Add Garage.ApiService.Tests path to CI dotnet path filter

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 .github/workflows/ci.yml                      |  5 +-
 Directory.Packages.props                      |  7 +++
 Garage.slnx                                   |  1 +
 .../Garage.ApiService.Tests.csproj            | 24 +++++++++
 .../Mappers/WinnerMapperTests.cs              | 49 +++++++++++++++++++
 5 files changed, 84 insertions(+), 2 deletions(-)
 create mode 100644 src/Garage.ApiService.Tests/Garage.ApiService.Tests.csproj
 create mode 100644 src/Garage.ApiService.Tests/Mappers/WinnerMapperTests.cs

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9c1fa56..423bb53 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -44,6 +44,7 @@ jobs:
               - 'src/Garage.ApiService/**'
               - 'src/Garage.ApiDatabaseSeeder/**'
               - 'src/Garage.ApiModel/**'
+              - 'src/Garage.ApiService.Tests/**'
               - 'src/Garage.AppHost/**'
               - 'src/Garage.ServiceDefaults/**'
               - 'src/Garage.Shared/**'
@@ -85,8 +86,8 @@ jobs:
         run: dotnet build --configuration Release
       - name: dotnet format
         run: dotnet format --veri
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions