SHARE
TWEET

Untitled

a guest Jul 16th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using NUnit.Framework;
  4. using UnityEngine;
  5. using UnityEngine.SceneManagement;
  6. using UnityEngine.TestTools;
  7. using UnityEngine.UI;
  8.  
  9. namespace Tests
  10. {
  11.     public class SceneLoadTests
  12.     {
  13.         [UnityTest]
  14.         public IEnumerator LevelSelection_Load_Test()
  15.         {
  16.             string wantedScene = "LevelSelection";
  17.  
  18.             SceneManager.LoadScene("MainMenu", LoadSceneMode.Single);
  19.             yield return null;
  20.  
  21.             GameObject mainMenuUI = GameObject.Find("MainMenuUI");
  22.             Button startGameButton = mainMenuUI.GetComponentInChildren<Button>();
  23.  
  24.             startGameButton.onClick.Invoke();
  25.             yield return null;
  26.  
  27.             Assert.AreEqual(wantedScene, SceneManager.GetActiveScene().name);
  28.         }
  29.     }
  30. }
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