extract repeating code in method ConsoleTest