public IEnumerator ReturnNullIfPathIsNullDuringRemove() { SceneManager.LoadScene("Scene", LoadSceneMode.Single); yield return(new WaitForSeconds(1.0f)); goA = SceneManager.GetActiveScene().GetRootGameObjects(); GameObject go = goA[3].transform.Find("Save Load Menu").gameObject; SaveLoadMenu slm = go.GetComponent <SaveLoadMenu>(); string[] paths = Directory.GetFiles(Application.persistentDataPath, "*.map"); slm.SelectItem(""); int MapCount = slm.listContent.childCount; slm.Delete(); Assert.IsEmpty(slm.path); foreach (GameObject g in goA) { GameObject.Destroy(g); } GameObject.Destroy(go); GameObject.Destroy(slm); SceneManager.UnloadScene("Scene"); }
public IEnumerator DeleteMapFromMenuList() { SceneManager.LoadScene("Scene", LoadSceneMode.Single); yield return(new WaitForSeconds(1.0f)); goA = SceneManager.GetActiveScene().GetRootGameObjects(); GameObject go = goA[3].transform.Find("Save Load Menu").gameObject; SaveLoadMenu slm = go.GetComponent <SaveLoadMenu>(); string[] paths = Directory.GetFiles(Application.persistentDataPath, "*.map"); slm.SelectItem("test3"); slm.hexGrid = goA[1].GetComponent <HexGrid>(); slm.Open(true); slm.Action(); int MapCount = slm.listContent.childCount; slm.Delete(); for (int i = 0; i < slm.listContent.childCount; i++) { for (int j = 0; j < paths.Length; j++) { if (slm.listContent.GetChild(i).gameObject.GetComponent <SaveLoadItem>().MapName != "test3") { Assert.IsTrue(true); yield return(null); } } } Assert.IsFalse(false); foreach (GameObject g in goA) { GameObject.Destroy(g); } GameObject.Destroy(go); GameObject.Destroy(slm); SceneManager.UnloadScene("Scene"); }