示例#1
0
        public void SupportsAnyRegisteredCommand()
        {
            var cmd = kernel.Get <ICommand>("help");

            var dummy = new DummyCommand
            {
                Name        = "dummy",
                Description = "dummy description",
                Help        = "dummy help"
            };

            kernel.Bind <ICommand>().ToConstant(dummy).Named("dummy");

            cmd.Run(kernel.Get <Suite>(), new string[0]);
            output.Messages.Should().NotBeEmpty();
            output.Descriptions.Should().NotBeEmpty();
            output.Descriptions.Should().Contain(t => t.Item1 == "dummy" && t.Item2 == "dummy description");

            output.Reset();
            cmd.Run(kernel.Get <Suite>(), new[] { "dummy" });

            output.Messages.Should().HaveCount(2);
            output.Messages.Should().HaveElementAt(0, "dummy help");
            output.Descriptions.Should().BeEmpty();
        }
示例#2
0
        public void SetUp()
        {
            kernel = new StandardKernel();
            Kernel.RegisterCommandFactory(kernel);

            var command1 = new DummyCommand {Name = "cmd1", NeedsExplicitTargetGoal = true};
            var command2 = new DummyCommand {Name = "cmd2", NeedsExplicitTargetGoal = false};

            kernel.Bind<ICommand>().ToConstant(command1).Named("cmd1");
            kernel.Bind<ICommand>().ToConstant(command2).Named("cmd2");
        }
示例#3
0
        public void SetUp()
        {
            kernel = new StandardKernel();
            Kernel.RegisterCommandFactory(kernel);

            var command1 = new DummyCommand {
                Name = "cmd1", NeedsExplicitTargetGoal = true
            };
            var command2 = new DummyCommand {
                Name = "cmd2", NeedsExplicitTargetGoal = false
            };

            kernel.Bind <ICommand>().ToConstant(command1).Named("cmd1");
            kernel.Bind <ICommand>().ToConstant(command2).Named("cmd2");
        }
示例#4
0
文件: HelpTest.cs 项目: vigoo/bari
        public void SupportsAnyRegisteredCommand()
        {
            var cmd = kernel.Get<ICommand>("help");

            var dummy = new DummyCommand
                            {
                                Name = "dummy",
                                Description = "dummy description",
                                Help = "dummy help"
                            };
            kernel.Bind<ICommand>().ToConstant(dummy).Named("dummy");

            cmd.Run(kernel.Get<Suite>(), new string[0]);
            output.Messages.Should().NotBeEmpty();
            output.Descriptions.Should().NotBeEmpty();
            output.Descriptions.Should().Contain(t => t.Item1 == "dummy" && t.Item2 == "dummy description");

            output.Reset();
            cmd.Run(kernel.Get<Suite>(), new[] { "dummy" });

            output.Messages.Should().HaveCount(2);
            output.Messages.Should().HaveElementAt(0, "dummy help");
            output.Descriptions.Should().BeEmpty();
        }