Resolve WES-113 "Commons tests"

This commit is contained in:
Tibe Habils
2023-03-23 11:35:14 +00:00
parent 2581cd6137
commit 5a5a1f1542
27 changed files with 624 additions and 2 deletions

View File

@@ -0,0 +1,41 @@
using System.Collections;
using System.Linq;
using System.IO;
using NUnit.Framework;
using TMPro;
using UnityEngine;
using UnityEngine.TestTools;
using UnityEngine.SceneManagement;
public class CourseMenuScreenTest
{
[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/CoursesMenuScreen");
yield return new WaitForSeconds(0.2f);
}
[UnityTest]
public IEnumerator GotoListOfCoursesTest()
{
var courseMenuScreen = (CourseMenuScreen) GameObject.FindObjectOfType(typeof(CourseMenuScreen));
courseMenuScreen.GotoListOfCourses();
yield return new WaitForSeconds(0.2f);
var listCoursesScreen = (ListCoursesScreen)GameObject.FindObjectOfType(typeof(ListCoursesScreen));
Assert.IsNotNull(listCoursesScreen);
}
}