49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using System.Linq;
|
|
using NUnit.Framework;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using Vanguard.Api;
|
|
using Vanguard.App;
|
|
using Vanguard.Auth;
|
|
using Vanguard.State;
|
|
using Vanguard.UI;
|
|
|
|
namespace Vanguard.Tests
|
|
{
|
|
public sealed class ClientSmokeTests
|
|
{
|
|
[Test]
|
|
public void AppRootView_Builds_Login_And_Meta_Screens()
|
|
{
|
|
var config = new AppConfig();
|
|
config.Load();
|
|
|
|
var tokens = new TokenStore();
|
|
var api = new ApiClient(config, tokens);
|
|
var player = new PlayerState();
|
|
var auth = new AuthService(api, tokens, player);
|
|
var root = new AppRootView(config, auth, player);
|
|
|
|
root.Initialize();
|
|
root.ShowLogin("smoke");
|
|
|
|
Assert.IsNotNull(GameObject.Find("Vanguard Canvas"));
|
|
Assert.IsNotNull(GameObject.Find("LoginScreen"));
|
|
Assert.IsTrue(Resources.FindObjectsOfTypeAll<GameObject>().Any(go => go.name == "MetaScreen"));
|
|
|
|
Cleanup();
|
|
}
|
|
|
|
private static void Cleanup()
|
|
{
|
|
var canvas = GameObject.Find("Vanguard Canvas");
|
|
if (canvas != null)
|
|
Object.DestroyImmediate(canvas);
|
|
|
|
var eventSystem = Object.FindAnyObjectByType<EventSystem>();
|
|
if (eventSystem != null)
|
|
Object.DestroyImmediate(eventSystem.gameObject);
|
|
}
|
|
}
|
|
}
|