Defines a test task for a mod
public abstract class ModTest : BTD_Mod_Helper.Api.ModContent
Inheritance System.Object ModContent ModTest
Derived
↳ ModContentDefaultTest<T>
Default difficulty to use
public static readonly string DefaultDifficulty;
Default map to use
public static readonly string DefaultMap;
Default mode to use
public static readonly string DefaultMode;
The current UnityToSimulation, either from the Simulation Test Environment or the current game
public UnityToSimulation Bridge { get; }
Il2CppAssets.Scripts.Unity.Bridge.UnityToSimulation
Whether the current run of this test has completed
public bool Completed { get; set; }
Current SimulationTestEnvironment. Use SetupSimEnvironment(Action<SimulationTest>) to set it up, and DisposeSimEnvironment() to dispose
public SimulationTestEnvironment Environment { get; set; }
Il2CppAssets.Scripts.SimulationTests.SimulationTestEnvironment
Exception that happened in the most recent run of this test, if any
public System.Exception Exception { get; set; }
Whether the most recent run of this test failed to complete successfully
public bool Failed { get; }
Whether this test is available for purposes like running every test added by a mod
public virtual bool IsAvailable { get; }
Whether the most recent run of this test completed successfully
public bool Suceeded { get; }
Throws an BTD_Mod_Helper.Api.Testing.ModTest.AssertException if the given condition is not true
public void Assert(bool condition, string message="");
condition System.Boolean
Condition that must be true for the test to continue
message System.String
Optional message describing the failure
Throws an BTD_Mod_Helper.Api.Testing.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;
T
Component type to search for
name System.String
Name of the GameObject the component should be attached to
message System.String
Optional message describing the failure
Throws an BTD_Mod_Helper.Api.Testing.ModTest.AssertException if the two given objects are not equal
public void AssertEquals(object o1, object o2, string message="");
First object to compare
Second object to compare
message System.String
Optional message describing the failure
Throws an BTD_Mod_Helper.Api.Testing.ModTest.AssertException if the given object is null
public T AssertNotNull<T>(T obj, string message="");
T
obj T
message System.String
Optional message describing the failure
Throws an BTD_Mod_Helper.Api.Testing.ModTest.AssertException if the given action does not throw an exception
public void AssertThrows(System.Action action, string message="");
action System.Action
Action that is expected to throw
message System.String
Optional message describing the failure
Throws an BTD_Mod_Helper.Api.Testing.ModTest.AssertException if the given action does not throw an exception of type T
public void AssertThrows<T>(System.Action action, string message="");
T
Type of exception that the action is expected to throw
action System.Action
Action that is expected to throw
message System.String
Optional message describing the failure
Helper to create a tower model at a specific location. Ignores placement/inventory checks and cost
public static TowerToSimulation CreateTowerAt(UnityToSimulation bridge, Vector2 at, TowerModel towerModel, bool ignoreInventoryChecks=true, bool ignorePlacementChecks=true, int costOverride=-1);
bridge Il2CppAssets.Scripts.Unity.Bridge.UnityToSimulation
UnityToSimulation
tower coordinates
towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel
TowerModel to use
ignoreInventoryChecks System.Boolean
place regardless of TowerInventory restrictions
ignorePlacementChecks System.Boolean
place regardless of placement restrictions
costOverride System.Int32
override purchase cost, -1 to not override (default
Il2CppAssets.Scripts.Unity.Bridge.TowerToSimulation
Created TowerToSimulation
Tears down the current Environment
public void DisposeSimEnvironment();
Ensures that the game is on the main menu screen with no popups before continuing
public System.Collections.IEnumerator EnsureOnMainMenuWithNoPopUps();
System.Collections.IEnumerator
Unconditionally fails the test with the given message
public void Fail(string message="");
message System.String
Optional message describing the failure
Loads the game into a real match of BTD6
public System.Collections.IEnumerator LoadIntoGame(InGameData inGameData=null);
inGameData Il2CppAssets.Scripts.Unity.UI_New.InGame.InGameData
specifics about game type
System.Collections.IEnumerator
Runs the test coroutine
public System.Collections.IEnumerator RunTest();
System.Collections.IEnumerator
Sets up a Il2CppAssets.Scripts.SimulationTests.SimulationTestEnvironment to use for test, storing it at Environment
Used for testing matches without actually starting a real game
public System.Collections.IEnumerator SetupSimEnvironment(System.Action<SimulationTest> setupTest=null);
setupTest System.Action<Il2Cpp.SimulationTest>
System.Collections.IEnumerator
Primary test coroutine
public abstract System.Collections.IEnumerator Test();
System.Collections.IEnumerator
Records and throws the given exception, causing the test to fail
public void Throw(System.Exception e);
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);
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
System.Collections.IEnumerator
Upgrades a tower on a specified path
public static bool UpgradeTower(UnityToSimulation bridge, ObjectId tower, int path);
bridge Il2CppAssets.Scripts.Unity.Bridge.UnityToSimulation
UnityToSimulation bridge
tower Il2CppAssets.Scripts.ObjectId
The tower to upgrade
path System.Int32
The upgrade path index
Upgrades a tower on a specified path
public static bool UpgradeTower(UnityToSimulation bridge, Tower tower, int path);
bridge Il2CppAssets.Scripts.Unity.Bridge.UnityToSimulation
UnityToSimulation bridge
tower Il2CppAssets.Scripts.Simulation.Towers.Tower
The tower to upgrade
path System.Int32
The upgrade path index
Upgrades a tower on a specified path
public static bool UpgradeTower(UnityToSimulation bridge, TowerToSimulation tower, int path);
bridge Il2CppAssets.Scripts.Unity.Bridge.UnityToSimulation
UnityToSimulation bridge
tower Il2CppAssets.Scripts.Unity.Bridge.TowerToSimulation
The tower to upgrade
path System.Int32
The upgrade path index
Upgrades a tower to being a paragon
public static bool UpgradeTowerParagon(UnityToSimulation bridge, ObjectId tower);
bridge Il2CppAssets.Scripts.Unity.Bridge.UnityToSimulation
UnityToSimulation bridge
tower Il2CppAssets.Scripts.ObjectId
The tower to upgrade
Upgrades a tower to being a paragon
public static bool UpgradeTowerParagon(UnityToSimulation bridge, Tower tower);
bridge Il2CppAssets.Scripts.Unity.Bridge.UnityToSimulation
UnityToSimulation bridge
tower Il2CppAssets.Scripts.Simulation.Towers.Tower
The tower to upgrade
Upgrades a tower to being a paragon
public static bool UpgradeTowerParagon(UnityToSimulation bridge, TowerToSimulation tower);
bridge Il2CppAssets.Scripts.Unity.Bridge.UnityToSimulation
UnityToSimulation bridge
tower Il2CppAssets.Scripts.Unity.Bridge.TowerToSimulation
The tower to upgrade