I have a method. I want to test the method with a unit test. What's a good way to test that method?
public class ChoiceOption
{
public static int Choice(string message, string errorMessage)
{
while (true)
{
try
{
Console.Write(message);
string userInput = Console.ReadLine();
if (userInput == string.Empty)
{
userInput = "0";
}
return int.Parse(userInput);
}
catch (Exception)
{
Console.WriteLine(errorMessage);
}
}
}
}