示例#1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="input">Input should contains only numbers</param>
        /// <param name="yPosition">Cursor position (Y axis)</param>
        /// <param name="digitFactory"></param>
        /// <param name="outputController">redirect the program output</param>
        public LcdWriterService(string input, int yPosition, DigitFactory digitFactory, IOutputController outputController)
        {
            if (string.IsNullOrWhiteSpace(input))
            {
                throw new ArgumentNullException(nameof(input), "The input string should not be null.");
            }

            _yPosition        = yPosition;
            _digitFactory     = digitFactory;
            _outputController = outputController;
            _digits           = ConvertStringToDigits(input);
        }
示例#2
0
        static void Main(string[] args)
        {
            var input = CheckArgs(args);

            var digitFactory   = new DigitFactory();
            var standardOutput = new StandardOutput();

            var lcdWriterService = new LcdWriterService(input, Console.CursorTop, digitFactory, standardOutput);

            lcdWriterService.Write();

            Console.ReadKey();
        }