Class TestFunctionContext
- Namespace
- XBullet.EasyTesting.AzureFunctions
- Assembly
- XBullet.EasyTesting.AzureFunctions.dll
A minimal isolated-worker context with real dependency-injection services.
public sealed class TestFunctionContext : FunctionContext
- Inheritance
-
TestFunctionContext
- Inherited Members
Properties
BindingContext
Gets the binding context for the current function invocation. This context is used to retrieve binding data.
public override TestBindingContext BindingContext { get; }
Property Value
Bindings
Gets captured input and output bindings for this invocation.
public TestFunctionBindings Bindings { get; }
Property Value
- TestFunctionBindings
The context-owned binding collection, mutable only through context and invocation operations.
CancellationToken
Gets the CancellationToken that signals a function invocation is being cancelled.
public override CancellationToken CancellationToken { get; }
Property Value
Features
Gets a collection containing the features supported by this context.
public override IInvocationFeatures Features { get; }
Property Value
FunctionDefinition
Gets the FunctionDefinition that describes the function being executed.
public override TestFunctionDefinition FunctionDefinition { get; }
Property Value
FunctionId
Gets the function ID, typically assigned by the host. This identifier is unique to a function and stable across invocations.
public override string FunctionId { get; }
Property Value
FunctionName
Gets the friendly function name assigned by the test.
public string FunctionName { get; }
Property Value
- string
The non-empty name also used as this context's function identifier.
InstanceServices
Gets or sets the IServiceProvider that provides access to this execution's services.
public override IServiceProvider InstanceServices { get; set; }
Property Value
InvocationId
Gets the invocation ID. This identifier is unique to an invocation.
public override string InvocationId { get; }
Property Value
Items
Gets or sets a key/value collection that can be used to share data within the scope of this invocation.
public override IDictionary<object, object> Items { get; set; }
Property Value
RetryContext
Gets the retry context containing information about retry activity for the event that triggered the current function invocation.
public override RetryContext RetryContext { get; }
Property Value
TestRetryContext
Gets the strongly typed test retry context.
public TestRetryContext TestRetryContext { get; }
Property Value
- TestRetryContext
The current retry values, initially zero and replaced by WithRetry(int, int).
TestTraceContext
Gets the strongly typed test trace context.
public TestTraceContext TestTraceContext { get; }
Property Value
- TestTraceContext
The current mutable test trace values, replaced when WithTrace(string, string) is called.
TraceContext
Gets the distributed tracing context.
public override TraceContext TraceContext { get; }
Property Value
Methods
WithBindingData(string, object)
Adds a value to binding data and returns this context.
public TestFunctionContext WithBindingData(string name, object value)
Parameters
namestringThe non-empty binding-data key. Existing keys are replaced case-insensitively.
valueobjectThe non-null value to retain without cloning.
Returns
- TestFunctionContext
This context, for chaining.
WithFeature<T>(T)
Adds a typed invocation feature and returns this context.
public TestFunctionContext WithFeature<T>(T feature)
Parameters
featureTThe non-null feature instance retained by the invocation feature collection.
Returns
- TestFunctionContext
This context, for chaining.
Type Parameters
TThe feature's registration and lookup type.
WithInputBinding(string, object?, string)
Adds an input value and its function-definition metadata.
public TestFunctionContext WithInputBinding(string name, object? value, string bindingType = "input")
Parameters
namestringThe non-empty binding name. Existing captured values are replaced case-insensitively.
valueobjectThe value to retain without cloning, or null to capture a null input without adding it to binding data.
bindingTypestringThe non-empty worker binding type. The default is
input.
Returns
- TestFunctionContext
This context, for chaining.
WithItem(object, object)
Adds an invocation item and returns this context.
public TestFunctionContext WithItem(object key, object value)
Parameters
keyobjectThe non-null item key. An equal existing key is replaced.
valueobjectThe non-null value retained without cloning.
Returns
- TestFunctionContext
This context, for chaining.
WithOutputBinding(string, object?, string)
Adds an output value and its function-definition metadata.
public TestFunctionContext WithOutputBinding(string name, object? value, string bindingType = "output")
Parameters
namestringThe non-empty binding name. Existing captured values are replaced case-insensitively.
valueobjectThe output value to retain without cloning; null is accepted.
bindingTypestringThe non-empty worker binding type. The default is
output.
Returns
- TestFunctionContext
This context, for chaining.
WithRetry(int, int)
Sets retry state and returns this context.
public TestFunctionContext WithRetry(int retryCount, int maxRetryCount)
Parameters
retryCountintThe non-negative zero-based current retry count.
maxRetryCountintThe non-negative maximum retry count, greater than or equal to
retryCount.
Returns
- TestFunctionContext
This context, for chaining, with a newly allocated retry context.
WithTrace(string, string)
Sets distributed-tracing values and returns this context.
public TestFunctionContext WithTrace(string traceParent, string traceState = "")
Parameters
traceParentstringThe non-null W3C trace-parent text. Format validation is left to tested code.
traceStatestringThe non-null trace-state text. The default is an empty string.
Returns
- TestFunctionContext
This context, for chaining, with a newly allocated trace context.