Write() публичный Метод

public Write ( IEnumerable keys ) : void
keys IEnumerable
Результат void
Пример #1
0
        private void InitializeHistory(LowLevelToAbstractConsoleAdapter adapter)
        {
            var keyMap = new Dictionary<ConsoleKey, Func<HistoryEntry>>
                             {
                                 { ConsoleKey.UpArrow, () => _history.GetNextEntry() },
                                 { ConsoleKey.DownArrow, () => _history.GetPreviousEntry() }
                             };

            adapter.KeyStrokes
                .Select(keyInfo => keyInfo.Key)
                .Where(key => key == ConsoleKey.UpArrow || key == ConsoleKey.DownArrow)
                .Select(key => keyMap[key])
                .Subscribe(func =>
                               {
                                   adapter.EraseCurrentLine();
                                   var historyEntry = func();

                                   if (historyEntry != null)
                                   {
                                       adapter.Write(historyEntry.Value);
                                   }
                               });
        }
        public void WriteWorks()
        {
            
            var lowLevelConsole = new LowLevelTestConsole();
            var adapter = new LowLevelToAbstractConsoleAdapter(lowLevelConsole) { Prompt = "(S) " };

            adapter.Write("Hello");
            adapter.Write(" ");
            adapter.Write("World");
            
            Assert.AreEqual("Hello World", lowLevelConsole.ReadInLineFromTo(0, 0, 10));
            Assert.AreEqual(11, lowLevelConsole.CursorLeft);
        }