using NUnit.Framework; using System.Collections.Generic; using UnityEngine.SceneManagement; /// /// Test the SystemController class /// [TestFixture] public class SystemControllerTests { /// /// Test whether the singleton instance is correctly returned /// [Test] public void Test_SystemController_GetInstance() { Assert.IsNotNull(SystemController.GetInstance()); } /// /// Test whether a non valid scene also yields a non valid index /// [Test] public void Test_GetSceneIndex_InvalidScene() { Assert.AreEqual(-1, SystemController.GetSceneIndex("a/non/existing/scene")); } /// /// Test whether a valid scene also yields a valid index /// [Test] public void Test_GetSceneIndex_ValidScene() { List scenes = new List() { "Common/Scenes/Boot", "Common/Scenes/MainMenuScreen", "Common/Scenes/CoursesMenuScreen", "Common/Scenes/ListCoursesScreen", "Common/Scenes/ListMinigamesScreen", "Common/Scenes/CourseActivityScreen", "Common/Scenes/MinigameActivityScreen", "Common/Scenes/ThemeSelectionScreen", "Common/Scenes/SettingsScreen", "Accounts/Scenes/UserCreationScreen", "Accounts/Scenes/ChangeUserScreen", "Accounts/Scenes/UserProgressScreen", "Courses/Scenes/CourseScreen", "SpellingBee/Scenes/SpellingBeeGame", "Hangman/Scenes/HangmanGame", "JustSign/Scenes/JustSignGame", }; Assert.AreEqual(SceneManager.sceneCountInBuildSettings, scenes.Count); // Testing wether the names and indices are correct needs to be done in PlayMode } }