Skip to main content
Table of Contents

Class TestSessionContext

Namespace
Stratara.Testing
Assembly
Stratara.Testing.dll

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

actorTenantId Guid

The tenant that triggered the operation (audit dimension).

actorUserId Guid

The user that triggered the operation (audit dimension).

tenantId Guid

The Subject (data-owner) tenant id (routing, encryption AAD, query filter).

userId Guid?

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

tenantId Guid

The Subject (data-owner) tenant id, also used as the Actor tenant id.

userId Guid?

The Subject/Actor user id, or null for a tenant-only context.

Returns

SessionContext

A populated SessionContext.