Example #1
0
        public void _標準入力からの取得をシミュレーション_入力補完あり_複数候補あり(
            [ValueSource(typeof(_複数候補の入力補完Fixture), "Params")] Tuple <string, string[]> inParameter)
        {
            var dic = ConsoleTestHelper.ListHelpCommands();
            var buf = new FakeConsoleReadBuffer(dic, inParameter.Item1)
            {
                Prompt = "> ",
            };

            Assert.That(buf.InCompleting, Is.False);

            buf.ReadToEnd();
            Assert.That(buf.Current, Is.EqualTo(inParameter.Item1));
            Assert.That(buf.InCompleting, Is.False);

            foreach (var expected in inParameter.Item2)
            {
                Assert.That(buf.ReadExtraTab(), Is.EqualTo(expected.Last()));
                Assert.That(buf.Current, Is.EqualTo(expected));
                Assert.That(buf.InCompleting, Is.True);
            }

            Assert.That(buf.ReadExtraSpace(), Is.EqualTo(' '));
            Assert.That(buf.Current, Is.EqualTo(inParameter.Item2.Last() + ' '));
            Assert.That(buf.InCompleting, Is.False);
        }
Example #2
0
        public void _ヘルプ表示依頼()
        {
            var app = new FakeConsoleRunner(
                "help"
                );

            var it = ConsoleTestHelper.ListExpectedHelpContents().GetEnumerator();

            app.LogUpdated += (message) => {
                Assert.That(it.MoveNext(), Is.True);
                Assert.That(message, Is.Not.Null.And.Not.Empty);
                Assert.That(message, Is.EqualTo(it.Current));
            };

            app.Run();

            Assert.That(it.MoveNext(), Is.False);
        }
Example #3
0
        public void _ヘルプ表示依頼を処理する()
        {
            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContext()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            var it = ConsoleTestHelper.ListExpectedHelpContents().GetEnumerator();

            var runner = repo.FindRunner(new HelpParseResult(), (message) => {
                Assert.That(it.MoveNext(), Is.True);
                Assert.That(message, Is.Not.Null.And.Not.Empty);
                Assert.That(message, Is.EqualTo(it.Current));
            });

            runner();

            Assert.That(it.MoveNext(), Is.False);
        }