public void _標準入力からの取得をシミュレーション_入力補完あり2(string inPartial, string inExpected) { var dic = ConsoleAppHelper.ListCommands(); var buf = new FakeConsoleReadBuffer(dic, inPartial) { Prompt = "> ", }; Assert.That(buf.InCompleting, Is.False); buf.ReadToEnd(); Assert.That(buf.Current, Is.EqualTo(inPartial)); Assert.That(buf.InCompleting, Is.False); Assert.That(buf.ReadExtraTab(), Is.EqualTo(inExpected.Last())); Assert.That(buf.Current, Is.EqualTo(inExpected)); Assert.That(buf.InCompleting, Is.True); Assert.That(buf.ReadExtraTab(), Is.EqualTo(inExpected.Last())); Assert.That(buf.Current, Is.EqualTo(inExpected)); Assert.That(buf.InCompleting, Is.True); Assert.That(buf.ReadExtraNewLine(), Is.EqualTo('\n')); Assert.That(buf.Current, Is.Null.Or.Empty); Assert.That(buf.History.Any(), Is.True); Assert.That(buf.History.Last(), Is.EqualTo(inExpected)); }
public static IEnumerable <string> ListHelpCommands() { var commands = ConsoleAppHelper.ListCommands(); return(commands.Concat(commands.Select(c => "help " + c))); }