SHARE
TWEET

Untitled

a guest Apr 20th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Reflection;
  3. using NUnit.Framework;
  4. using UnityEngine;
  5. using UnityEngine.SceneManagement;
  6. using UnityEngine.TestTools;
  7.  
  8. namespace Tests
  9. {
  10.     public class NewTestScript
  11.     {
  12.         [UnityTest]
  13.         public IEnumerator NewTestScriptWithEnumeratorPasses()
  14.         {
  15.             SceneManager.LoadScene("Gameplay");
  16.             yield return new WaitForSeconds(1.0f);
  17.  
  18.             Match match = Object.FindObjectOfType<Match>();
  19.             Debug.Log(match);
  20.  
  21.             CueVariable currentCue = this.GetPrivateField<CueVariable, Match>(match, "currentCue");
  22.             Debug.Log(currentCue.Value);
  23.  
  24.             yield return null;
  25.         }
  26.  
  27.         private TField GetPrivateField<TField, TClass>(TClass owner, string fieldName)
  28.         {
  29.             FieldInfo field = typeof(TClass).GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
  30.             return (TField)field.GetValue(owner);
  31.         }
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top