Class BaseGraphExecutionTests
Inheritance
Namespace: Unity.VisualScripting.Tests.Units
Assembly: solution.dll
Syntax
public abstract class BaseGraphExecutionTests
Fields
m_GameObject
Declaration
protected GameObject m_GameObject
Field Value
| Type | Description |
|---|---|
| GameObject |
Methods
AddUnit<TUnit>(FlowGraph, TUnit)
Declaration
public static TUnit AddUnit<TUnit>(FlowGraph g, TUnit unit) where TUnit : IUnit
Parameters
| Type | Name | Description |
|---|---|---|
| FlowGraph | g | |
| TUnit | unit |
Returns
| Type | Description |
|---|---|
| TUnit |
Type Parameters
| Name | Description |
|---|---|
| TUnit |
HasAttribute<T, A>(string)
Check if a type's field has a specific attribute
Declaration
public static bool HasAttribute<T, A>(string fieldName) where A : Attribute
Parameters
| Type | Name | Description |
|---|---|---|
| string | fieldName | Name of the field |
Returns
| Type | Description |
|---|---|
| bool | If the given field has the given attribute |
Type Parameters
| Name | Description |
|---|---|
| T | Type to check |
| A | Attribute to check |
HasHiddenLabel(IUnitPort)
Check if the port has a hidden label.
Declaration
public static bool HasHiddenLabel(IUnitPort port)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnitPort | port | The port to check |
Returns
| Type | Description |
|---|---|
| bool |
PortLabel(IUnitPort)
Get a label of a port, or null if it's set to not display a string.
Declaration
public static string PortLabel(IUnitPort port)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnitPort | port |
Returns
| Type | Description |
|---|---|
| string |
SetUpTestGraph(FlowGraph)
Declaration
protected (GraphReference, GameObject) SetUpTestGraph(FlowGraph graph)
Parameters
| Type | Name | Description |
|---|---|---|
| FlowGraph | graph |
Returns
| Type | Description |
|---|---|
| (GraphReference, GameObject) |
TestGraphPullOnTestOutputUnits(Action<FlowGraph>, Dictionary<string, List<object>>)
Test a data graph and compare it to expected values. This is practical for data nodes (triggered when pulling on their outputs), but not really for flow nodes (triggered when one of their execution ports is entered).
Declaration
protected void TestGraphPullOnTestOutputUnits(Action<FlowGraph> buildGraph, Dictionary<string, List<object>> expectedValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<FlowGraph> | buildGraph | Builds a graph using the provided lambda. it should contain TestOutputUnits that will record specific values |
| Dictionary<string, List<object>> | expectedValues |
TestGraphRunCoroutineUpdateNodes(Action<FlowGraph, ControlOutput>, Dictionary<string, List<object>>, Dictionary<string, int>, Dictionary<string, int>)
Test a flow graph and compare it to expected values. This is practical for flow (triggered when one of their execution ports is entered) and data nodes (triggered when pulling on their outputs). the build graph lambda takes a ControlOutput in parameter: connect whatever you want triggered during testing to it
Declaration
protected void TestGraphRunCoroutineUpdateNodes(Action<FlowGraph, ControlOutput> buildGraph, Dictionary<string, List<object>> expectedValues, Dictionary<string, int> expectedTriggers, Dictionary<string, int> expectedCoroutineTriggers)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<FlowGraph, ControlOutput> | buildGraph | Builds a graph using the provided lambda. it should contain TestOutputUnits that will record specific values and/or TestTriggerUnits that will count how many times they are triggered |
| Dictionary<string, List<object>> | expectedValues | The values expected to go into the TestOutputUnit nodes |
| Dictionary<string, int> | expectedTriggers | The number of times the TestTriggerUnit nodes are expected to be triggered in total |
| Dictionary<string, int> | expectedCoroutineTriggers | The number of times the TestTriggerUnit nodes are expected to be triggered as a coroutine |
Remarks
This version of the function triggers the initial Update unit as a coroutine.
TestGraphRunUpdateNodes(Action<FlowGraph, ControlOutput>, Dictionary<string, List<object>>, Dictionary<string, int>, Action<FlowGraph>)
Test a flow graph and compare it to expected values. This is practical for flow (triggered when one of their execution ports is entered) and data nodes (triggered when pulling on their outputs). the build graph lambda takes a ControlOutput in parameter: connect whatever you want triggered during testing to it
Declaration
protected void TestGraphRunUpdateNodes(Action<FlowGraph, ControlOutput> buildGraph, Dictionary<string, List<object>> expectedValues = null, Dictionary<string, int> expectedTriggers = null, Action<FlowGraph> verify = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<FlowGraph, ControlOutput> | buildGraph | Builds a graph using the provided lambda. it should contain TestOutputUnits that will record specific values and/or TestTriggerUnits that will count how many times they are triggered |
| Dictionary<string, List<object>> | expectedValues | |
| Dictionary<string, int> | expectedTriggers | |
| Action<FlowGraph> | verify |