コード例 #1
0
            public void CreatesGoodMenuItemFromUndocumentedMethod()
            {
                var menuTarget = new TestMenuTarget();
                var target     = MenuItem.Print(() => menuTarget.DoItTheRightWay());

                Assert.AreEqual("Do It The Right Way", target.DisplayString);
            }
コード例 #2
0
            public async Task InvokesAction2()
            {
                var menuTarget = new TestMenuTarget();
                var target     = new[] { MenuItem.Print(() => menuTarget.DoItTheRightWay()) };

                var simulator = new ConsoleSimulator("0", " ", " ");

                MenuItem.Console = simulator;

                await target.Show(simulator);

                Assert.AreEqual("{clear}", simulator.Output[0]);
                Assert.AreEqual("0) Do It The Right Way", simulator.Output[1]);
            }