idle-survivors/Assets/TestsPlaymode/HeroPartyTest.cs

25 lines
700 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;
public class HeroPartyTest
{
[UnityTest]
public IEnumerator HeroPartyGetsAllTheHeroes()
{
var prefab = AssetDatabase.LoadAssetAtPath<GameObject>("Assets/Prefabs/Hero.prefab");
Assert.IsNotNull(prefab);
var instance = Object.Instantiate(prefab);
var hero = instance.GetComponent<HeroUnit>();
var party = hero.getParty();
yield return null;
Assert.AreEqual(1, party.Count);
Object.Destroy(instance);
yield return null;
Assert.IsEmpty(party.UnitList);
}
}