test: standardize unit tests across all services (31 tests)#89
Conversation
Add coverage tooling (coverlet), create missing test classes and event fixtures, extend test cases for all 7 Lambda functions, and remove extra tests to ensure parity with Python, Java, and TypeScript runtimes.
|
No related issues found. Please ensure there is an open issue related to this change to avoid significant delays or closure. |
|
No acknowledgement section found. Please make sure you used the template to open a PR and didn't remove the acknowledgment section. Check the template here: https://github.com/aws-samples/aws-serverless-developer-experience-workshop-dotnet/blob/develop/.github/PULL_REQUEST_TEMPLATE.md#acknowledgment |
Replace SQS envelope event files with raw PascalCase payload fixtures. Add LoadPayload helper, refactor tests to load from JSON files instead of NBuilder inline construction. Remove NBuilder dependency.
…xtures - Add NewContractStatusChangedEvent() builder method to TestHelpers for creating CloudWatchEvent test payloads - Add NewWaitForContractApprovalInput() builder method to TestHelpers for Step Functions task-token inputs - Replace inline event object construction in ContractStatusChangedEventHandlerTest with builder calls - Replace inline payload construction in WaitForContractApprovalFunctionTest with builder call - Remove legacy DynamoDbStreamEvents JSON fixture files from project configuration - Remove unused System.Text.Json import from WaitForContractApprovalFunctionTest - Remove unused Amazon.Lambda.CloudWatchEvents import from ContractStatusChangedEventHandlerTest (moved to TestHelpers) - Improves test maintainability by centralizing test data builders and eliminating duplication
# Conflicts: # Unicorn.Contracts/ContractsService.Test/ContractsService.Tests.csproj
|
Synced this branch with Conflict resolved: Verified after merge: |
Issue number: N/A
Summary
Changes
Standardize unit tests across all 4 .NET test projects to achieve exact parity with the Python, Java, and TypeScript runtimes (31 identical test cases across 7 Lambda functions).
coverlet.collectorNuGet package to all 4 test.csprojfiles for coverage reportingContractStatusChangedEventHandlerTest.cs,WaitForContractApprovalFunctionTest.cs(approvals), andPublicationEvaluationEventHandlerTest.cs(web)MissingNewImageShouldNotSendTaskSuccesstest and event fixture for PropertiesApprovalSyncFunctionsnake_case_jsontests from ContractEventHandler and RequestApproval) and redundantStatusIsDraftWithTokenfrom PropertiesApprovalSync to align test cases across runtimesUser experience
Workshop participants running
dotnet testwill see the same 31 test cases as in the other 3 runtimes, with coverage reporting enabled via coverlet.Checklist
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.