Asset Event Testing
Summary
Existing coverage is smoke-test based: it drives the lifecycle, then asserts that outbox rows of the expected event types appear, and separately exercises the Notification parity path. Deeper automated event tests are recommended, not claimed.
Audience
Engineering, integration, QA, architecture, and security reviewers.
Reference Content
Existing smoke coverage (verified)
The asset smoke script produces the real lifecycle and inspects the outbox through the read endpoint:
| Coverage | Evidence |
|---|---|
| Outbox row present after a transition | Count-Event reads /asset/outbox and filters by eventType |
AssetAssigned produced on assign | Asserted after the assign path |
AssetRejected produced on reject | Asserted after the reject path |
| Audit, timeline, and outbox side effects | Asserted together after lifecycle steps |
Notification parity (-Notifications) | Drives all six payloads, checks completeness, feeds the notification dispatcher (broker-free) |
| Correlation header propagation | Requests set an X-Correlation-Id |
The notification parity smoke starts notification-service and asset-service, generates the real AssetRequested/Assigned/Returned/Rejected/LostOrDamaged/Retired payloads, verifies payload completeness, then routes each (with an enriched recipient email) through the broker-free notification test path.
Test types (do not conflate)
| Test type | Present today |
|---|---|
| Lifecycle-to-outbox smoke | Yes |
| Notification parity smoke | Yes |
| Contract unit tests | Not claimed |
| Producer/mapper unit tests | Not claimed |
| Consumer integration tests (broker) | Not claimed |
| End-to-end broker delivery tests | Not claimed |
Recommended future coverage
- Mapper unit tests asserting each domain event produces the correct contract and
EventType. - Completeness-guard tests asserting an incomplete snapshot rolls back and writes no outbox row.
- Consumer tests asserting each event maps to the correct
Asset.*template and recipient resolution branch. - Retry tests asserting a failed publish increments
RetryCountand is retried.
Public-safety note
Test commands, connection strings, hosts, and ports are intentionally excluded.
Source References
microservices/scripts/smoke-asset.ps1microservices/src/asset-service/Api/AssetEndpoints.csmicroservices/src/notification-service/Application/EventNotificationResolver.cs
Related Articles
See Also
Keywords
- Event testing
- Smoke tests
- Outbox assertions
Revision Information
- Status: Draft
- Last reviewed: 2026-07-17
- Review cycle: Quarterly