Skip to Main Content

BTD_Mod_Helper​.Api​.ModTest


BloonsTD6 Mod Helper

BTD_Mod_Helper.Api

ModTest Class

Defines a test task for a mod

public abstract class ModTest : BTD_Mod_Helper.Api.ModContent

Inheritance System.ObjectModContent  ModTest

Properties

ModTest.Completed Property

Whether the current run of this test has completed

public bool Completed { get; set; }

Property Value

System.Boolean

ModTest.Exception Property

Exception that happened in the most recent run of this test, if any

public System.Exception Exception { get; set; }

Property Value

System.Exception

ModTest.Failed Property

Whether the most recent run of this test failed to complete successfully

public bool Failed { get; }

Property Value

System.Boolean

ModTest.Suceeded Property

Whether the most recent run of this test completed successfully

public bool Suceeded { get; }

Property Value

System.Boolean

Methods

ModTest.Assert(bool, string) Method

Throws an BTD_Mod_Helper.Api.ModTest.AssertException if the given condition is not true

public void Assert(bool condition, string message="");

Parameters

condition System.Boolean

Condition that must be true for the test to continue

message System.String

Optional message describing the failure

ModTest.AssertComponentExists(string, string) Method

Throws an BTD_Mod_Helper.Api.ModTest.AssertException if no UnityEngine.Component of type T
with the given name can be found within any currently loaded scene

public T AssertComponentExists<T>(string name, string message="")
    where T : Component;

Type parameters

T

Component type to search for

Parameters

name System.String

Name of the GameObject the component should be attached to

message System.String

Optional message describing the failure

Returns

T

ModTest.AssertEquals(object, object, string) Method

Throws an BTD_Mod_Helper.Api.ModTest.AssertException if the two given objects are not equal

public void AssertEquals(object o1, object o2, string message="");

Parameters

o1 System.Object

First object to compare

o2 System.Object

Second object to compare

message System.String

Optional message describing the failure

ModTest.AssertThrows(Action, string) Method

Throws an BTD_Mod_Helper.Api.ModTest.AssertException if the given action does not throw an exception

public void AssertThrows(System.Action action, string message="");

Parameters

action System.Action

Action that is expected to throw

message System.String

Optional message describing the failure

ModTest.AssertThrows(Action, string) Method

Throws an BTD_Mod_Helper.Api.ModTest.AssertException if the given action does not throw an exception of type T

public void AssertThrows<T>(System.Action action, string message="");

Type parameters

T

Type of exception that the action is expected to throw

Parameters

action System.Action

Action that is expected to throw

message System.String

Optional message describing the failure

ModTest.EnsureOnMainMenuWithNoPopUps() Method

Ensures that the game is on the main menu screen with no popups before continuing

public System.Collections.IEnumerator EnsureOnMainMenuWithNoPopUps();

Returns

System.Collections.IEnumerator

ModTest.Fail(string) Method

Unconditionally fails the test with the given message

public void Fail(string message="");

Parameters

message System.String

Optional message describing the failure

ModTest.LoadIntoGame(InGameData) Method

Loads the game into a real match of BTD6

public System.Collections.IEnumerator LoadIntoGame(InGameData inGameData);

Parameters

inGameData Il2CppAssets.Scripts.Unity.UI_New.InGame.InGameData

specifics about game type

Returns

System.Collections.IEnumerator

ModTest.RunTest() Method

Runs the test coroutine

public System.Collections.IEnumerator RunTest();

Returns

System.Collections.IEnumerator

ModTest.Test() Method

Primary test coroutine

public abstract System.Collections.IEnumerator Test();

Returns

System.Collections.IEnumerator

ModTest.Throw(Exception) Method

Records and throws the given exception, causing the test to fail

public void Throw(System.Exception e);

Parameters

e System.Exception

ModTest.Timeout(object, float) Method

Wraps a coroutine so that the test will fail if it does not complete within the given time

public System.Collections.IEnumerator Timeout(object coroutine, float seconds);

Parameters

coroutine System.Object

Coroutine (managed or Il2Cpp) or yield value to run with a timeout

seconds System.Single

Maximum number of seconds the coroutine is allowed to run for

Returns

System.Collections.IEnumerator