コード例 #1
0
ファイル: UnknownTaskTests.cs プロジェクト: ramarag/XTask
        public void NoParameters()
        {
            ITaskRegistry registry = Substitute.For<ITaskRegistry>();
            UnknownTask task = new UnknownTask(registry, "GeneralHelp");
            ITaskInteraction interaction = Substitute.For<ITaskInteraction>();
            ILoggers loggers = Substitute.For<ILoggers>();
            interaction.Loggers.Returns(loggers);
            ILogger logger = Substitute.For<ILogger>();
            loggers[LoggerType.Status].Returns(logger);

            task.Execute(interaction).Should().Be(ExitCode.InvalidArgument);
            logger.Received().WriteLine(WriteStyle.Error, XTaskStrings.ErrorNoParametersSpecified);
        }
コード例 #2
0
ファイル: UnknownTaskTests.cs プロジェクト: ramarag/XTask
        public void UnknownTaskLogsHelp()
        {
            ITaskRegistry registry = Substitute.For<ITaskRegistry>();
            UnknownTask task = new UnknownTask(registry, "GeneralHelp");
            ITaskInteraction interaction = Substitute.For<ITaskInteraction>();
            ILoggers loggers = Substitute.For<ILoggers>();
            interaction.Loggers.Returns(loggers);
            ILogger logger = Substitute.For<ILogger>();
            loggers[LoggerType.Result].Returns(logger);

            task.Execute(interaction).Should().Be(ExitCode.InvalidArgument);
            logger.Received().WriteLine(WriteStyle.Fixed, "GeneralHelp");
        }
コード例 #3
0
ファイル: UnknownTaskTests.cs プロジェクト: ramarag/XTask
        public void UnkownCommand()
        {
            ITaskRegistry registry = Substitute.For<ITaskRegistry>();
            UnknownTask task = new UnknownTask(registry, "GeneralHelp");
            ITaskInteraction interaction = Substitute.For<ITaskInteraction>();
            IArgumentProvider arguments = Substitute.For<IArgumentProvider>();
            string commandName = "Foo";
            interaction.Arguments.Returns(arguments);
            interaction.Arguments.Command.Returns(commandName);
            ILoggers loggers = Substitute.For<ILoggers>();
            interaction.Loggers.Returns(loggers);
            ILogger logger = Substitute.For<ILogger>();
            loggers[LoggerType.Status].Returns(logger);

            task.Execute(interaction).Should().Be(ExitCode.InvalidArgument);
            logger.Received().WriteLine(WriteStyle.Error, XTaskStrings.UnknownCommand, commandName);
        }