Class SwitchableLoggedBehavior<TIn, TOut>
Test utility to make behavior of functions that return some Task controllable form tests. This tool is able to override default behavior with any generic behavior, including failure, and exposes control to the timing of completion of the associated Task. The utility is implemented as a stack of behaviors, where the behavior on the top of the stack represents the currently active behavior. The bottom of the stack always contains the DefaultBehavior which can not be popped out.
Inherited Members
Namespace: Akka.Remote.Transport
Assembly: Akka.Remote.dll
Syntax
public class SwitchableLoggedBehavior<TIn, TOut>
Type Parameters
Name | Description |
---|---|
TIn | Input type |
TOut | Output type |
Constructors
| Improve this Doc View SourceSwitchableLoggedBehavior(Func<TIn, Task<TOut>>, Action<TIn>)
TBD
Declaration
public SwitchableLoggedBehavior(Func<TIn, Task<TOut>> defaultBehavior, Action<TIn> logCallback)
Parameters
Type | Name | Description |
---|---|---|
Func<TIn, Task<TOut>> | defaultBehavior | TBD |
Action<TIn> | logCallback | TBD |
Properties
| Improve this Doc View SourceCurrentBehavior
Declaration
public Func<TIn, Task<TOut>> CurrentBehavior { get; }
Property Value
Type | Description |
---|---|
Func<TIn, Task<TOut>> |
DefaultBehavior
Declaration
public Func<TIn, Task<TOut>> DefaultBehavior { get; }
Property Value
Type | Description |
---|---|
Func<TIn, Task<TOut>> |
LogCallback
Declaration
public Action<TIn> LogCallback { get; }
Property Value
Type | Description |
---|---|
Action<TIn> |
Methods
| Improve this Doc View SourceApply(TIn)
Declaration
public Task<TOut> Apply(TIn param)
Parameters
Type | Name | Description |
---|---|---|
TIn | param |
Returns
Type | Description |
---|---|
Task<TOut> |
Pop()
Declaration
public void Pop()
Push(Func<TIn, Task<TOut>>)
Changes the current behavior to the provided one
Declaration
public void Push(Func<TIn, Task<TOut>> behavior)
Parameters
Type | Name | Description |
---|---|---|
Func<TIn, Task<TOut>> | behavior | Function that takes a parameter type |
PushConstant(TOut)
Changes the behavior to return a completed Task with the given constant value.
Declaration
public void PushConstant(TOut result)
Parameters
Type | Name | Description |
---|---|---|
TOut | result | The constant the Task will be completed with. |
PushDelayed()
Enables control of the completion of the previously active behavior. Wraps the previous behavior in
Declaration
public TaskCompletionSource<bool> PushDelayed()
Returns
Type | Description |
---|---|
TaskCompletionSource<Boolean> | TBD |
PushError(Exception)
Changes the behavior to return a faulted Task with the given exception
Declaration
public void PushError(Exception e)
Parameters
Type | Name | Description |
---|---|---|
Exception | e | The exception responsible for faulting this task |