Class TestSessionContext
Builds ready-made SessionContext values for tests, with fresh correlation + causation ids (so the context can drive event-store writes) and the Actor (who triggered) defaulted to the Subject (data owner) unless overridden.
public static class TestSessionContext
- Inheritance
-
TestSessionContext
- Inherited Members
Methods
ForActorAndSubject(Guid, Guid, Guid, Guid?)
A context with an explicit Actor / Subject split — for cross-tenant flows (e.g. a platform admin acting on behalf of a tenant) where audit (Actor) and ownership (Subject) differ.
public static SessionContext ForActorAndSubject(Guid actorTenantId, Guid actorUserId, Guid tenantId, Guid? userId = null)
Parameters
actorTenantIdGuidThe tenant that triggered the operation (audit dimension).
actorUserIdGuidThe user that triggered the operation (audit dimension).
tenantIdGuidThe Subject (data-owner) tenant id (routing, encryption AAD, query filter).
userIdGuid?The Subject (data-owner) user id, or null.
Returns
- SessionContext
A populated SessionContext.
ForTenant(Guid, Guid?)
A context owned by tenantId where the Actor equals the Subject — the common
"a user acting within their own tenant" case.
public static SessionContext ForTenant(Guid tenantId, Guid? userId = null)
Parameters
tenantIdGuidThe Subject (data-owner) tenant id, also used as the Actor tenant id.
userIdGuid?The Subject/Actor user id, or null for a tenant-only context.
Returns
- SessionContext
A populated SessionContext.