public static void RunCreditsCommand() { var nonStaticTestCommands = new NonStaticTestCommands7(); CmdLinery.Run(new object[] { nonStaticTestCommands }, new string[] { "Credits", }, new TestApplicationInfo(), new ConsoleMessenger(), new HelpProvider(() => new ConsoleMessenger())); }
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()); }); }
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); }