public void GetRandomDictionaryValueTest() { for (int i = 0; i < iterations; i++) { int value = RarityEnumDictionary.GetRandomValue(); Debug.Log($"GetRandomDictionaryValueTest : {value}"); Assert.NotNull(value); } }
public void EnumNamesToArrayTest() { string[] nameArray = Tools.EnumNamesToArray <RarityEnum>(); int[] valueArray = Tools.EnumValuesToArray <RarityEnum>(); for (int i = 0; i < nameArray.Length; i++) { // Verify that a string can be converted to an enum and that enum is a key in the RarityEnumDictionary. // Verify Key exists. Assert.AreEqual(true, RarityEnumDictionary.ContainsKey(nameArray[i].ToEnum <RarityEnum>())); // Verify that a string can be converted to an enum and that the dictionary contains a Key equal to the converted enum. // Verify Key value is the same. Assert.AreEqual(nameArray[i].ToEnum <RarityEnum>(), RarityEnumDictionary.Keys.Cast <RarityEnum>().ToArray()[i]); // Verify value is the same. Assert.AreEqual(valueArray[i], RarityEnumDictionary[nameArray[i].ToEnum <RarityEnum>()]); } }