58 lines
1.8 KiB
C#
58 lines
1.8 KiB
C#
using NUnit.Framework;
|
|
using System.Collections.Generic;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
/// <summary>
|
|
/// Test the SystemController class
|
|
/// </summary>
|
|
[TestFixture]
|
|
public class SystemControllerTests
|
|
{
|
|
/// <summary>
|
|
/// Test whether the singleton instance is correctly returned
|
|
/// </summary>
|
|
[Test]
|
|
public void Test_SystemController_GetInstance()
|
|
{
|
|
Assert.IsNotNull(SystemController.GetInstance());
|
|
}
|
|
|
|
/// <summary>
|
|
/// Test whether a non valid scene also yields a non valid index
|
|
/// </summary>
|
|
[Test]
|
|
public void Test_GetSceneIndex_InvalidScene()
|
|
{
|
|
Assert.AreEqual(-1, SystemController.GetSceneIndex("a/non/existing/scene"));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Test whether a valid scene also yields a valid index
|
|
/// </summary>
|
|
[Test]
|
|
public void Test_GetSceneIndex_ValidScene()
|
|
{
|
|
List<string> scenes = new List<string>()
|
|
{
|
|
"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
|
|
}
|
|
}
|