Background
Pet report commands such as Cancel and Resolve validate that PetReportId is not Guid.Empty. The Archive and Restore commands currently do not have their own FluentValidation validators.
The relevant commands are:
src/RescueLink.Application/Features/PetReports/Archive/ArchivePetReportCommand.cs
src/RescueLink.Application/Features/PetReports/Restore/RestorePetReportCommand.cs
Goal
Add consistent request validation for Archive and Restore operations without changing handler or domain behavior.
Files to Create
Create:
src/RescueLink.Application/Features/PetReports/Archive/ArchivePetReportCommandValidator.cs
src/RescueLink.Application/Features/PetReports/Restore/RestorePetReportCommandValidator.cs
Create tests:
tests/RescueLink.Application.Tests/Features/Archive/ArchivePetReportCommandValidatorTests.cs
tests/RescueLink.Application.Tests/Features/PetReports/Restore/RestorePetReportCommandValidatorTests.cs
Follow the existing pattern in:
src/RescueLink.Application/Features/PetReports/Cancel/CancelPetReportCommandValidator.cs
tests/RescueLink.Application.Tests/Features/PetReports/Cancel/CancelPetReportCommandValidatorTests.cs
Suggested Implementation
Each validator should:
- Inherit from
AbstractValidator<TCommand>.
- Add a rule for
PetReportId.
- Require the ID to be non-empty using
.NotEmpty().
- Avoid database calls or ownership checks inside the validator; those responsibilities remain in the handler/domain flow.
Each test class should cover:
- A valid
Guid produces a valid result.
Guid.Empty produces an invalid result.
- The invalid result contains one validation error.
Acceptance Criteria
Difficulty
Easy — suitable for someone learning FluentValidation and unit testing in .NET.
Before Starting
Please comment with a short plan and confirm that you have reviewed the existing Cancel validator and its tests.
Background
Pet report commands such as Cancel and Resolve validate that
PetReportIdis notGuid.Empty. The Archive and Restore commands currently do not have their own FluentValidation validators.The relevant commands are:
Goal
Add consistent request validation for Archive and Restore operations without changing handler or domain behavior.
Files to Create
Create:
Create tests:
Follow the existing pattern in:
Suggested Implementation
Each validator should:
AbstractValidator<TCommand>.PetReportId..NotEmpty().Each test class should cover:
Guidproduces a valid result.Guid.Emptyproduces an invalid result.Acceptance Criteria
ArchivePetReportCommandValidatoris added in the Archive feature folder.RestorePetReportCommandValidatoris added in the Restore feature folder.Guid.Empty.Guid.dotnet build RescueLink.slnxsucceeds.dotnet test RescueLink.slnxsucceeds.Difficulty
Easy — suitable for someone learning FluentValidation and unit testing in .NET.
Before Starting
Please comment with a short plan and confirm that you have reviewed the existing Cancel validator and its tests.