C# unit test for a method which calls Console.ReadLine()
问题 I want to create a unit test for a member function of a class called ScoreBoard which is storing the top five players in a game. The problem is that the method I created a test for ( SignInScoreBoard ) is calling Console.ReadLine() so the user can type their name: public void SignInScoreBoard(int steps) { if (topScored.Count < 5) { Console.Write(ASK_FOR_NAME_MESSAGE); string name = Console.ReadLine(); KeyValuePair<string, int> pair = new KeyValuePair<string, int>(name, steps); topScored