48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System.Collections;
|
|
using NUnit.Framework;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.TestTools;
|
|
using Vanguard.App;
|
|
|
|
namespace Vanguard.Tests
|
|
{
|
|
public sealed class AppBootstrapPlayModeTests
|
|
{
|
|
[UnityTest]
|
|
public IEnumerator App_Bootstraps_And_Shows_Login()
|
|
{
|
|
if (Object.FindAnyObjectByType<VanguardApp>() == null)
|
|
{
|
|
var go = new GameObject("Test App");
|
|
go.AddComponent<VanguardApp>();
|
|
}
|
|
|
|
yield return null;
|
|
yield return null;
|
|
|
|
Assert.IsNotNull(Object.FindAnyObjectByType<VanguardApp>());
|
|
Assert.IsNotNull(GameObject.Find("Vanguard Canvas"));
|
|
Assert.IsNotNull(GameObject.Find("LoginScreen"));
|
|
|
|
Cleanup();
|
|
yield return null;
|
|
}
|
|
|
|
private static void Cleanup()
|
|
{
|
|
var app = Object.FindAnyObjectByType<VanguardApp>();
|
|
if (app != null)
|
|
Object.Destroy(app.gameObject);
|
|
|
|
var canvas = GameObject.Find("Vanguard Canvas");
|
|
if (canvas != null)
|
|
Object.Destroy(canvas);
|
|
|
|
var eventSystem = Object.FindAnyObjectByType<EventSystem>();
|
|
if (eventSystem != null)
|
|
Object.Destroy(eventSystem.gameObject);
|
|
}
|
|
}
|
|
}
|