Hi everyone first post here.
I want to create a unit test for a member function of a class called ScoreBoard which is storing the TOP5 players in a simple game. The problem is that the method i am creating test for(SignInScoreBoard) is calling Console.ReadLine() so the User can type his 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.Insert(topScored.Count, pair);
}
else
{
if (steps < topScored[4].Value)
{
topScored.RemoveAt(4);
Console.Write(ASK_FOR_NAME_MESSAGE);
string name = Console.ReadLine();
topScored.Insert(4, new KeyValuePair<string, int>(name, steps));
}
}
}
Is there a way to insert like 10 users so I can check if the 5 with less moves(steps) are being stored ?