Resolve Common-Interfaces-Tests
This commit is contained in:
40
Assets/Common/Tests/ThemeTest.cs
Normal file
40
Assets/Common/Tests/ThemeTest.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
/// <summary>
|
||||
/// Test the Theme class
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class ThemeTest
|
||||
{
|
||||
private Theme theme;
|
||||
private List<string> names = new List<string>() { "appel", "peer", "banaan" };
|
||||
/// <summary>
|
||||
/// Setup a theme with some learnables in it
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
theme = ScriptableObject.CreateInstance<Theme>();
|
||||
foreach (string name in names)
|
||||
{
|
||||
Learnable learnable = new Learnable();
|
||||
learnable.name = name;
|
||||
theme.learnables.Add(learnable);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Test if all the learnables are stored in the theme
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestThemeLearnables()
|
||||
{
|
||||
// Check if each of the learnables is kept
|
||||
foreach (Learnable learnable in theme.learnables)
|
||||
{
|
||||
names.Remove(learnable.name);
|
||||
}
|
||||
// Assert that all items have been checked
|
||||
Assert.IsTrue(names.Count == 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user