Two essential things:
Console.ReadLine - ( )Console.ReadLine TextReader ,
, TextReader ( , ):
public static int Get_Commands(TextReader reader)
{
}
Get_Commands :
int commandsNumber = Get_Commands(Console.In);
unit test , , , StringReader :
[Test]
public void Get_Commands_ReturnsCorrectNumberOfCommands()
{
const string InputString =
"150" + Environment.NewLine +
"10" + Environment.NewLine;
var stringReader = new StringReader(InputString);
var actualCommandsNumber = MyClass.Get_Commands(stringReader);
Assert.That(actualCommandsNumber, Is.EqualTo(10));
}