Struct SimulationTestContext<TNodeData>
A unique node testing context provided to test functions (SimulationTestFunctionWithContext<TNodeData>)
that are injected into simulation via SendTest<TNodeData>(NodeHandle, SimulationTestFunctionWithContext<TNodeData>).
Allows recovery of the tested node's simulation data in order for the function to make assertions about its
contents and throw exceptions (such as those from an
Inherited Members
Namespace: Unity.DataFlowGraph
Syntax
public struct SimulationTestContext<TNodeData>
where TNodeData : struct, INodeData
Type Parameters
Name | Description |
---|---|
TNodeData |
Properties
NodeData
The INodeData instance associated with the node currently being tested.
Declaration
public TNodeData NodeData { get; }
Property Value
Type | Description |
---|---|
TNodeData |
Methods
Exists(NodeHandle)
Tests whether the supplied node handle refers to a currently valid node instance.
Declaration
public bool Exists(NodeHandle handle)
Parameters
Type | Name | Description |
---|---|---|
NodeHandle | handle |
Returns
Type | Description |
---|---|
Boolean |
SendTest<TSubNodeData>(NodeHandle, SimulationTestFunction<TSubNodeData>)
Shorthand version of SendTest<TSubNodeData>(NodeHandle, SimulationTestFunctionWithContext<TSubNodeData>) omitting the SimulationTestContext<TNodeData> for simple test cases which do not require testing of child nodes.
Declaration
public void SendTest<TSubNodeData>(NodeHandle handle, SimulationTestFunction<TSubNodeData> code)
where TSubNodeData : struct, INodeData
Parameters
Type | Name | Description |
---|---|---|
NodeHandle | handle | |
SimulationTestFunction<TSubNodeData> | code |
Type Parameters
Name | Description |
---|---|
TSubNodeData |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the given |
SendTest<TSubNodeData>(NodeHandle, SimulationTestFunctionWithContext<TSubNodeData>)
Allows testing child nodes of this node. Child nodes are exclusively direct descendants that were created by the node associated with this SimulationTestContext<TNodeData>. Specifying any other node handle is undefined behaviour. SendTest<TNodeData>(NodeHandle, SimulationTestFunctionWithContext<TNodeData>)
Declaration
public void SendTest<TSubNodeData>(NodeHandle handle, SimulationTestFunctionWithContext<TSubNodeData> code)
where TSubNodeData : struct, INodeData
Parameters
Type | Name | Description |
---|---|---|
NodeHandle | handle | |
SimulationTestFunctionWithContext<TSubNodeData> | code |
Type Parameters
Name | Description |
---|---|
TSubNodeData |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the given |