Table of Contents

Class GovernanceTestHarnessOptions

Namespace
AsiBackbone.Testing
Assembly
AsiBackbone.Testing.dll

Configures deterministic services for exercising AsiBackbone-governed endpoints in tests.

public sealed class GovernanceTestHarnessOptions
Inheritance
GovernanceTestHarnessOptions
Inherited Members

Properties

DefaultCapabilityGrantDecision

Gets the default capability-grant validation decision used by the test harness.

public GovernanceDecision DefaultCapabilityGrantDecision { get; }

Property Value

GovernanceDecision

DefaultPolicyDecision

Gets the default policy decision used when no explicit policy result is configured.

public GovernanceDecision DefaultPolicyDecision { get; }

Property Value

GovernanceDecision

PolicyResults

Gets the configured deterministic policy results.

public IReadOnlyDictionary<string, GovernanceDecision> PolicyResults { get; }

Property Value

IReadOnlyDictionary<string, GovernanceDecision>

RegisterDeterministicSigningService

Gets or sets a value indicating whether the harness registers a deterministic no-signature signing service.

public bool RegisterDeterministicSigningService { get; set; }

Property Value

bool

RegisterInMemoryAuditSink

Gets or sets a value indicating whether the harness registers GovernanceTestDecisionReceiptSink as the host decision receipt sink.

public bool RegisterInMemoryAuditSink { get; set; }

Property Value

bool

RegisterInMemoryOutboxStore

Gets or sets a value indicating whether the harness registers the non-durable in-memory outbox store.

public bool RegisterInMemoryOutboxStore { get; set; }

Property Value

bool

RequireExplicitPolicyResults

Gets a value indicating whether every policy marker must have an explicit configured result.

public bool RequireExplicitPolicyResults { get; }

Property Value

bool

Methods

AllowAllPolicies()

Uses an allow decision as the default policy result.

public GovernanceTestHarnessOptions AllowAllPolicies()

Returns

GovernanceTestHarnessOptions

AllowCapabilityGrants()

Uses an allow decision as the default capability-grant validation result.

public GovernanceTestHarnessOptions AllowCapabilityGrants()

Returns

GovernanceTestHarnessOptions

DenyAllPolicies(string, string)

Uses a deny decision as the default policy result.

public GovernanceTestHarnessOptions DenyAllPolicies(string code = "test_harness.policy_denied", string message = "Denied by the AsiBackbone test harness.")

Parameters

code string
message string

Returns

GovernanceTestHarnessOptions

DenyCapabilityGrants(string, string)

Uses a deny decision as the default capability-grant validation result.

public GovernanceTestHarnessOptions DenyCapabilityGrants(string code = "test_harness.capability_denied", string message = "Capability grant denied by the AsiBackbone test harness.")

Parameters

code string
message string

Returns

GovernanceTestHarnessOptions

RequirePolicyResult(Type, GovernanceDecision)

Requires explicit deterministic policy results and configures the supplied marker type.

public GovernanceTestHarnessOptions RequirePolicyResult(Type policyType, GovernanceDecision decision)

Parameters

policyType Type
decision GovernanceDecision

Returns

GovernanceTestHarnessOptions

RequirePolicyResult<TPolicy>(GovernanceDecision)

Requires explicit deterministic policy results and configures the supplied marker type.

public GovernanceTestHarnessOptions RequirePolicyResult<TPolicy>(GovernanceDecision decision)

Parameters

decision GovernanceDecision

Returns

GovernanceTestHarnessOptions

Type Parameters

TPolicy

SetPolicyResult(Type, GovernanceDecision)

Sets a deterministic result for a policy marker type.

public GovernanceTestHarnessOptions SetPolicyResult(Type policyType, GovernanceDecision decision)

Parameters

policyType Type

The policy marker type to configure a result for.

decision GovernanceDecision

The decision the harness returns for endpoints marked with that type.

Returns

GovernanceTestHarnessOptions

The same options instance so calls can be chained.

Remarks

This is a harness-only capability. It simulates a host-supplied decision policy that reads the endpoint.policy_types metadata entry and varies its outcome by policy type. AsiBackbone itself does not select constraints or decisions from an endpoint's policy type, so configuring different results for two policy types asserts against host policy the application must actually implement. Without that host decision policy, both endpoints evaluate identically at runtime.

SetPolicyResult<TPolicy>(GovernanceDecision)

Sets a deterministic result for a policy marker type.

public GovernanceTestHarnessOptions SetPolicyResult<TPolicy>(GovernanceDecision decision)

Parameters

decision GovernanceDecision

Returns

GovernanceTestHarnessOptions

Type Parameters

TPolicy