using System.Collections; using System.Linq; using System.IO; using NUnit.Framework; using TMPro; using UnityEngine; using UnityEngine.TestTools; using UnityEngine.SceneManagement; public class CourseActivityTests { [UnitySetUp] public IEnumerator SetupFunction() { string path = Path.Combine("Assets", "users.json"); var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}"; using (StreamWriter writer = new StreamWriter(path)) { writer.Write(oneUser); } SystemController.GetInstance().LoadNextScene("Common/Scenes/CourseActivityScreen"); yield return new WaitForSeconds(0.2f); } [UnityTest] public IEnumerator StartCoursesTests() { var courseActivityScreen = (CourseActivityScreen) GameObject.FindObjectOfType(typeof(CourseActivityScreen)); courseActivityScreen.StartCourse(); yield return new WaitForSeconds(0.2f); var templateCourse = (TemplateCourse) GameObject.FindObjectOfType(typeof(TemplateCourse)); Assert.IsNotNull(templateCourse); } }