Exemple #1
0
        public static void RunCreditsCommand()
        {
            var nonStaticTestCommands = new NonStaticTestCommands7();

            CmdLinery.Run(new object[] { nonStaticTestCommands },
                          new string[]
            {
                "Credits",
            }, new TestApplicationInfo(), new ConsoleMessenger(), new HelpProvider(() => new ConsoleMessenger()));
        }
Exemple #2
0
        public static void RunHelpCommandWithCustomHelperProvider()
        {
            var nonStaticTestCommands = new NonStaticTestCommands7();
            var testLoggerMoc         = new Mock <ITestLogger>();

            nonStaticTestCommands.TestLogger = testLoggerMoc.Object;
            const string logMessage    = "Running NonStaticCommand()";
            var          commandString = new string[]
            {
                "Help"
            };

            testLoggerMoc.Setup(logger => logger.Write(logMessage));
            Assert.Throws <CustomTestHelpProviderException>(() =>
            {
                CmdLinery.Run(new object[] { nonStaticTestCommands }, commandString, new TestApplicationInfo(), new ConsoleMessenger(), new CustomTestHelpProvider());
            });
        }
Exemple #3
0
        public static void RunNonStaticCommandWithParamenterHavingEqualCharacter()
        {
            var       nonStaticTestCommands = new NonStaticTestCommands7();
            const int expected      = 10;
            var       testLoggerMoc = new Mock <ITestLogger>();

            nonStaticTestCommands.TestLogger = testLoggerMoc.Object;
            const string logMessage    = "Running NonStaticCommand(\"LDAP://OU=TST,OU=Groups,DC=tst,DC=local\")";
            var          commandString = new string[]
            {
                "NonStaticCommand",
                "/parameter1=\"LDAP://OU=TST,OU=Groups,DC=tst,DC=local\""
            };

            testLoggerMoc.Setup(logger => logger.Write(logMessage));
            int actual = CmdLinery.Run(new object[] { nonStaticTestCommands }, commandString, new TestApplicationInfo(), new ConsoleMessenger());

            Assert.AreEqual(expected, actual);
            testLoggerMoc.Verify(logger => logger.Write(logMessage), Times.Once);
        }