Introduce comprehensive documentation covering architecture (ARCHITECTURE.md), concerns (CONCERNS.md), coding conventions (CONVENTIONS.md), integrations (INTEGRATIONS.md), technology stack (STACK.md), codebase structure (STRUCTURE.md), and testing patterns (TESTING.md). Enhance testing with additional test cases for external sign-in flows, ensuring accurate timestamp recording for identity links.
2 KiB
2 KiB
Testing Patterns
Test Stack and Commands
- Framework: xUnit 2.9.3.
- Assertion/mocking: xUnit assertions, NSubstitute 5.3.0, ASP.NET Core TestServer, SQLite in-memory EF Core.
dotnet test Elsa.sln
dotnet test test/unit/Elsa.ExternalAuthentication.UnitTests/Elsa.ExternalAuthentication.UnitTests.csproj
dotnet test test/integration/Elsa.ExternalAuthentication.IntegrationTests/Elsa.ExternalAuthentication.IntegrationTests.csproj
Test Layout
- Test projects are separated under
test/unit,test/integration,test/component, andtest/performance. - Test files use
*Tests.cs; xUnit setup uses constructors orIAsyncLifetime. - Shared helpers live under
src/common/Elsa.Testing.Shared*.
Test Scope Matrix
| Scope | Covered | Typical target | Notes |
|---|---|---|---|
| Unit | Yes | Validators, in-memory stores, isolated services | Fast and dependency-light |
| Integration | Yes | Broker flow, REST endpoints, SQLite persistence | Used for external-auth tracking regression |
| Component | Yes | Workflow runtime behavior | Not needed for this identity defect |
| E2E browser | [TODO] |
Studio rendering | Studio repository is separate |
Mocking and Isolation Strategy
- Prefer real in-memory provisioners and stores for state assertions.
- Substitute adapters, role providers, and notification senders at boundaries.
- SQLite
Data Source=:memory:provides isolated durable-store tests.
Coverage and Quality Signals
- Coverlet generates Cobertura, LCOV, and OpenCover output.
- Default project threshold is 10% total line coverage.
- Focused filtered runs may disable coverage; the full project run enforces the threshold.
Evidence
test/Directory.Build.propstest/integration/Elsa.ExternalAuthentication.IntegrationTests/Broker/BrokerSecurityTests.cstest/integration/Elsa.ExternalAuthentication.IntegrationTests/Persistence/ExternalAuthenticationPersistenceTests.cstest/integration/Elsa.ExternalAuthentication.IntegrationTests/Links/ExternalIdentityLinkTests.cs