Пример #1
0
        public void WithValue_positive()
        {
            cache["b"] = 2;

            int number = 0;

            cache.WithValue("b", i => number = i);

            number.ShouldBe(2);
        }
Пример #2
0
        public virtual CommandRun HelpRun(Queue <string> queue)
        {
            var input = (HelpInput)(new HelpCommand().Usages.BuildInput(queue));

            input.CommandTypes = _commandTypes.GetAll();


            if (input.Name.IsNotEmpty())
            {
                input.InvalidCommandName = true;
                input.Name = input.Name.ToLowerInvariant();
                _commandTypes.WithValue(input.Name, type =>
                {
                    input.InvalidCommandName = false;
                    input.Usage = new UsageGraph(type);
                });
            }

            return(new CommandRun()
            {
                Command = new HelpCommand(),
                Input = input
            });
        }