using System.Collections; using NUnit.Framework; using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.SceneManagement; using UnityEngine.TestTools; public class MainMenuTest { [UnitySetUp] public IEnumerator SetUp() { yield return EditorSceneManager.LoadSceneAsyncInPlayMode( "Assets/Scenes/SampleScene.unity", new LoadSceneParameters(LoadSceneMode.Single) ); } [Test] public void OnlyOneEventSystem() { EventSystem[] eventSystems = Object.FindObjectsOfType(); Assert.AreEqual(1, eventSystems.Length); } [Test] public void StartIsSelected() { var eventSystem = Object.FindObjectOfType(); Assert.NotNull(eventSystem); GameObject currentSelected = eventSystem.currentSelectedGameObject; Assert.NotNull(currentSelected); // Maybe find other way than string compare? Assert.AreEqual("Start Button", currentSelected.name); } }