public void CharacterJobEnumHelper_ConvertStringToEnum_Should_Pass() { // Arrange // Act var result = CharacterJobEnumHelper.ConvertStringToEnum("Flying"); // Assert Assert.AreEqual(CharacterJobEnum.Flying, result); // Assert }
public void CharacterJobEnumHelper_ConvertStringToEnum_Should_Pass() { // Arrange var myList = Enum.GetNames(typeof(CharacterJobEnum)).ToList(); CharacterJobEnum myActual; CharacterJobEnum myExpected; // Act foreach (var item in myList) { myActual = CharacterJobEnumHelper.ConvertStringToEnum(item); myExpected = (CharacterJobEnum)Enum.Parse(typeof(CharacterJobEnum), item); // Assert Assert.AreEqual(myExpected, myActual, "string: " + item + TestContext.CurrentContext.Test.Name); } }