/** * Unit test of the ListOfPlayers function */ void TestListOfPlayers() { print("TestListOfPlayers..."); List <string> playerList; PlayerColor newPlayer; CreateFile(); //Empty list playerList = ColorFileManager.ListOfPlayers(path); Assert.AreEqual(0, playerList.Count, string.Format("<color=#{0:X2}{1:X2}{2:X2}>{3}</color>", (byte)(255), (byte)(0), (byte)(0), "...FAILED : Value should be 0!")); //Add a player newPlayer = new PlayerColor("Test", anger, surprise, joy, sadness); ColorFileManager.EditPlayer(newPlayer, path); playerList = ColorFileManager.ListOfPlayers(path); Assert.AreEqual(1, playerList.Count, string.Format("<color=#{0:X2}{1:X2}{2:X2}>{3}</color>", (byte)(255), (byte)(0), (byte)(0), "...FAILED : Value should be 1!")); //Add an other player newPlayer = new PlayerColor("Test2", anger, surprise, joy, sadness); ColorFileManager.EditPlayer(newPlayer, path); playerList = ColorFileManager.ListOfPlayers(path); Assert.AreEqual(2, playerList.Count, string.Format("<color=#{0:X2}{1:X2}{2:X2}>{3}</color>", (byte)(255), (byte)(0), (byte)(0), "...FAILED : Value should be 2!")); //Edit the first player newPlayer = new PlayerColor("Test", anger, surprise, joy, sadness); ColorFileManager.EditPlayer(newPlayer, path); playerList = ColorFileManager.ListOfPlayers(path); Assert.AreEqual(2, playerList.Count, string.Format("<color=#{0:X2}{1:X2}{2:X2}>{3}</color>", (byte)(255), (byte)(0), (byte)(0), "...FAILED : Value should be 2!")); DeleteFile(); }
/** * Update the dropdown element */ public void UpdateDropdown() { dropdown.ClearOptions(); dropdown.AddOptions(sortPlayersList(ColorFileManager.ListOfPlayers())); dropdown.value = searchDefaultIndex(); }