{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Class MonoBehaviourTest<T> | Test Framework | 2.0.1-exp.2
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class MonoBehaviourTest<T>

    This is a wrapper that allows running tests on MonoBehaviour scripts. Inherits from CustomYieldInstruction MonoBehaviourTest is a coroutine and a helper for writing MonoBehaviour tests. Yield a MonoBehaviourTest when using the UnityTest attribute to instantiate the MonoBehaviour you wish to test and wait for it to finish running. Implement the IMonoBehaviourTest interface on the MonoBehaviour to state when the test completes.

    Inheritance
    object
    CustomYieldInstruction
    MonoBehaviourTest<T>
    Implements
    IEnumerator
    Inherited Members
    CustomYieldInstruction.MoveNext()
    CustomYieldInstruction.Reset()
    CustomYieldInstruction.Current
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: UnityEngine.TestTools
    Assembly: solution.dll
    Syntax
    public class MonoBehaviourTest<T> : CustomYieldInstruction, IEnumerator where T : MonoBehaviour, IMonoBehaviourTest
    Type Parameters
    Name Description
    T

    A MonoBehaviour component created for the test and attached to the tests GameObject.

    Constructors

    Name Description
    MonoBehaviourTest(bool)

    Initializes and returns an instance of MonoBehaviourTest.

    Properties

    Name Description
    component

    A MonoBehaviour component created for the test and attached to the test's GameObject.

    gameObject

    A GameObject created as a container for the test component.

    keepWaiting

    (Inherited) Returns `true`` if the test is not finished yet, which keeps the coroutine suspended

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)