Class TestBase
Basic unity test base class.
Namespace: nickmaltbie.TestUtilsUnity.Tests.TestCommon
Assembly: cs.temp.dll.dll
Syntax
public class TestBase : InputTestFixture
Fields
createdDevices
List of created input devices.
Declaration
protected List<InputDevice> createdDevices
Field Value
| Type | Description |
|---|---|
| List<InputDevice> |
gameObjects
List of game objects created as part of the test.
Declaration
protected List<GameObject> gameObjects
Field Value
| Type | Description |
|---|---|
| List<GameObject> |
scriptableObjects
List of scriptable objects created as part of the test.
Declaration
protected List<ScriptableObject> scriptableObjects
Field Value
| Type | Description |
|---|---|
| List<ScriptableObject> |
Methods
CreateGameObject()
Create a game object and save it to cleanup at the end of the test.
Declaration
protected GameObject CreateGameObject()
Returns
| Type | Description |
|---|---|
| GameObject | Created game object. |
CreateGameObject(GameObject)
Create a game object and save it to cleanup at the end of the test.
Declaration
protected GameObject CreateGameObject(GameObject original)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | original | Original object to create from base. |
Returns
| Type | Description |
|---|---|
| GameObject | Created game object. |
CreateScriptableObject<E>()
Create a scriptable object and register it as part of the test.
Declaration
protected E CreateScriptableObject<E>()
where E : ScriptableObject
Returns
| Type | Description |
|---|---|
| E | Created scriptable object. |
Type Parameters
| Name | Description |
|---|---|
| E | Type of scriptable object to create. |
OneTimeSetUp()
Setup a basic test.
Declaration
public virtual void OneTimeSetUp()
RegisterGameObject(GameObject)
Register a game object as part of a test to cleanup once the test is completed.
Declaration
protected void RegisterGameObject(GameObject go)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | go | Game object to register. |
RegisterInputDevice(InputDevice)
Register an InputDevice as part of a test to cleanup once the test is completed.
Declaration
protected void RegisterInputDevice(InputDevice device)
Parameters
| Type | Name | Description |
|---|---|---|
| InputDevice | device | InputDevice to register. |
RegisterScriptableObject(ScriptableObject)
Register a ScriptableObject as part of a test to cleanup once the test is completed.
Declaration
protected void RegisterScriptableObject(ScriptableObject so)
Parameters
| Type | Name | Description |
|---|---|---|
| ScriptableObject | so | ScriptableObject to register. |
SetupInputDevice<E>()
Setup an input device and given action map.
Declaration
public (E, PlayerInput, InputActionMap) SetupInputDevice<E>()
where E : InputDevice
Returns
| Type | Description |
|---|---|
| (T1 Item1, T2 Item2, T3 Item3)<E, PlayerInput, InputActionMap> | Tuple of the input device, player input, and created action map. |
Type Parameters
| Name | Description |
|---|---|
| E | Type of device craeted. |
TearDown()
Cleanup created objects in the basic test.
Declaration
public override void TearDown()
TestDirections()
Set of basic directions for tests.
Declaration
public static IEnumerable<Vector3> TestDirections()
Returns
| Type | Description |
|---|---|
| IEnumerable<Vector3> |
UnityTearDown()
Cleanup created objects in the basic test.
Declaration
public virtual void UnityTearDown()
ValidateDrawGizmo(Action, Int32, Boolean)
Validate that given gizmos are drawn.
Declaration
public IEnumerator ValidateDrawGizmo(Action GizmoAction, int maxIter = 60, bool assertDrawn = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | GizmoAction | Gizmo action to validate. |
| Int32 | maxIter | |
| Boolean | assertDrawn |
Returns
| Type | Description |
|---|---|
| IEnumerator |